private void Add_Manager_button_Click_1(object sender, EventArgs e)
        {
            Add_Manager mg = new Add_Manager(emp, 1);

            this.Hide();
            mg.Show();
        }
        private void Add_Emp_button_Click(object sender, EventArgs e)
        {
            Add_Manager am = new Add_Manager(emp, 2);

            // Add_Employee ae = new Add_Employee();
            this.Hide();
            am.Show();
        }
Beispiel #3
0
 private void Edit_Emp_button_Click(object sender, EventArgs e)
 {
     if (aa.employeeId.Equals(x.employeeId))
     {
         MessageBox.Show("Can Not Edit Own Information");
     }
     else
     {
         if (aa.role.Equals("2") && !x.role.Equals("Employee"))
         {
             MessageBox.Show("Unprivileged Access ");
         }
         else
         {
             Add_Manager mg = new Add_Manager(aa, x);
             this.Hide();
             mg.Show();
         }
     }
 }
        private void Add_Mgr_button_Click(object sender, EventArgs e)
        {
            string   id       = EmployeeIdLabel.Text;
            string   name     = textBoxEmployeeName.Text;
            string   pass     = textBoxPassword.Text;
            string   email    = textBoxEmail.Text;
            DateTime dob      = dateTimePickerBirthDate.Value;
            string   religion = textBoxReligion.Text;
            string   phone    = textBoxPhone.Text;
            string   bg       = comboBoxBloodGroup.Text;
            //  float salary = textboxsalary.Text;
            string gender = "";

            if (radioButtonFemale.Checked == true)
            {
                gender = "female";
            }
            else if (radioButtonMale.Checked == true)
            {
                gender = "male";
            }
            else
            {
                gender = "others";
            }

            float salary = float.Parse(textboxsalary.Text);

            string address = richTextBoxAddress.Text;

            int sts = 1;

            if (employeeType.Text.Equals("Manager"))
            {
                sts = 2;
            }
            else if (employeeType.Text.Equals("Schedule Manager"))
            {
                sts = 4;
            }
            else if (employeeType.Text.Equals("Employee"))
            {
                sts = 3;
            }
            else
            {
            }

            if (Add_Mgr_button.Text.Equals("Add Employee"))
            {
                // Console.WriteLine(name + " " + pass);
                if (employeeType.Text.Equals("Manager"))
                {
                    bool q = e1.Createemployee(name, pass, email, dob, religion, address, salary, 2, phone, bg, gender);

                    if (q == true)
                    {
                        MessageBox.Show("Manager Added");
                        Add_Manager am = new Add_Manager(this.e2, this.x);
                        this.Hide();
                        am.Show();
                    }
                    else
                    {
                        MessageBox.Show("Error Occured");
                    }
                }
                else if (employeeType.Text.Equals("Schedule Manager"))
                {
                    bool q = e1.Createemployee(name, pass, email, dob, religion, address, salary, 4, phone, bg, gender);
                    if (q == true)
                    {
                        MessageBox.Show("Schedule Manager Added");
                    }
                    else
                    {
                        MessageBox.Show("Error Occured");
                    }
                }
                else if (employeeType.Text.Equals("Employee"))
                {
                    bool q = e1.Createemployee(name, pass, email, dob, religion, address, salary, 3, phone, bg, gender);
                    if (q == true)
                    {
                        MessageBox.Show("Employee Added");
                    }
                    else
                    {
                        MessageBox.Show("Error Occured");
                    }
                }
                else
                {
                    MessageBox.Show("Please Select Employee Type");
                }
            }
            else if (Add_Mgr_button.Text.Equals("Update"))
            {
                //  MessageBox.Show(id);
                //MessageBox.Show(""+sts);

                bool q = e1.UpdatePerson(id, name, email, address, sts, phone, salary);

                if (q == true)
                {
                    MessageBox.Show("Employee Updated");
                }
                else
                {
                    MessageBox.Show("Error Occured");
                }
            }

            EmployeeIdLabel.Text = textBoxPassword.Text = textBoxEmail.Text = textBoxReligion.Text = textBoxPhone.Text = comboBoxBloodGroup.Text = textboxsalary.Text = string.Empty;
        }