private void saveButton_Click(object sender, RoutedEventArgs e) { try { switch (EmployerUC_State) { case State.createNew: BE.Employer addEmployer = new BE.Employer(); Globals.CopyObject(UIEmployer, addEmployer); BL_Object.addEmployer(addEmployer); break; case State.modify: BL_Object.updateEmployer(UIEmployer); Employer_DS_Change_Event?.Invoke(); break; default: throw new Exception("EmployerUC State not set"); } Employer_DS_Change_Event?.Invoke(); restoreButtonVisib(); } catch (Exception ex) { Globals.exceptionHandler(ex); } }
private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { int ID; int.TryParse(comboBox.SelectedItem.ToString(), out ID); employer = bl.searchId_find_employer(ID); this.DataContext = employer; }
public allEmployer(BL.IBL Bl) { this.bl = Bl; InitializeComponent(); employer = new BE.Employer(); this.DataContext = employer; bl = BL.FactoryBL.GetBL(); showDataGridView(); }
public UpdateEmployer(BL.IBL Bl) { this.bl = Bl; InitializeComponent(); employer = new BE.Employer(); this.DataContext = employer; bl = BL.FactoryBL.GetBL(); showDataGridView(); this.domainComboBox.ItemsSource = Enum.GetValues(typeof(BE.employerDomain)); }
public AddEmployeur(BL.IBL Bl) { this.bl = Bl; InitializeComponent(); employer = new BE.Employer(); this.DataContext = employer; bl = BL.FactoryBL.GetBL(); showDataGridView(); this.domainComboBox.ItemsSource = Enum.GetValues(typeof(BE.employerDomain)); employer.CompanyDateCreation = DateTime.Now; employer.DateContractSigned = DateTime.Now; }
public ADDEmployer(BL.IBL Bl)//ctor { this.bl = Bl; InitializeComponent(); employer = new BE.Employer(); employer.creationDate = DateTime.Now; this.DataContext = employer; bl = BL.FactoryBL.GetBL(); showDataGridView(); this.disciplineComboBox.ItemsSource = Enum.GetValues(typeof(BE.discipline)); this.comboBox_city.ItemsSource = Enum.GetValues(typeof(BE.city)); }
public update_employer(BL.IBL Bl) { this.bl = Bl; InitializeComponent(); employer = new BE.Employer(); this.DataContext = employer; bl = BL.FactoryBL.GetBL(); showDataGridView(); this.disciplineComboBox.ItemsSource = Enum.GetValues(typeof(BE.discipline)); foreach (int id in bl.return_names_id_employer()) { comboBox.Items.Add(id); } }
private void button_Add(object sender, RoutedEventArgs e) { try { bl.addEmployer(employer); employer = new BE.Employer(); this.DataContext = employer; showDataGridView(); } catch (Exception ex) { showDataGridView(); MessageBox.Show(ex.Message); } }
private void addButton_Click(object sender, RoutedEventArgs e)//button add { try { employer.city = comboBox_city.SelectedValue.ToString(); bl.addEmployer(employer); employer = new BE.Employer(); this.DataContext = employer; showDataGridView(); } catch (Exception ex) { showDataGridView(); MessageBox.Show(ex.Message); } }
// only called when new ID selected from combobox list, if value entered is not in combobox list, not called private void ComEmployerID_SelectionChanged(object sender, SelectionChangedEventArgs e) { BE.Employer foundEmployer = BL_Object.getEmployerList().FirstOrDefault(x => x == (BE.Employer)ComEmployerID.SelectedItem); if (Equals(foundEmployer, null)) // check if null because uint cast potentially on null { // resets UIEmployer fields, in effect reseting all controls in UI bc of binding Globals.CopyObject(new BE.Employer(), UIEmployer); return; } // copy values (by use of property get/set) of foundEmployer to UIEmployer so binding to UIEmployer not reset else { Globals.CopyObject(foundEmployer, UIEmployer); } }
private void addButton_Click(object sender, RoutedEventArgs e) { int ID; int.TryParse(comboBox.SelectedItem.ToString(), out ID); try { employer.companyID = ID; bl.uptdateEmployer(employer); employer = new BE.Employer(); this.DataContext = employer; showDataGridView(); } catch (Exception ex) { showDataGridView(); MessageBox.Show(ex.Message); } }