예제 #1
0
        private void Fn_Click(object sender, EventArgs e)
        {
            dataGridView1.DataSource = null;
            dataGridView1.Refresh();
            int i;

            if (textBox1.Text == "" || int.TryParse(textBox1.Text, out i))
            {
                MsgShow a = new MsgShow("Enter a Valid Name !");
                a.ShowDialog();
                return;
            }
            if (cf != null)
            {
                Dt = cobj.Get_Employee_by_fname(textBox1.Text);
            }
            else if (mf != null)
            {
                Dt = cobj.Get_Employee_by_fnamemn(textBox1.Text, id);
            }

            if (Dt == null)
            {
                MsgShow mm = new MsgShow("Not Found!");
                mm.ShowDialog();
                return;
            }
            dataGridView1.DataSource = Dt;
            dataGridView1.Refresh();
            MsgShow m = new MsgShow("Done");

            m.ShowDialog();
        }
예제 #2
0
        private void dfs_Click(object sender, EventArgs e)
        {
            label6.Text = "id";
            int i;

            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || int.TryParse(textBox1.Text, out i) || int.TryParse(textBox2.Text, out i) || int.TryParse(textBox3.Text, out i))
            {
                MsgShow a = new MsgShow("Enter a Valid Name !");
                a.ShowDialog();
                return;
            }
            if (cf != null)
            {
                Dt = cobj.Get_Emp_ID_byname(textBox1.Text, textBox2.Text, textBox3.Text);
            }
            else if (mf != null)
            {
                Dt = cobj.Get_Emp_ID_bynamemn(textBox1.Text, textBox2.Text, textBox3.Text, Convert.ToInt32(id));
            }
            if (Dt == null)
            {
                MsgShow mm = new MsgShow("Not Found!");
                mm.ShowDialog();
                return;
            }
            label6.Text = Convert.ToString(Dt.Rows[0]["Emp_ID"]);
            MsgShow m = new MsgShow("Done");

            m.ShowDialog();
        }
예제 #3
0
        private void dfs_Click(object sender, EventArgs e)
        {
            dataGridView1.DataSource = null;
            dataGridView1.Refresh();
            int i;

            if (!int.TryParse(textBox1.Text, out i))
            {
                MsgShow a = new MsgShow("Enter a Valid Manager ID!");
                a.ShowDialog();
                return;
            }
            Dt = cobj.Get_Employee_by_Manager(i);
            if (Dt == null)
            {
                MsgShow mm = new MsgShow("Not Found!");
                mm.ShowDialog();
                return;
            }
            dataGridView1.DataSource = Dt;
            dataGridView1.Refresh();
            MsgShow m = new MsgShow("Done");

            m.ShowDialog();
        }
예제 #4
0
        private void button7_Click(object sender, EventArgs e)
        {
            int i;

            if (textBox1.Text == "" || !int.TryParse(textBox1.Text, out i))
            {
                MsgShow ms = new MsgShow("Invalid MID");
                ms.ShowDialog();
                return;
            }
            Dt = cobj.Count_Employees_under_Manager(i);
            if (Convert.ToString(Dt.Rows[0]["N_Of_Emp"]) == "")
            {
                MsgShow ms = new MsgShow("Invalid MID");
                ms.ShowDialog();
                return;
            }
            else
            {
                amount = Convert.ToDouble(Dt.Rows[0]["N_Of_Emp"]);
            }
            this.Hide();
            statisticsveiwer f = new statisticsveiwer(null, this, "Emp Count", amount.ToString());

            f.Show();
        }
예제 #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            OpenFileDialog OpenFileDialogobj = new OpenFileDialog();

            OpenFileDialogobj.Filter = "Images | *.jpg; *.png";
            if (OpenFileDialogobj.ShowDialog() == DialogResult.OK)
            {
                PictureBox.Image = Image.FromFile(OpenFileDialogobj.FileName);
            }
            else
            {
                return;
            }
            MemoryStream ms = new MemoryStream();

            byte[] image;
            if (PictureBox.Image == null)
            {
                MsgShow msg = new MsgShow("Wrong Image!");
                msg.ShowDialog();
                return;
            }
            PictureBox.Image.Save(ms, PictureBox.Image.RawFormat);
            image = ms.ToArray();
            cobj.Edit_Emp_Image(id, image);
            MsgShow mm = new MsgShow("Done!");

            mm.ShowDialog();
        }
