Exemplo n.º 1
0
        private void RemoveEmployeeButton_Click(object sender, EventArgs e)
        {
            // function ->> To remove employee form list & file


            BankSystem            bank    = new BankSystem();
            ManagerOperationsForm manager = new ManagerOperationsForm();


            //Delete Employee With this ID
            bank.BankManager.DeleteEmployee(EmployeeIDTextBox.Text);

            // Save Action to LogFile
            DateTime     time = DateTime.Now;
            FileStream   fs   = new FileStream("BankLogFile.txt", FileMode.Append);
            StreamWriter Sr   = new StreamWriter(fs);

            Sr.WriteLine(time + " Employee With ID " + EmployeeIDTextBox.Text + " has been Removed ");
            Sr.Close();
            fs.Close();


            //Return to (  ManagerOperationsForm ) && hide this form (AddEmployeeForm)
            this.Hide();
            manager.ShowDialog();
        }
Exemplo n.º 2
0
        private void ManagerLoginButton_Click(object sender, EventArgs e)
        {
            // It's Function ->> Login of Manager to the system



            BankSystem bank = new BankSystem();

            // Check if he enterd the data or not
            if (ManagerIDTextBox.Text == "" && ManagerPasswordTextBox.Text == "")
            {
                MessageBox.Show("Please Enter Your Information !!!! ");
            }
            else if (ManagerIDTextBox.Text == "")
            {
                MessageBox.Show("Please Enter Your ID !!!! ");
            }
            else if (ManagerPasswordTextBox.Text == "")
            {
                MessageBox.Show("Please Enter Your PassWord !!!! ");
            }


            else
            {
                // Check login
                if (bank.BankManager.Login(ManagerIDTextBox.Text, ManagerPasswordTextBox.Text))
                {
                    //Save at Logfile
                    DateTime     time = DateTime.Now;
                    FileStream   fs   = new FileStream("BankLogFile.txt", FileMode.Append);
                    StreamWriter Sr   = new StreamWriter(fs);
                    Sr.WriteLine(time + " Manager Of Bank has logged in");
                    Sr.Close();
                    fs.Close();


                    //Open the manager profile Or Account in the system && Hide this form (Manager Login Form )
                    ManagerOperationsForm managerOperations = new ManagerOperationsForm();

                    this.Hide();
                    managerOperations.ShowDialog();
                }
                else
                {
                    // if id & password != id & password of the Bank Manager
                    MessageBox.Show(" The Information that you've entered is incorrect");
                }
            }
        }
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            // Function ->> Update Employee Information ( Only which can be logically updated )

            try
            {
                // Copy the information after update to the new object (accountent)
                string     ID         = IDloginEmployee.employee.ID;
                Accountant accountant = IDloginEmployee.employee;
                accountant.FirstName         = FirstNameTextBox.Text;
                accountant.LastName          = LastNameTextBox.Text;
                accountant.Address           = AddressTextBox.Text;
                accountant.CollegeOfGraduate = CollegeOfGraduationTextBox.Text;
                accountant.Mail        = MailTextBox.Text;
                accountant.Grade       = GradeTextBox.Text;
                accountant.Position    = PositionTextBox.Text;
                accountant.ID          = IDTextBox.Text;
                accountant.SSN         = SSNTextBox.Text;
                accountant.PhoneNumber = PhoneNumberTextBox.Text;
                BankSystem bank = new BankSystem();

                // Check if he want to update
                DialogResult result = MessageBox.Show("Are you want to Updata?", "Caution", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                if (result == DialogResult.OK)
                {
                    // update the employee By updatefunc in ( Manager)
                    bank.BankManager.Update(IDloginEmployee.employee.ID, accountant);


                    ManagerOperationsForm manager = new ManagerOperationsForm();

                    // Save action to the Logfile
                    DateTime     time = DateTime.Now;
                    FileStream   fs   = new FileStream("BankLogFile.txt", FileMode.Append);
                    StreamWriter Sr   = new StreamWriter(fs);
                    Sr.WriteLine(time + " Employee With ID " + IDloginEmployee.employee.ID + " has been Updated ");
                    Sr.Close();
                    fs.Close();

                    //Return to (ManagerOperationsForm ) && Hide this Form (EmployeeUpdateForm )
                    this.Hide();
                    manager.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 4
0
        private void EmployeeRegisterationButton_Click(object sender, EventArgs e)
        {
            BankSystem bank       = new BankSystem();
            Accountant accountant = new Accountant();

            // Check if filling All information or not
            if (EmployeeFirstNameTextBox.Text == "" || EmployeeLastNameTextBox.Text == "" || EmployeeAddressTextBox.Text == "" || CollegeOfGraduationTextBox.Text == "" || YearOfGraduationComboBox.SelectedItem.ToString() == "" || EmployeeBirthDateComboBox.SelectedItem.ToString() == "" || EmployeeMailTextBox.Text == "" || EmployeeGradeComboBox.SelectedItem.ToString() == "" || EmployeePasswordTextBox.Text == "" || EmployeePositionTextBox.Text == "" || (MaleRadioButton.Checked != true && FemaleRadioButton.Checked != true))
            {
                MessageBox.Show("Please complete filling your information.");
            }


            else
            {
                try
                {
                    // Fill accountent object with the information from textbox
                    accountant.FirstName = EmployeeFirstNameTextBox.Text;
                    accountant.LastName  = EmployeeLastNameTextBox.Text;
                    accountant.Address   = EmployeeAddressTextBox.Text;
                    accountant.BirthDate = EmployeeBirthDateComboBox.SelectedItem.ToString();
                    accountant.Mail      = EmployeeMailTextBox.Text;
                    accountant.Grade     = EmployeeGradeComboBox.SelectedItem.ToString();
                    accountant.Password  = EmployeePasswordTextBox.Text;
                    accountant.Position  = EmployeePositionTextBox.Text;
                    long ssn   = Int64.Parse(EmployeeSSNTextBox.Text);
                    long phone = Int64.Parse(EmployeePhoneNumberTextBox.Text);
                    accountant.PhoneNumber       = EmployeePhoneNumberTextBox.Text;
                    accountant.SSN               = EmployeeSSNTextBox.Text;
                    accountant.YearOfGraduation  = YearOfGraduationComboBox.SelectedItem.ToString();
                    accountant.CollegeOfGraduate = CollegeOfGraduationTextBox.Text;
                    accountant.ID = (bank.BankManager.IDOfEmployee).ToString();

                    if (MaleRadioButton.Checked)
                    {
                        accountant.Gender = MaleRadioButton.Text.ToString();
                    }
                    if (FemaleRadioButton.Checked)
                    {
                        accountant.Gender = FemaleRadioButton.Text.ToString();
                    }
                    // add the accountent object to the list of accounants & then save at file
                    bank.BankManager.AddEmployee(accountant);

                    MessageBox.Show("Employee ID is " + accountant.ID);



                    // Save action at LogFile
                    DateTime     time = DateTime.Now;
                    FileStream   fs   = new FileStream("BankLogFile.txt", FileMode.Append);
                    StreamWriter Sr   = new StreamWriter(fs);
                    Sr.WriteLine(time + " Employee With ID " + accountant.ID + " has been Added ");
                    Sr.Close();
                    fs.Close();


                    //Return to (  ManagerOperationsForm ) && hide this form (AddEmployeeForm)
                    this.Hide();
                    ManagerOperationsForm manger = new ManagerOperationsForm();
                    manger.ShowDialog();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }