コード例 #1
0
        private void button_Add(object sender, RoutedEventArgs e)
        {
            int branch;
            int bank_n;

            try
            {
                BANK.BranhCity    = cityComboBox.SelectedItem.ToString();
                BANK.BankName     = bankNameComboBox.SelectedItem.ToString();
                BANK.BranchAdress = adressBankComboBox.SelectedItem.ToString();
                int.TryParse(branchBankComboBox.SelectedItem.ToString(), out branch);
                int.TryParse(banknum.Text, out bank_n);
                BANK.BranchNumber    = branch;
                BANK.BankNumber      = bank_n;
                employee.BankDetails = BANK;
                bl.addEmployee(employee);
                employee     = new BE.Employee();
                banknum.Text = null;
                branchBankComboBox.SelectedItem = null;
                adressBankComboBox.SelectedItem = null;
                bankNameComboBox.SelectedItem   = null;
                cityComboBox.SelectedItem       = null;
                this.DataContext = employee;
                showDataGridView();
            }
            catch (Exception ex)
            {
                showDataGridView();
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
 public AddEmployee()
 {
     InitializeComponent();
     em = new BE.Employee();
     this.EmployeeDetailsGrid.DataContext = em;
     bl = BL.factoryBL.getBL();
 }
コード例 #3
0
 public allEmployee(BL.IBL Bl)
 {
     this.bl = Bl;
     InitializeComponent();
     employee         = new BE.Employee();
     this.DataContext = employee;
     bl = BL.FactoryBL.GetBL();
     showDataGridView();
 }
コード例 #4
0
        private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int ID;

            int.TryParse(comboBox.SelectedItem.ToString(), out ID);
            employee         = bl.return_emploee(ID);
            this.DataContext = employee;
            showDataGridView();
        }
コード例 #5
0
 public UpdateEmployee(BL.IBL Bl)
 {
     this.bl = Bl;
     InitializeComponent();
     employee         = new BE.Employee();
     this.DataContext = employee;
     this.degreeComboBox.ItemsSource = Enum.GetValues(typeof(BE.Degree));
     bl = BL.FactoryBL.GetBL();
     showDataGridView();
 }
コード例 #6
0
        public update_Employee(BL.IBL Bl)
        {
            this.bl = Bl;
            InitializeComponent();
            employee         = new BE.Employee();
            this.DataContext = employee;

            bl = BL.FactoryBL.GetBL();
            //  showDataGridView();
            foreach (int id in bl.return_names_id_employee())
            {
                comboBox.Items.Add(id);
            }
        }
コード例 #7
0
 public AddEmployee(BL.IBL Bl)
 {
     this.bl = Bl;
     InitializeComponent();
     BANK             = new BE.BankAccount();
     employee         = new BE.Employee();
     this.DataContext = employee;
     bl = BL.FactoryBL.GetBL();
     showDataGridView();
     this.degreeComboBox.ItemsSource = Enum.GetValues(typeof(BE.Degree));
     foreach (string id in bl.returnCity())
     {
         cityComboBox.Items.Add(id);
     }
 }
コード例 #8
0
 private void button_Update(object sender, RoutedEventArgs e)
 {
     try
     {
         bl.updatingEmployee(employee);
         employee         = new BE.Employee();
         this.DataContext = employee;
         showDataGridView();
     }
     catch (Exception ex)
     {
         showDataGridView();
         MessageBox.Show(ex.Message);
     }
 }
コード例 #9
0
        private void ComEmplyeeID_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            BE.Employee foundEmploye = Bl_Object.getEmployeeList().FirstOrDefault(x => x == (BE.Employee)ComEmplyeeID.SelectedItem);

            // if selected ID not found in DB, reset all fields in UIEmployee, thus resetting all controls in UI
            if (Equals(foundEmploye, null))
            {
                Globals.CopyObject(new BE.Employee(), UIEmployee);
            }

            else // selection exists in DB
            {
                Globals.CopyObject(foundEmploye, UIEmployee);
                ComEmplyeeBranchNum.SelectedItem = Bl_Object.getBankList().Find(b => b.BankName == UIEmployee.bank.BankName && b.Branch == UIEmployee.bank.Branch);
            }
        }
コード例 #10
0
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            int ID;

            int.TryParse(comboBox.SelectedItem.ToString(), out ID);
            try
            {
                employee.ID = ID;
                bl.uptdateEmployee(employee);
                employee         = new BE.Employee();
                this.DataContext = employee;
                showDataGridView();
            }
            catch (Exception ex)
            {
                showDataGridView();
                MessageBox.Show(ex.Message);
            }
        }
コード例 #11
0
 private void addButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         em.Id       = (this.idTextBox.Text);
         em.lastName = this.nameTextBox.Text;
         bl.addEmployee(em);
         em = new BE.Employee();
         this.idTextBox.ClearValue(TextBox.TextProperty);
     }
     catch (FormatException)
     {
         MessageBox.Show("check your input and try again");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #12
0
        private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                switch (EmployeeUC_State)
                {
                case State.createNew:
                    BE.Employee addEmploye = new BE.Employee();
                    Globals.CopyObject(UIEmployee, addEmploye);
                    Bl_Object.addEmployee(addEmploye);
                    Employee_DS_Change_Event?.Invoke();
                    break;

                case State.modify:
                    Bl_Object.updateEmployee(UIEmployee);
                    Employee_DS_Change_Event?.Invoke();
                    break;
                }

                restoreRegButtonVisib();
                EmployeeUC_State = State.view;
            }
            catch (Exception ex) { Globals.exceptionHandler(ex); }
        }