示例#1
0
 public static void UpdateSalary(SALARY salary, bool control)
 {
     SalaryDAO.UpdateSalary(salary);
     if (control)
     {
         EmployeeDAO.UpdateEmployee(salary.EmployeeID, salary.Amount);
     }
 }
示例#2
0
 public InformationWeb()
 {
     this._employeeDAO              = (EmployeeDAO) new EmployeeDAOImpl();
     this._accountDAO               = (AccountDAO) new AccountDAOImpl();
     this._coffeeShopDAO            = (CoffeeShopDAO) new CoffeeShopDAOImpl();
     this._basicSalaryDAO           = (BasicSalaryDAO) new BasicSalaryDAOImpl();
     this._salaryDAO                = (SalaryDAO) new SalaryDAOImpl();
     this._coffeeLandScapeDAO       = (CoffeeLandScapeDAO) new CoffeeLandScapeDAOImpl();
     this._coffeeLandScapeDetailDAO = (CoffeeLandScapeDetailDAO) new CoffeeLandScapeDetailDAOImpl();
 }
示例#3
0
        public static SalaryDTO GetAll()
        {
            SalaryDTO dto = new SalaryDTO();

            dto.Employees   = EmployeeDAO.GetEmployees();
            dto.Departments = DepartmentDAO.GetDepartments();
            dto.Positions   = PositionDAO.GetPositions();
            dto.Months      = SalaryDAO.GetMonths();
            dto.Salaries    = SalaryDAO.GetSalaries();
            return(dto);
        }
        public static SalaryDTO GetAll()
        {
            SalaryDTO salaryDTO = new SalaryDTO();

            salaryDTO.Employees   = EmployeeDAO.GetEmployees();
            salaryDTO.Departments = DepartmentDAO.GetDepartments();
            salaryDTO.Positions   = PositionDAO.GetPositions();
            salaryDTO.Months      = SalaryDAO.GetMonths();
            salaryDTO.Salaries    = SalaryDAO.GetSalaries();

            return(salaryDTO);
        }
示例#5
0
 private void btnLuong_Click(object sender, EventArgs e)
 {
     if (dtpBatDau.Value < dtpKetThuc.Value)
     {
         DataTable data = SalaryDAO.FindAllSalaryFromDateToDate(dtpBatDau.Value.ToString(), dtpKetThuc.Value.ToString());
         GUI.Report.SalaryReport report = new GUI.Report.SalaryReport();
         report.SetDataSource(data);
         LuongNVViewer.ReportSource = report;
     }
     else
     {
         MessageBox.Show("Vui lòng chọn ngày bắt đầu và ngày kết thúc tính lương lại");
     }
 }
        private void btn_insert_Click(object sender, EventArgs e)
        {
            try
            {
                // tạo nhân viên tạm
                Employee item = new Employee();
                item.Address     = txb_emp_address.Text;
                item.DateOfBirth = dtp_emp_dob.Value;
                item.Name        = txb_emp_name.Text;
                item.PhoneNumber = txb_emp_phone.Text;
                item.Sex         = cbo_sex.SelectedItem.ToString();

                long emp_id = new EmployeeDAO().Insert(item);

                // tạo đối tượng salary tạm
                Salary item_s = new Salary();
                item_s.EmpID        = emp_id;
                item_s.salary       = Convert.ToDecimal(txb_emp_salary.Text);
                item_s.WorkingDay   = Convert.ToInt32(txb_workingday.Text);
                item_s.WorkingHours = Convert.ToInt32(txb_workinghours.Text);

                bool result = new SalaryDAO().Insert(item_s);

                if (result == true)
                {
                    MessageBox.Show("Thêm nhân viên thành công");
                    LoadEmp();
                }
                else
                {
                    MessageBox.Show("Có lỗi trong quá trình thêm");
                    new EmployeeDAO().Delete(emp_id);
                }
            }
            catch
            {
                MessageBox.Show("Có lỗi trong quá trình thêm");
            }
        }
        private void btn_delete_Click(object sender, EventArgs e)
        {
            DialogResult r = MessageBox.Show("Bạn có chắc chắn muốn xóa bản ghi này ?", "Thông báo", MessageBoxButtons.YesNo);

            if (r == DialogResult.Yes)
            {
                long id = Convert.ToInt32(txb_emp_code.Text);

                bool result_s = new SalaryDAO().Delete(id);
                bool result   = new EmployeeDAO().Delete(id);

                if (result == true && result_s == true)
                {
                    MessageBox.Show("Xóa nhân viên thành công");
                }
                else
                {
                    MessageBox.Show("Có lỗi trong quá trình xóa");
                }
            }
            LoadEmp();
        }
        private void btn_edit_Click(object sender, EventArgs e)
        {
            try
            {
                // tạo 1 nhân viên tạm
                Employee item = new Employee();
                item.ID          = Convert.ToInt32(txb_emp_code.Text);
                item.Address     = txb_emp_address.Text;
                item.DateOfBirth = dtp_emp_dob.Value;
                item.Name        = txb_emp_name.Text;
                item.PhoneNumber = txb_emp_phone.Text;
                item.Sex         = cbo_sex.SelectedItem.ToString();

                //tạo 1 biến tạm của bảng salary
                Salary item_s = new Salary();
                item_s.EmpID        = Convert.ToInt32(txb_emp_code.Text);
                item_s.salary       = Convert.ToDecimal(txb_emp_salary.Text);
                item_s.WorkingDay   = Convert.ToInt32(txb_workingday.Text);
                item_s.WorkingHours = Convert.ToInt32(txb_workinghours.Text);


                bool result   = new EmployeeDAO().Update(item);
                bool result_s = new SalaryDAO().Update(item_s);

                if (result == true && result_s == true)
                {
                    MessageBox.Show("Sửa nhân viên thành công");
                    LoadEmp();
                }
                else
                {
                    MessageBox.Show("Có lỗi trong quá trình Sửa");
                }
            }
            catch
            {
                MessageBox.Show("Có lỗi trong quá trình Sửa");
            }
        }
示例#9
0
 public static void DeleteSalary(int salaryID)
 {
     SalaryDAO.DeleteSalary(salaryID);
 }