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