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
|