public void TestAddandRemoveEmployee()
        {
            var emoloyee = employeeRepo.GetEmployeeDetail("test1");

            Assert.Equal("e1", emoloyee.FirstName);
            employeeRepo.DeleteEmployee("test1");
        }
Esempio n. 2
0
        private void DeleteBtn_Click(object sender, EventArgs e)
        {
            Login    l   = new Login();
            Employee emp = new Employee();

            emp.Id = this.IdTb.Text;

            if ((emp.Designation.ToLower()).Equals("manager"))
            {
                MessageBox.Show("Sorry!!Can Not Delete");
            }
            else
            {
                if (lr.DeleteUser(l))
                {
                    if (er.DeleteEmployee(emp))
                    {
                        MessageBox.Show("Deleted");
                        this.RefreshBtn_Click(sender, e);
                        this.ShowAllBtn_Click(sender, e);
                    }
                }
                else
                {
                    MessageBox.Show("Can Not Delete");
                }
            }
            InsertBtn.Enabled = true;
            DeleteBtn.Enabled = true;
            UpdateBtn.Enabled = true;
        }
Esempio n. 3
0
        private void DeleteBtn_Click(object sender, EventArgs e)
        {
            if (l.Id == EmpIdTB.Text)
            {
                MessageBox.Show("Invalid operations");
            }
            else
            {
                Login user = new Login();
                user.Id = this.EmpIdTB.Text;

                Employee emp = new Employee();
                emp.EmpId = this.EmpIdTB.Text;

                if (lr.DeleteUser(user))
                {
                    if (er.DeleteEmployee(emp))
                    {
                        MessageBox.Show("Employee Removed");
                        this.RefreshBtn_Click(sender, e);
                        this.ViewAllBtn_Click(sender, e);
                    }
                }
                else
                {
                    MessageBox.Show("Can Not Remove");
                }
            }
        }
        public IActionResult DeleteEmployee(int deleteEmployeeInfo)
        {
            SaleRepo sr = new SaleRepo();

            sr.DeleteAllSales(deleteEmployeeInfo);
            EmployeeRepo er = new EmployeeRepo();

            er.DeleteEmployee(deleteEmployeeInfo);

            return(RedirectToAction("Index"));
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            PersonRepo p1 = new PersonRepo();

            p1.PersonID = Convert.ToInt32(this.txtPID.Text);

            DoctorRepo dr = new DoctorRepo();

            if (this.txtDoctorId.Text != "" && this.txtDoctorId.Text != null)
            {
                dr.DoctorID = Convert.ToInt32(this.txtDoctorId.Text);
            }

            EmployeeRepo er = new EmployeeRepo();

            er.EmpID = Convert.ToInt32(this.txtEmpId.Text);

            try
            {
                if (this.cmbDesignation.Text == "Doctor")
                {
                    // IF DOCTOR -> Delete from all table that contains doctor's reference first
                    CancelledAppointmentsRepo.RemoveParticularDoctorsAppointments(dr.DoctorID);
                    AppointmentRepo.RemoveParticularDoctorsAppointments(dr.DoctorID);
                    PatientDiseaseRepo.DeleteInfoBasedOnDoctor(dr.DoctorID);
                    LoginVerification.DeleteLoginInfo(er.EmpID);
                    // Afterwards delete from doctor table
                    dr.DeleteDoctor(dr.DoctorID);
                }

                int empdelete     = er.DeleteEmployee(er.EmpID);
                int persondeleted = p1.DeletePerson(p1.PersonID);

                this.PopulatePersonTable();
                MessageBox.Show("Successfully deleted!");
                this.ClearAll();
            }
            catch (Exception exc)
            {
                MessageBox.Show("error!" + exc);
            }
        }
Esempio n. 6
0
        private void Delete_Click_Method(object sender, EventArgs e)
        {
            Login    l   = new Login();
            Employee emp = new Employee();

            l.Id      = this.EmpIdTB.Text;
            emp.EmpId = this.EmpIdTB.Text;

            if (lr.DeleteUser(l))
            {
                if (er.DeleteEmployee(emp))
                {
                    MessageBox.Show("Deleted User");
                    this.Refresh_Btn_Click(sender, e);
                    this.ViewAllEmployee_Method(sender, e);
                }
            }
            else
            {
                MessageBox.Show("Can't Delete");
            }
        }
Esempio n. 7
0
        private void DeleteBtn_Click(object sender, EventArgs e)
        {
            Login l = new Login();

            l.Id = this.EmpIdTF.Text;
            Employee emp = new Employee();

            emp.EmpId = this.EmpIdTF.Text;

            if (lr.DeleteUser(l))
            {
                if (er.DeleteEmployee(emp))
                {
                    MessageBox.Show("Deleted");
                    this.RefreshBtn_Click(sender, e);
                    this.ViewAllBtn_Click(sender, e);
                }
            }
            else
            {
                MessageBox.Show("Can Not Delete");
            }
        }
Esempio n. 8
0
        private void deletebtnclick(object sender, EventArgs e)
        {
            Login l = new Login();

            l.UserName = this.EmpIdTb.Text;
            Employee emp = new Employee();

            emp.EmpId = this.EmpIdTb.Text;


            if (lr.DeleteUser(l))
            {
                if (er.DeleteEmployee(emp))
                {
                    MessageBox.Show(emp.Name + " Deleted");
                    this.refreshbtnclick(sender, e);
                    this.viewallbtnclick(sender, e);
                }
            }
            else
            {
                MessageBox.Show("Can Not Delete");
            }
        }
 public ActionResult Delete(int id)
 {
     repo.DeleteEmployee(id);
     return(View());
 }
Esempio n. 10
0
 public int DeleteEmployee(string id)
 {
     return(employeeRepo.DeleteEmployee(id));
 }