예제 #6
0
        private void textBox3_TextChanged(object sender, EventArgs e)
        {
            int i;

            if (textBox3.Text != "")
            {
                if (!int.TryParse(textBox3.Text, out i))
                {
                    MsgShow mm = new MsgShow("Invalid Age");
                    mm.ShowDialog();
                    textBox3.Text = "";
                    return;
                }
            }
            if (textBox3.Text != "")
            {
                textBox2.Enabled = false;
                textBox1.Enabled = false;
            }
            else
            {
                textBox2.Enabled = true;
                textBox1.Enabled = true;
            }
        }
예제 #7
0
        private void button13_Click(object sender, EventArgs e)
        {
            int i;

            if (textBox1.Text == "" || int.TryParse(textBox1.Text, out i))
            {
                MsgShow ms = new MsgShow("Invalid Job");
                ms.ShowDialog();
                return;
            }
            Dt = cobj.AVG_Sal_Under_Job(textBox1.Text);
            if (Convert.ToString(Dt.Rows[0]["AVG_Salaries"]) == "")
            {
                MsgShow ms = new MsgShow("Invalid Job");
                ms.ShowDialog();
                return;
            }
            else
            {
                amount = Convert.ToDouble(Dt.Rows[0]["AVG_Salaries"]);
            }
            this.Hide();
            statisticsveiwer f = new statisticsveiwer(null, this, "AVG Salary", amount.ToString());

            f.Show();
        }
예제 #8
0
        private void Showmyemp_Load(object sender, EventArgs e)
        {
            dataGridView1.DataSource = Dt;
            dataGridView1.Refresh();
            MsgShow m = new MsgShow("Done");

            m.ShowDialog();
        }
예제 #9
0
        private void dfs_Click(object sender, EventArgs e)
        {
            dataGridView1.DataSource = null;
            dataGridView1.Refresh();
            int i;

            if (textBox1.Text == "" || !int.TryParse(textBox1.Text, out i))
            {
                MsgShow a = new MsgShow("Enter a Valid Age!");
                a.ShowDialog();
                return;
            }
            if (radioButton1.Checked)
            {
                if (cf != null)
                {
                    Dt = cobj.Get_Employee_equal_age(i);
                }
                else if (mf != null)
                {
                    Dt = cobj.Get_Employee_equal_agemn(i, id);
                }
            }
            else if (radioButton2.Checked)
            {
                if (cf != null)
                {
                    Dt = cobj.Get_Employee_above_age(i);
                }
                else if (mf != null)
                {
                    Dt = cobj.Get_Employee_above_agemn(i, id);
                }
            }
            else if (radioButton3.Checked)
            {
                if (cf != null)
                {
                    Dt = cobj.Get_Employee_below_age(i);
                }
                else if (mf != null)
                {
                    Dt = cobj.Get_Employee_below_agemn(i, id);
                }
            }
            if (Dt == null)
            {
                MsgShow mm = new MsgShow("Not Found!");
                mm.ShowDialog();
                return;
            }
            dataGridView1.DataSource = Dt;
            dataGridView1.Refresh();
            MsgShow m = new MsgShow("Done");

            m.ShowDialog();
        }
예제 #10
0
        private void ShowmyM_J_Load(object sender, EventArgs e)
        {
            label3.Text = label3.Text + Title + "!";
            dataGridView1.DataSource = Dt;
            dataGridView1.Refresh();
            MsgShow m = new MsgShow("Done");

            m.ShowDialog();
        }
예제 #11
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            int i;

            if (textBox1.Text == "" || !int.TryParse(textBox1.Text, out i))
            {
                textBox1.Text = "1";
                MsgShow ms = new MsgShow("Invalid ID!");
                ms.ShowDialog();
                return;
            }
        }
예제 #12
0
        private void button11_Click(object sender, EventArgs e)
        {
            Dt = cobj.Get_Emp_ManagerID(Convert.ToInt32(textBox1.Text));
            if (Dt == null || Convert.ToString(Dt.Rows[0]["Manager_ID"]) == "")
            {
                MsgShow mm = new MsgShow("Not Found");
                mm.ShowDialog();
                return;
            }
            this.Hide();
            getmid f = new getmid(this, Dt);

            f.Show();
        }
