private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { int ID; int.TryParse(comboBox.SelectedItem.ToString(), out ID); expert = bl.return_expert(ID); this.DataContext = expert; }
public Update_specialization() { InitializeComponent(); expert = new BE.specialization(); this.DataContext = expert; bl = BL.FactoryBL.GetBL(); this.expertiseComboBox.ItemsSource = Enum.GetValues(typeof(BE.expertise)); this.disciplineComboBox.ItemsSource = Enum.GetValues(typeof(BE.discipline)); showDataGridView(); COMBO_bOX(); }
public Window_specialization(BL.IBL bl)//ctor { this.bl = bl; InitializeComponent(); specialiste = new BE.specialization(); this.DataContext = specialiste; bl = BL.FactoryBL.GetBL(); showDataGridView(); this.expertiseComboBox.ItemsSource = Enum.GetValues(typeof(BE.expertise)); this.disciplineComboBox.ItemsSource = Enum.GetValues(typeof(BE.discipline)); }
/* private void addButton_Click(object sender, RoutedEventArgs e) * { * int id; * int minwag; * int maxwag; * try * { * int.TryParse(textBoxCONTRACT_ID.Text, out id); * int.TryParse(textBoxmin.Text, out minwag); * int.TryParse(textBoxmax.Text, out maxwag); * bl.addExpert(new BE.specialization * { * specialization_id = id, * minWage = minwag, * maxWage = maxwag, * }); * * this.DataContext = specialiste; * showDataGridView(); * * } * catch (Exception ex) * { * * showDataGridView(); * MessageBox.Show(ex.Message); * } * } */ private void button_Click(object sender, RoutedEventArgs e) { try { bl.addExpert(specialiste); specialiste = new BE.specialization(); this.DataContext = specialiste; showDataGridView(); } catch (Exception ex) { showDataGridView(); MessageBox.Show(ex.Message); } }
private void button_Click_1(object sender, RoutedEventArgs e) { int ID; int.TryParse(comboBox.SelectedItem.ToString(), out ID); try { expert.specialization_id = ID; bl.updateExpert(expert); expert = new BE.specialization(); this.DataContext = expert; showDataGridView(); } catch (Exception ex) { showDataGridView(); MessageBox.Show(ex.Message); } }
/* private void addButton_Click(object sender, RoutedEventArgs e) * { * int id; * int minwag; * int maxwag; * try * { * int.TryParse(textBoxCONTRACT_ID.Text, out id); * int.TryParse(textBoxmin.Text, out minwag); * int.TryParse(textBoxmax.Text, out maxwag); * bl.addExpert(new BE.specialization * { * specialization_id = id, * minWage = minwag, * maxWage = maxwag, * }); * * this.DataContext = specialiste; * showDataGridView(); * * } * catch (Exception ex) * { * * showDataGridView(); * MessageBox.Show(ex.Message); * } * } */ private void button_Click(object sender, RoutedEventArgs e)//add { try { if (specialiste.maxWage < specialiste.minWage) { throw new Exception("the wage is not smaller than max"); } bl.addExpert(specialiste); specialiste = new BE.specialization(); this.DataContext = specialiste; showDataGridView(); } catch (Exception ex) { showDataGridView(); MessageBox.Show(ex.Message); } }
private void button_Click_1(object sender, RoutedEventArgs e) { int ID; //int.TryParse(comboBox.SelectedItem.ToString(), out ID); try { if (expert.maxWage < expert.minWage) { throw new Exception("the wage is not smaller than max"); } int.TryParse(comboBox.SelectedItem.ToString(), out ID); expert.specialization_id = ID; bl.updateExpert(expert); expert = new BE.specialization(); this.DataContext = expert; showDataGridView(); } catch (Exception ex) { showDataGridView(); MessageBox.Show(ex.Message); } }