Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            correct = true;
            Employee_Type EmT = new Employee_Type();

            if (rtxtDescription.Text == "")
            {
                MessageBox.Show("Please Enter Employee type details");
                correct = false;
            }

            if (txtEmployeeType.Text == "")
            {
                MessageBox.Show("Please Enter Employee type details");
                correct = false;
            }
            if (correct == true)
            {
                EmT.Employees_Type_Description = rtxtDescription.Text;
                EmT.Employees_Type1            = txtEmployeeType.Text;


                db.Employee_Type.Add(EmT);

                db.SaveChanges();

                MessageBox.Show("Employee Type Added Successfully");
                this.Close();
            }
        }
Example #2
0
        private void btnDeleteET_Click_1(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Would you like to delete this Employee Type?", "Delete Employee Type", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                try
                {
                    Employee_Type Emt2 = new Employee_Type();
                    Emt2 = db.Employee_Type.Find(tempID);

                    db.Employee_Type.Remove(Emt2);
                    db.SaveChanges();

                    int    Marketing = Emt2.Employee_Type_ID;
                    string Marketing_Template_Value = Convert.ToString(Emt2);
                    MessageBox.Show("Employee Type Successfully Deleted");
                    this.Close();
                }
                catch (Exception)
                {
                    MessageBox.Show("Error: Employee Type was not deleted");
                }
            }
        }