New Posts New Posts RSS Feed: how to save a relation?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

how to save a relation?

 Post Reply Post Reply
Author
pponzano View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Apr-2011
Location: Italy
Posts: 165
Post Options Post Options   Quote pponzano Quote  Post ReplyReply Direct Link To This Post Topic: how to save a relation?
    Posted: 09-Jul-2012 at 12:35am
Hello,
I've the following tables

Dashboard

CREATE TABLE [dbo].[DBOARD](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [DESCRIZIONE] [varchar](50) NOT NULL,
 CONSTRAINT [PK_DBS] PRIMARY KEY CLUSTERED
(
    [ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]

Layout

CREATE TABLE [dbo].[LAYOUT](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [DESCRIZIONE] [varchar](50) NULL,
 CONSTRAINT [PK_LAYOUT] PRIMARY KEY CLUSTERED
(
    [ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]


Dashboard_Layout

CREATE TABLE [dbo].[LAYOUT_DBOARD](
    [ID_DBOARD] [int] NOT NULL,
    [ID_LAYOUT] [int] NOT NULL,
 CONSTRAINT [PK_LAYOUTDBOARD] PRIMARY KEY CLUSTERED
(
    [ID_DBOARD] ASC,
    [ID_LAYOUT] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[LAYOUT_DBOARD]  WITH CHECK ADD  CONSTRAINT [FK_DBOARD_LAYOUT] FOREIGN KEY([ID_LAYOUT])
REFERENCES [dbo].[LAYOUT] ([ID])
GO

ALTER TABLE [dbo].[LAYOUT_DBOARD] CHECK CONSTRAINT [FK_DBOARD_LAYOUT]
GO

ALTER TABLE [dbo].[LAYOUT_DBOARD]  WITH CHECK ADD  CONSTRAINT [FK_LAYOUT_DBOARD] FOREIGN KEY([ID_DBOARD])
REFERENCES [dbo].[DBOARD] ([ID])
GO

ALTER TABLE [dbo].[LAYOUT_DBOARD] CHECK CONSTRAINT [FK_LAYOUT_DBOARD]
GO

I've a silverlight application that permits me to choose which layout is applied to a dashboard...

I my XAML application for getting the selected Item I do

   <telerik:RadComboBox Grid.Row="1" Grid.Column="1" SelectedItem="{Binding LAYOUT[0]}" DisplayMemberPath="DESCRIZIONE"
                                             ItemsSource="{Binding DataContext.ListaLayout,Mode=OneWay,RelativeSource={RelativeSource AncestorType=UserControl}}"
                                             Style="{StaticResource RadComboBoxMetroStyle}" Width="300" HorizontalAlignment="Left" ></telerik:RadComboBox>

This loads in the dropdown the current selected item, when I choose another one and try to save I have still the old selected one...
since for saving I'm doing

  public OperationResult CreateDashBoard(DBOARD dashboard, Action<IEnumerable> onSuccess = null, Action<Exception> onFail = null)
        {
            entityManagerProvider.Manager.AddEntity(dashboard);

            return AlwaysCompletedOperationResult.Instance;
        }

the dashboard.LAYOUT[0] is still the old value I've set... how do I manage MxN relations when changing the selected Item?

Thanks

Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 09-Jul-2012 at 4:12pm
Hi Paolo,
 
Have you taken a look at our sample using Telerik controls?
You can find it in the DevForce Resource Center.
 
That might help you find what you are missing.
 
Regards,
   Silvio.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down