예제 #13
0
        private void button12_Click(object sender, EventArgs e)
        {
            Dt = cobj.Get_Manager_Name(Convert.ToInt32(textBox1.Text));
            if (Dt == null)
            {
                MsgShow mm = new MsgShow("Not Found");
                mm.ShowDialog();
                return;
            }
            this.Hide();
            getmname f = new getmname(this, Dt);

            f.Show();
        }
예제 #14
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBox2.Text != "")
     {
         Controller_OBJ.Edit_Emp_Address(id, textBox2.Text);
         MsgShow ms = new MsgShow("Done!");
         ms.ShowDialog();
     }
     else
     {
         MsgShow ms = new MsgShow("Enter Address!");
         ms.ShowDialog();
     }
 }
예제 #15
0
        private void button2_Click(object sender, EventArgs e)
        {
            Dt = cobj.Get_Emp_Salarymn(Convert.ToInt32(textBox1.Text), Convert.ToInt32(id1));
            if (Dt == null)
            {
                MsgShow mm = new MsgShow("Not Found");
                mm.ShowDialog();
                return;
            }
            this.Hide();
            getsalary f = new getsalary(this, null, Dt);

            f.Show();
        }
예제 #16
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBox2.Text != "")
     {
         cobj.Edit_Emp_Needs(id, textBox2.Text);
         MsgShow ms = new MsgShow("Done!");
         ms.ShowDialog();
     }
     else
     {
         MsgShow ms = new MsgShow("Enter Needs!");
         ms.ShowDialog();
     }
 }
예제 #17
0
        private void button4_Click(object sender, EventArgs e)
        {
            Dt = cobj.Get_Emp_Job(Convert.ToInt32(textBox1.Text));
            if (Dt == null)
            {
                MsgShow mm = new MsgShow("Not Found");
                mm.ShowDialog();
                return;
            }
            this.Hide();
            getjob f = new getjob(null, this, Dt);

            f.Show();
        }
예제 #18
0
 private void button7_Click(object sender, EventArgs e)
 {
     Dt = cobj.Get_Employee_by_ID(Convert.ToInt32(textBox1.Text));
     if (Dt != null)
     {
         this.Hide();
         Getempinfo_empmode f = new Getempinfo_empmode(null, this, null, Dt);
         f.Show();
     }
     else
     {
         MsgShow ms = new MsgShow("Invalid ID!");
         ms.ShowDialog();
     }
 }
예제 #19
0
 private void button4_Click(object sender, EventArgs e)
 {
     Dt = cobj.Get_Employee_by_Manager(Convert.ToInt32(id));
     if (Dt != null)
     {
         this.Hide();
         Showmyemp f = new Showmyemp(this, null, Dt);
         f.Show();
     }
     else
     {
         MsgShow mm = new MsgShow("No Emp For You!");
         mm.ShowDialog();
     }
 }
예제 #20
0
        private void salt_TextChanged(object sender, EventArgs e)
        {
            int i;

            if (salt.Text != "")
            {
                if (!int.TryParse(salt.Text, out i))
                {
                    MsgShow mm = new MsgShow("Invalid Salary");
                    mm.ShowDialog();
                    salt.Text = "";
                    return;
                }
            }
        }
예제 #21
0
 private void button4_Click(object sender, EventArgs e)
 {
     Dt = cobj.Get_All_Emp();
     if (Dt != null)
     {
         this.Hide();
         Showmyemp f = new Showmyemp(null, this, Dt);
         f.Show();
     }
     else
     {
         MsgShow mm = new MsgShow("No Emp For You!");
         mm.ShowDialog();
     }
 }
예제 #22
0
 private void button9_Click(object sender, EventArgs e)
 {
     Dt = cobj.Get_All_Jobs();
     if (Dt != null)
     {
         this.Hide();
         ShowmyM_J f = new ShowmyM_J(this, "Jobs :", Dt);
         f.Show();
     }
     else
     {
         MsgShow mm = new MsgShow("No Jobs For You!");
         mm.ShowDialog();
     }
 }
예제 #23
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            int i;

            if (textBox1.Text != "")
            {
                if (!int.TryParse(textBox1.Text, out i))
                {
                    MsgShow mm = new MsgShow("Invalid ID");
                    mm.ShowDialog();
                    textBox1.Text = "";
                    return;
                }
            }
        }
