예제 #1
0
        private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            UISpec.ID = uint.Parse(ComSpecID.Text);

            try
            {
                switch (specUC_State)
                {
                case State.createNew:
                    BE.Specialization addSpec = new BE.Specialization();
                    Globals.CopyObject(UISpec, addSpec);
                    BL_Object.addSpecialization(addSpec);
                    Spec_DS_Change_Event?.Invoke();
                    break;

                case State.modify:
                    BL_Object.updateSpecilization(UISpec);
                    Spec_DS_Change_Event?.Invoke();
                    break;
                }

                Spec_DS_Change_Event?.Invoke(); // refreshes combobox as well
                restoreButtonVisib();
            }
            catch (Exception ex) { Globals.exceptionHandler(ex); }
        }
예제 #2
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); }
        }
예제 #3
0
        private void saveNewContract_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var emplyer  = (BE.Employer)ComboEmployerID.SelectedValue;
                var employee = (BE.Employee)ComboEmployeeID.SelectedValue;
                if (emplyer == null || employee == null)
                {
                    throw new Exception("please fill out all fields");
                }

                UIContract.EmployerID = emplyer.ID;
                UIContract.EmployeeID = employee.ID;

                UIContract.contractID = BL_Object.getNextContractID();

                BE.Contract copyContract = new BE.Contract();
                Globals.CopyObject(UIContract, copyContract); // copy bc otherwise added by reference

                BL_Object.addContract(copyContract);          // exception thrown if failed add
                Contract_DS_Change_Event?.Invoke();           // refreshes ContractList in ViewUC
                restoreButtonVisibState();                    // restore buttons if add succeeded
            }
            catch (Exception ex) { Globals.exceptionHandler(ex); }
        }
예제 #4
0
 private void deleteButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         BL_Object.deleteSpecilization(UISpec);
         Spec_DS_Change_Event?.Invoke();
     }
     catch (Exception ex) { Globals.exceptionHandler(ex); }
 }
예제 #5
0
 private void deleteButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         BL_Object.deleteEmployer(UIEmployer);
         Employer_DS_Change_Event?.Invoke();
         restoreButtonVisib();
     }
     catch (Exception ex) { Globals.exceptionHandler(ex); }
 }
예제 #6
0
        void getXMLBankRunner_Completed(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Result?.ToString() == "downloadSuccess")
            {
                DownloadBankXMLCompleted?.Invoke();
                Globals.exceptionHandler(new Exception("download of Banks.xml succeeded"));
            }

            else if (e.Result?.ToString() == "loadSuccess")
            {
                DownloadBankXMLCompleted?.Invoke();
                Globals.exceptionHandler(new Exception("load of Banks.xml succeeded"));
            }

            else
            {
                Globals.exceptionHandler(new Exception("failed to initalize Banks.xml. Closing Program"));
                this.Close();
            }
        }
예제 #7
0
        private void TerminContract_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (BL_Object.terminateContract(UIContract) == false) // contract not found in DB
                {
                    return;
                }

                Contract_DS_Change_Event?.Invoke();

                // refresh UI elements
                int selectedi = comboContractID.SelectedIndex;
                comboContractID.SelectedIndex = -1;
                comboContractID.SelectedIndex = selectedi;

                throw new Exception("Contract terminated successfuly");
            }
            catch (Exception ex) { Globals.exceptionHandler(ex); }
        }
예제 #8
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); }
        }