Beispiel #1
0
 private void EditButton_Click(object sender, RoutedEventArgs e)
 {
     Globals.swapGridsVisibility(AddEditRemoveGrid, SaveCancelGrid);
     Globals.enableFields(EmployeesPropertiesGrid, false, null, true, bankNumberTextBox, bankAddressTextBox);
     selectedButton = App.SelectedButton.Edit;
     Globals.setToToday(birthDatePicker);
 }
Beispiel #2
0
 private void RemoveButton_Click(object sender, RoutedEventArgs e)
 {
     Globals.swapGridsVisibility(AddEditRemoveGrid, SaveCancelGrid);
     Globals.enableFields(EmployeesPropertiesGrid, true, IdComboBox);
     selectedButton = App.SelectedButton.Remove;
     Globals.setToToday(birthDatePicker);
 }
 private void EditButton_Click(object sender, RoutedEventArgs e)
 {
     Globals.swapGridsVisibility(AddEditRemoveGrid, SaveCancelGrid);
     Globals.enableFields(EmployersPropertiesGrid, false, null, true);
     selectedButton = App.SelectedButton.Edit;
     Globals.setToToday(setupDateDatePicker);
 }
 private void AddButton_Click(object sender, RoutedEventArgs e)
 {
     Globals.swapGridsVisibility(AddEditRemoveGrid, SaveCancelGrid);
     Globals.enableFields(SpecializationsPropertiesGrid, false, null, true);
     IdComboBox.IsEditable = true;
     selectedButton        = App.SelectedButton.Add;
 }
 private void CancelButton_Click(object sender, RoutedEventArgs e)
 {
     selectedButton = App.SelectedButton.None;
     Globals.swapGridsVisibility(SaveCancelGrid, AddEditRemoveGrid);
     Globals.enableFields(SpecializationsPropertiesGrid, false, null, false);
     Globals.emptyAllFields(SpecializationsPropertiesGrid);
     IdComboBox.IsEditable = false;
 }
Beispiel #6
0
 private void EditButton_Click(object sender, RoutedEventArgs e)
 {
     Globals.swapGridsVisibility(AddEditRemoveGrid, SaveCancelGrid);
     Globals.enableFields(ContractsPropertiesGrids, false, null, true, netW_ageForHourTextBox);
     selectedButton = App.SelectedButton.Edit;
     Globals.setToToday(contractEstablishedDateDatePicker);
     Globals.setToToday(terminateDateDatePicker);
 }
 private void CancelButton_Click(object sender, RoutedEventArgs e)
 {
     selectedButton = App.SelectedButton.None;
     Globals.swapGridsVisibility(SaveCancelGrid, AddEditRemoveGrid);
     Globals.enableFields(EmployersPropertiesGrid, false, null, false);
     Globals.emptyAllFields(EmployersPropertiesGrid);
     EmployerData.Address  = new CivicAddress();
     IdComboBox.IsEditable = false;
 }
 public EmployersUserControl()
 {
     InitializeComponent();
     EmployerData         = new Employer();
     EmployerData.Address = new CivicAddress();
     DataContext          = EmployerData;
     foreach (Proffesion x in Enum.GetValues(typeof(BE.Proffesion)))
     {
         personalEducationComboBox.Items.Add(x);
     }
     foreach (Employer emp in FactoryBL.BL_instance.getAllEmployers())
     {
         IdComboBox.Items.Add(emp.Id);
     }
     personalEducationComboBox.SelectedItem = null;
     selectedButton = App.SelectedButton.None;
 }
Beispiel #9
0
 public ContractsUserControl()
 {
     InitializeComponent();
     ContractData = new Contract();
     DataContext  = ContractData;
     foreach (Contract c in FactoryBL.BL_instance.getAllContracts())
     {
         IdComboBox.Items.Add(c.Id);
     }
     foreach (Employee emp in FactoryBL.BL_instance.getAllEmployees())
     {
         employeeIdComboBox.Items.Add(emp.Id);
     }
     foreach (Employer emp in FactoryBL.BL_instance.getAllEmployers())
     {
         employerIdComboBox.Items.Add(emp.Id);
     }
     selectedButton = App.SelectedButton.None;
 }
 public SpecializationsUserControl()
 {
     InitializeComponent();
     SpecializationData = new Specialization();
     DataContext        = SpecializationData;
     foreach (Proffesion x in Enum.GetValues(typeof(BE.Proffesion)))
     {
         areaComboBox.Items.Add(x);
     }
     foreach (Specialization.Education edu in Enum.GetValues(typeof(Specialization.Education)))
     {
         degreeComboBox.Items.Add(edu);
     }
     foreach (Specialization sp in FactoryBL.BL_instance.getAllSpecializations())
     {
         IdComboBox.Items.Add(sp.Id);
     }
     degreeComboBox.SelectedItem = null;
     selectedButton = App.SelectedButton.None;
 }