예제 #24
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "1")
            {
                MsgShow mm = new MsgShow("It is Private!");
                mm.ShowDialog();
                return;
            }
            Dt = cobj.Get_Emp_Agemn(Convert.ToInt32(textBox1.Text), Convert.ToInt32(id1));
            if (Dt == null)
            {
                MsgShow mm = new MsgShow("Not Found");
                mm.ShowDialog();
                return;
            }
            this.Hide();
            getage f = new getage(this, null, Dt);

            f.Show();
        }
예제 #25
0
 private void button7_Click(object sender, EventArgs e)
 {
     if (textBox1.Text == "1")
     {
         MsgShow mm = new MsgShow("It is Private!");
         mm.ShowDialog();
         return;
     }
     Dt = cobj.Get_Employee_by_IDmn(Convert.ToInt32(textBox1.Text), Convert.ToInt32(id1));
     if (Dt != null)
     {
         this.Hide();
         Getempinfo_empmode f = new Getempinfo_empmode(this, null, null, Dt);
         f.Show();
     }
     else
     {
         MsgShow ms = new MsgShow("Invalid ID!");
         ms.ShowDialog();
     }
 }
예제 #26
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBox2.Text != "" && textBox3.Text != "")
     {
         if (textBox2.Text == textBox3.Text)
         {
             cobj.Edit_Emp_Pass(id, textBox2.Text);
             MsgShow ms = new MsgShow("Done!");
             ms.ShowDialog();
         }
         else
         {
             MsgShow ms = new MsgShow("Not Identical!");
             ms.ShowDialog();
         }
     }
     else
     {
         MsgShow ms = new MsgShow("Enter Password!");
         ms.ShowDialog();
     }
 }
예제 #27
0
 private void Pas_Click(object sender, EventArgs e)
 {
     if (salt.Text == "")
     {
         MsgShow mm = new MsgShow("Invalid Salary");
         mm.ShowDialog();
         return;
     }
     if (textBox1.Text != "")
     {
         cobj.Edit_Emp_Sal(Convert.ToInt32(textBox1.Text), Convert.ToInt32(salt.Text));
         MsgShow mm = new MsgShow("Done");
         mm.ShowDialog();
         return;
     }
     else if (textBox2.Text != "")
     {
         cobj.Set_Salary_for_Job(textBox2.Text, Convert.ToInt32(salt.Text));
         MsgShow mm = new MsgShow("Done");
         mm.ShowDialog();
         return;
     }
     else if (textBox3.Text != "")
     {
         cobj.Set_Salary_for_Age(Convert.ToInt32(textBox3.Text), Convert.ToInt32(salt.Text));
         MsgShow mm = new MsgShow("Done");
         mm.ShowDialog();
         return;
     }
     else
     {
         MsgShow mm = new MsgShow("Invalid Method");
         mm.ShowDialog();
         return;
     }
 }
예제 #28
0
        private void button2_Click(object sender, EventArgs e)
        {
            int i;

            if (textBox1.Text == "" || !int.TryParse(textBox1.Text, out i))
            {
                MsgShow mm = new MsgShow("Invalid ID!");
                mm.ShowDialog();
                return;
            }
            Dt = cobj.Get_Emp_Job(i);
            if (Dt == null || Convert.ToString(Dt.Rows[0]["Job_Title"]) == "")
            {
                MsgShow mm = new MsgShow("Invalid ID!");
                mm.ShowDialog();
                return;
            }
            if (Convert.ToString(Dt.Rows[0]["Job_Title"]) == "General Manager")
            {
                MsgShow mm = new MsgShow("Cannot Fire The Chairman!");
                mm.ShowDialog();
                return;
            }
            else
            {
                DataTable temp = cobj.Count_Employees_under_Job(Convert.ToString(Dt.Rows[0]["Job_Title"]));
                if (Convert.ToInt32(temp.Rows[0]["N_Of_Emp"]) <= 1)
                {
                    MsgShow mm = new MsgShow("Cannot Fire The only " + Convert.ToString(Dt.Rows[0]["Job_Title"]) + "!");
                    mm.ShowDialog();
                    return;
                }
                else
                {
                    if (Convert.ToString(Dt.Rows[0]["Job_Title"]).Contains("Super Visor"))
                    {
                        DataTable temp1;
                        temp1 = cobj.Get_Employee_by_Manager(i);
                        DataTable temp2;
                        temp2 = cobj.Count_Employees_under_Manager(i);
                        int count = Convert.ToInt32(temp2.Rows[0]["N_Of_Emp"]);
                        temp2 = cobj.Get_Employee_by_Job(Convert.ToString(Dt.Rows[0]["Job_Title"]));
                        int newid = Convert.ToInt32(temp2.Rows[0]["Emp_ID"]);
                        if (i == newid)
                        {
                            newid = Convert.ToInt32(temp2.Rows[1]["Emp_ID"]);
                        }
                        for (int z = 0; z < count; z++)
                        {
                            cobj.Edit_Emp_Manager(Convert.ToInt32(temp1.Rows[z]["Emp_ID"]), newid);
                        }
                    }
                    else
                    {
                        DataTable iii   = cobj.Get_Emp_ManagerID(Convert.ToInt32(textBox1.Text));
                        int       t_mid = Convert.ToInt32(iii.Rows[0]["Manager_ID"]);
                        iii = cobj.Count_Employees_under_Manager(t_mid);
                        int c = Convert.ToInt32(iii.Rows[0]["N_Of_Emp"]);
                        if (c <= 1)
                        {
                            MsgShow ddd = new MsgShow("Cannot Delete the Only Emp For A Manager!");
                            ddd.ShowDialog();
                            return;
                        }
                    }
                    cobj.Fire_Emp(i);
                    MsgShow mm = new MsgShow("Done!");
                    mm.ShowDialog();
                    return;
                }
            }
        }
