/// <summary> /// Load the form using table 'CustomerCustomerDemo' PrimaryKey /// </summary> public void LoadForm(string CustomerID, string CustomerTypeID) { string error = null; CustomerCustomerDemoDataContext = dataConnection.GetDataContext(CustomerID, CustomerTypeID, out error); DataContext = CustomerCustomerDemoDataContext; }
/// <summary> /// Alternative contructor. Creates the Form and also load it's data using table '' Primary key. /// </summary> public FormWPFCustomerCustomerDemo(WPFConfig config, string CustomerID, string CustomerTypeID, Frame mainFrame) { this.config = config; this.FrameMainWindow = mainFrame; dataConnection = new WPFCustomerCustomerDemoDB(config); string error = null; CustomerCustomerDemoDataContext = dataConnection.GetDataContext(CustomerID, CustomerTypeID, out error); DataContext = CustomerCustomerDemoDataContext; InitializeComponent(); }
public void LoadGrid(Func <ModelNotifiedForCustomerCustomerDemo, bool> filter = null) { this.DataGridCustomerCustomerDemo.ItemsSource = null; //Saving current language WPFMessageAndLabelForList currentLanguage = new WPFMessageAndLabelForList(); if (this.CustomerCustomerDemoDataContext != null) { currentLanguage = this.CustomerCustomerDemoDataContext.WPFMessageAndLabelForList; } string error = null; this.CustomerCustomerDemoDataContext = dataConnection.GetDataContext(out error); if (!string.IsNullOrEmpty(error)) { MessageBox.Show(error); return; } //Setting language messages this.CustomerCustomerDemoDataContext.WPFMessageAndLabelForList = currentLanguage; this.DataContext = CustomerCustomerDemoDataContext; List <ModelNotifiedForCustomerCustomerDemo> filteredList; if (filter == null) { filteredList = CustomerCustomerDemoDataContext.modelNotifiedForCustomerCustomerDemoMain; } else { filteredList = CustomerCustomerDemoDataContext.modelNotifiedForCustomerCustomerDemoMain.Where(filter).ToList(); } //Bind data SetGridData(filteredList); //Load detail forms/lists in master/detail if (CustomerCustomerDemoDataContext.modelNotifiedForCustomerCustomerDemoMain.Count != 0) { this.LoadDetail(CustomerCustomerDemoDataContext.modelNotifiedForCustomerCustomerDemoMain[0]); } }