Beispiel #11
0
 public EmployeesUserControl()
 {
     InitializeComponent();
     EmployeeData             = new Employee();
     EmployeeData.Address     = new CivicAddress();
     EmployeeData.BankAccount = new Bank();
     DataContext = EmployeeData;
     bankNameComboBox.ItemsSource = (from b in FactoryBL.BL_instance.getAllBanks() select b.BankName).Distinct();
     foreach (Employee e in FactoryBL.BL_instance.getAllEmployees())
     {
         IdComboBox.Items.Add(e.Id);
     }
     foreach (Specialization sp in FactoryBL.BL_instance.getAllSpecializations())
     {
         employeeSpecializationComboBox.Items.Add(sp);
     }
     foreach (Specialization.Education education in Enum.GetValues(typeof(Specialization.Education)))
     {
         personalEducationComboBox.Items.Add(education);
     }
     personalEducationComboBox.SelectedItem = null;
     selectedButton = App.SelectedButton.None;
 }
Beispiel #12
0
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     if (selectedButton == App.SelectedButton.Add)
     {
         if (!Globals.isEverythingNotNull <Employee>(EmployeeData))
         {
             MessageBox.Show("Fill all fields", "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         try
         {
             Employee addEmployee = new Employee();
             Globals.copyObject(EmployeeData, addEmployee);
             FactoryBL.BL_instance.addEmployee(addEmployee);
             IdComboBox.Items.Clear();
             foreach (Employee emp in FactoryBL.BL_instance.getAllEmployees())
             {
                 IdComboBox.Items.Add(emp.Id);
             }
         }
         catch (Exception err)
         {
             MessageBox.Show(err.Message, "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
     }
     if (selectedButton == App.SelectedButton.Edit)
     {
         if (!Globals.isEverythingNotNull <Employee>(EmployeeData))
         {
             MessageBox.Show("Fill all fields", "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         try
         {
             Employee oldEmployee  = FactoryBL.BL_instance.getAllEmployees().Find(x => x.Id == EmployeeData.Id);
             Employee editEmployee = new Employee();
             Globals.copyObject <Employee>(EmployeeData, editEmployee);
             FactoryBL.BL_instance.updateEmployee(editEmployee, oldEmployee);
         }
         catch (Exception err)
         {
             MessageBox.Show(err.Message, "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
     }
     if (selectedButton == App.SelectedButton.Remove)
     {
         if (EmployeeData.Id == null)
         {
             MessageBox.Show("Fill ID", "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         try
         {
             Employee removeEmployee = new Employee();
             Globals.copyObject(EmployeeData, removeEmployee);
             FactoryBL.BL_instance.removeEmployee(removeEmployee);
             IdComboBox.Items.Clear();
             foreach (Employee emp in FactoryBL.BL_instance.getAllEmployees())
             {
                 IdComboBox.Items.Add(emp.Id);
             }
         }
         catch (Exception err)
         {
             MessageBox.Show(err.Message, "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
     }
     selectedButton        = App.SelectedButton.None;
     IdComboBox.IsEditable = false;
     Globals.swapGridsVisibility(SaveCancelGrid, AddEditRemoveGrid);
     Globals.enableFields(EmployeesPropertiesGrid, false, null, false);
     Globals.emptyAllFields(EmployeesPropertiesGrid);
 }
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     if (selectedButton == App.SelectedButton.Add)
     {
         if (!Globals.isEverythingNotNull <Specialization>(SpecializationData))
         {
             MessageBox.Show("Fill all fields", "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         try
         {
             Specialization addSpecialization = new Specialization();
             Globals.copyObject(SpecializationData, addSpecialization);
             FactoryBL.BL_instance.addSpecialization(addSpecialization);
             IdComboBox.Items.Clear();
             foreach (Specialization spec in FactoryBL.BL_instance.getAllSpecializations())
             {
                 IdComboBox.Items.Add(spec.Id);
             }
         }
         catch (Exception err)
         {
             MessageBox.Show(err.Message, "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
     }
     if (selectedButton == App.SelectedButton.Edit)
     {
         if (!Globals.isEverythingNotNull <Specialization>(SpecializationData))
         {
             MessageBox.Show("Fill all fields", "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         try
         {
             Specialization oldSpecialization  = FactoryBL.BL_instance.getAllSpecializations().Find(x => x.Id == SpecializationData.Id);
             Specialization editSpecialization = new Specialization();
             Globals.copyObject <Specialization>(SpecializationData, editSpecialization);
             FactoryBL.BL_instance.updateSpecialization(editSpecialization, oldSpecialization);
         }
         catch (Exception err)
         {
             MessageBox.Show(err.Message, "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
     }
     if (selectedButton == App.SelectedButton.Remove)
     {
         if (SpecializationData.Id == null)
         {
             MessageBox.Show("Fill ID", "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         try
         {
             Specialization removeSpecialization = new Specialization();
             Globals.copyObject(SpecializationData, removeSpecialization);
             FactoryBL.BL_instance.removeSpecialization(removeSpecialization);
             IdComboBox.Items.Clear();
             foreach (Specialization spec in FactoryBL.BL_instance.getAllSpecializations())
             {
                 IdComboBox.Items.Add(spec.Id);
             }
         }
         catch (Exception err)
         {
             MessageBox.Show(err.Message, "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
     }
     selectedButton        = App.SelectedButton.None;
     IdComboBox.IsEditable = false;
     Globals.swapGridsVisibility(SaveCancelGrid, AddEditRemoveGrid);
     Globals.enableFields(SpecializationsPropertiesGrid, false, null, false);
     Globals.emptyAllFields(SpecializationsPropertiesGrid);
 }
 private void RemoveButton_Click(object sender, RoutedEventArgs e)
 {
     Globals.swapGridsVisibility(AddEditRemoveGrid, SaveCancelGrid);
     Globals.enableFields(SpecializationsPropertiesGrid, true, IdComboBox);
     selectedButton = App.SelectedButton.Remove;
 }
Beispiel #15
0
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     if (selectedButton == App.SelectedButton.Add)
     {
         if (!Globals.isEverythingNotNull <Contract>(ContractData))
         {
             MessageBox.Show("Fill all fields", "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         try
         {
             Contract addContract = new Contract();
             Globals.copyObject(ContractData, addContract);
             FactoryBL.BL_instance.addContract(addContract);
             IdComboBox.Items.Clear();
             foreach (Contract contract in FactoryBL.BL_instance.getAllContracts())
             {
                 IdComboBox.Items.Add(contract.Id);
             }
         }
         catch (Exception err)
         {
             MessageBox.Show(err.Message, "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
     }
     if (selectedButton == App.SelectedButton.Edit)
     {
         if (!Globals.isEverythingNotNull <Contract>(ContractData))
         {
             MessageBox.Show("Fill all fields", "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         try
         {
             Contract oldContract  = FactoryBL.BL_instance.getAllContracts().Find(x => x.Id == ContractData.Id);
             Contract editContract = new Contract();
             Globals.copyObject <Contract>(ContractData, editContract);
             FactoryBL.BL_instance.updateContract(editContract, oldContract);
         }
         catch (Exception err)
         {
             MessageBox.Show(err.Message, "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
     }
     if (selectedButton == App.SelectedButton.Remove)
     {
         if (ContractData.Id == null)
         {
             MessageBox.Show("Fill ID", "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         try
         {
             Contract removeContract = new Contract();
             Globals.copyObject(ContractData, removeContract);
             FactoryBL.BL_instance.removeContract(removeContract);
             IdComboBox.Items.Clear();
             foreach (Contract contract in FactoryBL.BL_instance.getAllContracts())
             {
                 IdComboBox.Items.Add(contract.Id);
             }
         }
         catch (Exception err)
         {
             MessageBox.Show(err.Message, "Don't mess with me!!!", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
     }
     selectedButton        = App.SelectedButton.None;
     IdComboBox.IsEditable = false;
     Globals.swapGridsVisibility(SaveCancelGrid, AddEditRemoveGrid);
     Globals.enableFields(ContractsPropertiesGrids, false, null, false);
     Globals.emptyAllFields(ContractsPropertiesGrids);
 }