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