Beispiel #1
0
        public Employee[] listDepartmentParticipators(Project prj, Department dpt)
        {
            DataTable dtEmpID = SqlHelper.ExecuteDataTable(@"select employeeID 
            from T_PrjParticipation where projectID=@prjID and departmentID=@dptID",
                                                           new SqlParameter("@prjID", prj.projectID),
                                                           new SqlParameter("@dptID", dpt.DepartmentID));

            Employee[] employees = new Employee[dtEmpID.Rows.Count];
            for (int i = 0; i < dtEmpID.Rows.Count; i++)
            {
                employees[i] = new EmployeeDAL().getByID((Guid)dtEmpID.Rows[i][0]);
            }
            return(employees);
        }
Beispiel #2
0
        public void Update(SalarySheetItem item)
        {
            SqlHelper.ExecuteNonQuery(@"Update T_SalarySheetItem set 
                                        BaseSalary = @BaseSalary, 
                                        Bonus = @Bonus, 
                                        Deduction = @Deduction,
                                        AfterTaxWage = @AfterTaxWage
                                        where SalarySheetItemID = @SalarySheetItemID",
                                      new SqlParameter("@BaseSalary", SqlHelper.ToDBValue(item.BaseSalary)),
                                      new SqlParameter("@Bonus", SqlHelper.ToDBValue(item.Bonus)),
                                      new SqlParameter("@Deduction", SqlHelper.ToDBValue(item.Deduction)),
                                      new SqlParameter("@AfterTaxWage", SqlHelper.ToDBValue(item.AfterTaxWage)),
                                      new SqlParameter("@SalarySheetItemID", item.SalarySheetItemID));
            EmployeeDAL employDAL = new EmployeeDAL();

            employDAL.UpdateEmployeeSalarys(item);
        }
Beispiel #3
0
        public decimal?costInwageNew(Participation parti)
        {
            EmployeeDAL empDAL  = new EmployeeDAL();
            decimal?    cost    = 0;
            DataTable   dtParti = SqlHelper.ExecuteDataTable(@"select * from
            T_PrjParticipation where projectID = @prjID and employeeID=@empID",
                                                             new SqlParameter("@prjID", parti.projectID),
                                                             new SqlParameter("@empID", parti.employeeID));

            if (dtParti.Rows.Count > 0)
            {
                Employee emp = empDAL.getByID(parti.employeeID);
                cost = countEmpPeriod(parti) * emp.AfterTaxWage;
            }

            return(cost);
        }
Beispiel #4
0
        public Employee[] listAllParticipators(Project prj)
        {
            DataTable dtEmpID = SqlHelper.ExecuteDataTable(
                @"select employeeID from T_PrjParticipation where projectID=@prjID",
                new SqlParameter("@prjID", SqlHelper.ToDBValue(prj.projectID)));

            if (dtEmpID.Rows.Count > 0)
            {
                Employee[] employees = new Employee[dtEmpID.Rows.Count];
                for (int i = 0; i < dtEmpID.Rows.Count; i++)
                {
                    employees[i] = new EmployeeDAL().getByID((Guid)dtEmpID.Rows[i][0]);
                }
                return(employees);
            }
            else
            {
                return(null);
            }
        }
Beispiel #5
0
        public void Generate(int year, int month, Guid dptId)
        {
            Guid sheetID = Guid.NewGuid();

            SqlHelper.ExecuteNonQuery(@"insert into 
                                    T_SalarySheet(SalarySheetID,Year,Month,DepartmentID) 
                                    values(@SalarySheetID,@Year,@Month,@DepartmentID)",
                                      new SqlParameter("@SalarySheetID", sheetID),
                                      new SqlParameter("@Year", year),
                                      new SqlParameter("@Month", month),
                                      new SqlParameter("@DepartmentID", dptId));
            Employee[] employees = new EmployeeDAL().SearchByDpt(dptId);
            foreach (Employee employee in employees)
            {
                SqlHelper.ExecuteNonQuery(@"insert into 
                T_SalarySheetItem(SalarySheetItemID,SalarySheetID,EmployeeID,BaseSalary,Bonus,Deduction,AfterTaxWage) 
                values(newid(),@SalarySheetID,@EmployeeID,0,0,0,0)",
                                          new SqlParameter("@SalarySheetID", sheetID),
                                          new SqlParameter("@EmployeeID", employee.ID));
            }
        }