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