Ejemplo n.º 1
0
        private void button_Click_1(object sender, RoutedEventArgs e)
        {
            int Employer_ID;

            try
            {
                MessageBoxResult result = MessageBox.Show("You really want to delete this employer", "Warning", MessageBoxButton.YesNoCancel,
                                                          MessageBoxImage.Question);
                switch (result)
                {
                case MessageBoxResult.Yes:
                {
                    int.TryParse(comboBox.SelectedItem.ToString(), out Employer_ID);
                    if (bl.AllCONTRACT_TO_EMPLOYER(Employer_ID).Count() != 0)
                    {
                        throw new Exception("this employer has got a contract with an employee you cant remove it");        //verifie if the employer has got a contrat with an employee
                    }
                    bl.removeEmployer(Employer_ID);
                    showDataGridView();
                    break;
                }

                case MessageBoxResult.No:
                    break;
                }
            }
            catch (Exception ex)
            {
                showDataGridView();
                MessageBox.Show(ex.Message);
            }
        }
 private void showDataGridView(int k)
 {
     try
     {
         DataGrid_s.ItemsSource = null;
         DataGrid_s.ItemsSource = bl.AllCONTRACT_TO_EMPLOYER(k);
     }
     catch (Exception)
     {
         MessageBox.Show("שגיאה", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Ejemplo n.º 3
0
 private void showDataGridView(int i, int id)//datagrid
 {
     try
     {
         DataGrid_s.ItemsSource = null;
         if (i == 1)
         {
             var v = from n in bl.Allcontract()
                     where n.employeeID == id
                     select n;
             DataGrid_s.ItemsSource = v;
         }
         else if (i == 2)
         {
             DataGrid_s.ItemsSource = bl.AllCONTRACT_TO_EMPLOYER(id);
         }
     }
     catch (Exception)
     {
         MessageBox.Show("שגיאה", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }