コード例 #1
0
        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); }
        }
コード例 #2
0
        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;
        }
コード例 #3
0
 public allEmployer(BL.IBL Bl)
 {
     this.bl = Bl;
     InitializeComponent();
     employer         = new BE.Employer();
     this.DataContext = employer;
     bl = BL.FactoryBL.GetBL();
     showDataGridView();
 }
コード例 #4
0
        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));
        }
コード例 #5
0
 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;
 }
コード例 #6
0
 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));
 }
コード例 #7
0
        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);
            }
        }
コード例 #8
0
 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);
     }
 }
コード例 #9
0
 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);
     }
 }
コード例 #10
0
        // 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);
            }
        }
コード例 #11
0
        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);
            }
        }