예제 #29
0
        private void Add_Button_Click(object sender, EventArgs e)
        {
            MemoryStream ms = new MemoryStream();

            byte[] image;
            if (PictureBox.Image == null)
            {
                MsgShow msg = new MsgShow("Wrong Image!");
                msg.ShowDialog();
                return;
            }
            PictureBox.Image.Save(ms, PictureBox.Image.RawFormat);
            image = ms.ToArray();
            if (radioButton2.Checked && textBox11.Text == "")
            {
                MsgShow msg = new MsgShow("Wrong Emp for Manager ID!");
                msg.ShowDialog();
                return;
            }
            int    i;
            string fn;

            if (Empfn.Text == "" || int.TryParse(Empfn.Text, out i))
            {
                MsgShow msg = new MsgShow("Wrong Fname!");
                msg.ShowDialog();
                return;
            }
            else
            {
                fn = Empfn.Text;
            }

            string mn;

            if (EmpMn.Text == "" || int.TryParse(EmpMn.Text, out i))
            {
                MsgShow msg = new MsgShow("Wrong Mname!");
                msg.ShowDialog();
                return;
            }
            else
            {
                mn = EmpMn.Text;
            }
            string ln;

            if (Empln.Text == "" || int.TryParse(Empln.Text, out i))
            {
                MsgShow msg = new MsgShow("Wrong Lname!");
                msg.ShowDialog();
                return;
            }
            else
            {
                ln = Empln.Text;
            }
            int s;

            if (Salary.Text == "" || !int.TryParse(Salary.Text, out s))
            {
                MsgShow msg = new MsgShow("Wrong Salary!");
                msg.ShowDialog();
                return;
            }
            int eid;

            if (Emp_ID.Text == "" || !int.TryParse(Emp_ID.Text, out eid))
            {
                MsgShow msg = new MsgShow("Wrong EID!");
                msg.ShowDialog();
                return;
            }
            string Pas;

            if (Pass.Text == "")
            {
                MsgShow msg = new MsgShow("Wrong Password!");
                msg.ShowDialog();
                return;
            }
            else
            {
                Pas = Pass.Text;
            }
            int age;

            if (Age.Text == "" || !int.TryParse(Age.Text, out age))
            {
                MsgShow msg = new MsgShow("Wrong Age!");
                msg.ShowDialog();
                return;
            }
            string ad;

            if (Addres.Text == "")
            {
                MsgShow msg = new MsgShow("Wrong Address!");
                msg.ShowDialog();
                return;
            }
            else
            {
                ad = Addres.Text;
            }
            string j;

            if (radioButton1.Checked)
            {
                j = " Employee";
            }
            else if (radioButton2.Checked)
            {
                j = " Super Visor";
            }
            else
            {
                MsgShow msg = new MsgShow("Wrong Choice!");
                msg.ShowDialog();
                return;
            }
            string j_t;

            if (radioButton2.Checked)
            {
                DataTable temp = Controller_OBJ.Get_Emp_Job(Convert.ToInt32(textBox11.Text));
                if (temp == null || Convert.ToString(temp.Rows[0]["Job_Title"]) == "")
                {
                    MsgShow msg = new MsgShow("Invalid Emp Manager ID!");
                    msg.ShowDialog();
                    return;
                }
                j_t = Convert.ToString(temp.Rows[0]["Job_Title"]);
                if (!j_t.Contains(comboBox1.Text))
                {
                    MsgShow msg = new MsgShow("Emp Manager ID doesnot Match!");
                    msg.ShowDialog();
                    return;
                }
                if (j_t.Contains("Super Visor"))
                {
                    MsgShow msg = new MsgShow("Emp Manager ID Is for a Manager!");
                    msg.ShowDialog();
                    return;
                }
            }
            if (comboBox1.Text == "Book Dep.")
            {
                DataTable iii = Controller_OBJ.Count_Employees_under_Job("Book Dep. Employee");
                double    k   = Convert.ToDouble(iii.Rows[0]["N_Of_Emp"]);
                if (radioButton2.Checked && k <= 1)
                {
                    MsgShow msg = new MsgShow("Cannot add a new Manager to this dep (1 Emp)!");
                    msg.ShowDialog();
                    return;
                }
                j = "Book Dep." + j;
            }
            else if (comboBox1.Text == "Story Dep.")
            {
                DataTable iii = Controller_OBJ.Count_Employees_under_Job("Story Dep. Employee");
                double    k   = Convert.ToDouble(iii.Rows[0]["N_Of_Emp"]);
                if (radioButton2.Checked && k <= 1)
                {
                    MsgShow msg = new MsgShow("Cannot add a new Manager to this dep (1 Emp)!");
                    msg.ShowDialog();
                    return;
                }
                j = "Story Dep." + j;
            }
            else if (comboBox1.Text == "Music Dep.")
            {
                DataTable iii = Controller_OBJ.Count_Employees_under_Job("Music Dep. Employee");
                double    k   = Convert.ToDouble(iii.Rows[0]["N_Of_Emp"]);
                if (radioButton2.Checked && k <= 1)
                {
                    MsgShow msg = new MsgShow("Cannot add a new Manager to this dep (1 Emp)!");
                    msg.ShowDialog();
                    return;
                }
                j = "Music Dep." + j;
            }
            else if (comboBox1.Text == "Computer Dep.")
            {
                DataTable iii = Controller_OBJ.Count_Employees_under_Job("Computer Dep. Employee");
                double    k   = Convert.ToDouble(iii.Rows[0]["N_Of_Emp"]);
                if (radioButton2.Checked && k <= 1)
                {
                    MsgShow msg = new MsgShow("Cannot add a new Manager to this dep (1 Emp)!");
                    msg.ShowDialog();
                    return;
                }
                j = "Computer Dep." + j;
            }
            else
            {
                MsgShow msg = new MsgShow("Combobox Error!");
                msg.ShowDialog();
                return;
            }
            int mid;

            if (MID.Text == "" || !int.TryParse(MID.Text, out mid))
            {
                MsgShow msg = new MsgShow("Wrong MID!");
                msg.ShowDialog();
                return;
            }


            int Success = Controller_OBJ.Add_Employee(fn, mn, ln, s, eid, Pas, age
                                                      , j, "No Needs", ad, mid, image);

            if (radioButton2.Checked)
            {
                Controller_OBJ.Edit_Emp_Manager(Convert.ToInt32(textBox11.Text), eid);
            }
            if (Success == 0)
            {
                MessageBox.Show("Failed To Add A new Employee .Make sure You enter The Right ID and MID");
                Return_Click(sender, e);
            }
            else
            {
                MessageBox.Show("A New Employee has been added Successfully", "Informaion", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #30
0
        private void Pas_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MsgShow mm = new MsgShow("No ID!");
                mm.ShowDialog();
                return;
            }
            if (textBox3.Text == "")
            {
                MsgShow msg = new MsgShow("Wrong Emp for Manager ID!");
                msg.ShowDialog();
                return;
            }
            if (textBox1.Text == textBox3.Text)
            {
                MsgShow msg = new MsgShow("Error 1 = 2!");
                msg.ShowDialog();
                return;
            }
            if (checkBox1.Checked && textBox2.Text == "")
            {
                MsgShow mm = new MsgShow("No new Salary!");
                mm.ShowDialog();
                return;
            }
            Dt = cobj.Get_Emp_Job(Convert.ToInt32(textBox1.Text));
            string    j_t;
            DataTable temp = cobj.Get_Emp_Job(Convert.ToInt32(textBox3.Text));

            if (temp == null || Convert.ToString(temp.Rows[0]["Job_Title"]) == "")
            {
                MsgShow msg = new MsgShow("Invalid Emp Manager ID!");
                msg.ShowDialog();
                return;
            }
            j_t = Convert.ToString(temp.Rows[0]["Job_Title"]);
            string jjj = Dt.Rows[0]["Job_Title"].ToString();

            jjj.Remove(4, 10);
            if (!j_t.Contains(jjj))
            {
                MsgShow msg = new MsgShow("Emp Manager ID doesnot Match!");
                msg.ShowDialog();
                return;
            }
            if (j_t.Contains("Super Visor"))
            {
                MsgShow msg = new MsgShow("Emp Manager ID Is for a Manager!");
                msg.ShowDialog();
                return;
            }
            DataTable Da = cobj.Count_Employees_under_Job(j_t);
            double    k  = Convert.ToDouble(Da.Rows[0]["N_Of_Emp"]);;

            if (k <= 1)
            {
                MsgShow msg = new MsgShow("Cannot add a new Manager to this dep (1 Emp)!");
                msg.ShowDialog();
                return;
            }

            if (Dt == null || Convert.ToString(Dt.Rows[0]["Job_Title"]) == "")
            {
                MsgShow mm = new MsgShow("Invalid ID!");
                mm.ShowDialog();
                return;
            }
            if (Convert.ToString(Dt.Rows[0]["Job_Title"]) == "General Manager")
            {
                MsgShow mm = new MsgShow("Cannot Promote The Chairman!");
                mm.ShowDialog();
                return;
            }
            if (Convert.ToString(Dt.Rows[0]["Job_Title"]).Contains("Super Visor"))
            {
                MsgShow mm = new MsgShow("Cannot Promote A Manager!");
                mm.ShowDialog();
                return;
            }
            if (Convert.ToString(Dt.Rows[0]["Job_Title"]).Contains("Book"))
            {
                cobj.Edit_Emp_Job(Convert.ToInt32(textBox1.Text), "Book Dep. Super Visor");
                if (checkBox1.Checked)
                {
                    cobj.Edit_Emp_Sal(Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text));
                }
                MsgShow mm = new MsgShow("Done!");
                mm.ShowDialog();
            }
            else if (Convert.ToString(Dt.Rows[0]["Job_Title"]).Contains("Music"))
            {
                cobj.Edit_Emp_Job(Convert.ToInt32(textBox1.Text), "Music Dep. Super Visor");
                if (checkBox1.Checked)
                {
                    cobj.Edit_Emp_Sal(Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text));
                }
                MsgShow mm = new MsgShow("Done!");
                mm.ShowDialog();
            }
            else if (Convert.ToString(Dt.Rows[0]["Job_Title"]).Contains("Computer"))
            {
                cobj.Edit_Emp_Job(Convert.ToInt32(textBox1.Text), "Computer Dep. Super Visor");
                if (checkBox1.Checked)
                {
                    cobj.Edit_Emp_Sal(Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text));
                }
                MsgShow mm = new MsgShow("Done!");
                mm.ShowDialog();
            }
            else if (Convert.ToString(Dt.Rows[0]["Job_Title"]).Contains("Story"))
            {
                cobj.Edit_Emp_Job(Convert.ToInt32(textBox1.Text), "Story Dep. Super Visor");
                if (checkBox1.Checked)
                {
                    cobj.Edit_Emp_Sal(Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text));
                }
                MsgShow mm = new MsgShow("Done!");
                mm.ShowDialog();
            }
            Dt = cobj.Get_Employee_by_ID_forlog(Convert.ToInt32(textBox1.Text));
            string Oldpass = Dt.Rows[0]["Password"].ToString();
            string newpass = Oldpass;

            newpass.Remove(0, 1);
            newpass.Replace("EMP", "SPR");
            cobj.Edit_Emp_Pass(Convert.ToInt32(textBox1.Text), newpass);
            cobj.Edit_Emp_Manager(Convert.ToInt32(textBox1.Text), 1);
            cobj.Edit_Emp_Manager(Convert.ToInt32(textBox3.Text), Convert.ToInt32(textBox1.Text));
        }