コード例 #1
0
        public void NUnit_CutOffDuration_Domain_Add()
        {
            Att_CutOffDurationServices service = new Att_CutOffDurationServices();
            var result  = "";
            int countSC = 0;

            for (int i = 1; i <= 10; i++)
            {
                var model = new Att_CutOffDuration
                {
                    CutOffDurationName = "CutOffDurationName : " + 1,
                    MonthYear          = DateTime.Now,
                    DateStart          = DateTime.Now,
                    DateEnd            = DateTime.Now,
                    IsInsuranceSocial  = true
                };
                result = service.Add <Att_CutOffDuration>(model);
                NUnit.Framework.Assert.IsNull(result);
                if (result != "")
                {
                    countSC += 1;
                    Console.WriteLine("Process Success >>> Create >>> " + model.Id
                                      );
                }
            }
            Console.WriteLine("Total success record: " + countSC);
        }
コード例 #2
0
 public void NUnit_CutOffDuration_Domain_Add()
 {
     Att_CutOffDurationServices service = new Att_CutOffDurationServices();
     var result = "";
     int countSC = 0;
     for (int i = 1; i <= 10; i++)
     {
         var model = new Att_CutOffDuration
         {
             
             CutOffDurationName = "CutOffDurationName : " + 1,
             MonthYear = DateTime.Now,
             DateStart = DateTime.Now,
             DateEnd = DateTime.Now,
             IsInsuranceSocial = true
         };
         result = service.Add<Att_CutOffDuration>(model);
         NUnit.Framework.Assert.IsNull(result);
         if (result != "")
         {
             countSC += 1;
             Console.WriteLine("Process Success >>> Create >>> " + model.Id
                 );
         }
     }
     Console.WriteLine("Total success record: " + countSC);
 }
コード例 #3
0
        public void NUnit_CutOffDuration_Domain_Get(ListQueryModel model)
        {
            Att_CutOffDurationServices service = new Att_CutOffDurationServices();
            var repo = service.GetDataCondition <Att_CutOffDurationEntity>(model, ConstantSql.hrm_att_sp_get_CutOffDurations, ref status);

            Console.Write("Total Record: " + repo.Count());
        }
コード例 #4
0
        public void NUnit_CutOffDuration_Domain_GetById()
        {
            Att_CutOffDurationServices service = new Att_CutOffDurationServices();
            var model = new Att_CutOffDuration { Id = 1 };
            var result = service.GetById<Att_CutOffDuration>(model.Id,ref status) as Att_CutOffDuration;
            NUnit.Framework.Assert.IsNotNull(result);
            Console.Write("SearchResult: " + result.Id
                + " | " + result.CutOffDurationName

                );
        }
コード例 #5
0
        // GET api/<controller>/5
        public Sys_LockObjectModel Get(Guid id)
        {
            string        status        = string.Empty;
            var           model         = new Sys_LockObjectModel();
            ActionService service       = new ActionService(UserLogin);
            var           cutOfServices = new Att_CutOffDurationServices();
            var           orgServices   = new Cat_OrgStructureServices();
            var           entity        = service.GetByIdUseStore <Sys_LockObjectEntity>(id, ConstantSql.hrm_sys_sp_get_LockObjectByID, ref status);

            List <object> listModel = new List <object>();

            listModel.AddRange(new object[3]);
            listModel[1] = 1;
            listModel[2] = Int32.MaxValue - 1;
            List <Att_CutOffDurationEntity> listCutoffduration_All = cutOfServices.GetData <Att_CutOffDurationEntity>(listModel, ConstantSql.hrm_att_sp_get_CutOffDurations, UserLogin, ref status).ToList();

            var objOrg = new List <object>();

            objOrg.Add(null);
            objOrg.Add(null);
            objOrg.Add(null);
            objOrg.Add(1);
            objOrg.Add(int.MaxValue - 1);
            var lstOrg = orgServices.GetData <Cat_OrgStructureEntity>(objOrg, ConstantSql.hrm_cat_sp_get_OrgStructure, UserLogin, ref status).ToList();

            if (entity != null)
            {
                model = entity.CopyData <Sys_LockObjectModel>();

                if (model.PayrollGroups != null)
                {
                    model.lstPayrollGroupID = Common.GetListNumbersFromBinary(model.PayrollGroups);
                    model.PayrollGroupID    = string.Join(",", model.lstPayrollGroupID);
                }
                if (model.OrgStructures != null)
                {
                    model.lstOrgStructureID = Common.GetListNumbersFromBinary(model.OrgStructures);
                    var lstOrgName = lstOrg.Where(s => model.lstOrgStructureID.Contains(s.OrderNumber)).Select(s => s.OrgStructureName).ToList();
                    model.OrgStructureID   = string.Join(",", model.lstOrgStructureID);
                    model.OrgStructureName = string.Join(",", lstOrgName);
                }
                var cutOfDurationEntity = listCutoffduration_All.Where(s => s.DateEnd == model.DateEnd && s.DateStart == model.DateStart).FirstOrDefault();
                if (cutOfDurationEntity != null)
                {
                    model.CutOffDurationID   = cutOfDurationEntity.ID;
                    model.CutOffDurationName = cutOfDurationEntity.CutOffDurationName;
                }
            }
            model.ActionStatus = status;
            return(model);
        }
コード例 #6
0
        public void NUnit_CutOffDuration_Domain_GetById()
        {
            Att_CutOffDurationServices service = new Att_CutOffDurationServices();
            var model = new Att_CutOffDuration {
                Id = 1
            };
            var result = service.GetById <Att_CutOffDuration>(model.Id, ref status) as Att_CutOffDuration;

            NUnit.Framework.Assert.IsNotNull(result);
            Console.Write("SearchResult: " + result.Id
                          + " | " + result.CutOffDurationName

                          );
        }
コード例 #7
0
        public void NUnit_CutOffDuration_Domain_Delete()
        {
            Att_CutOffDurationServices service = new Att_CutOffDurationServices();
            int rs    = 0;
            var model = new Att_CutOffDuration {
                Id = 2
            };
            var result = service.Delete <Att_CutOffDuration>(model.Id);

            NUnit.Framework.Assert.IsNull(result);
            if (result != null)
            {
                rs += 1;
                Console.WriteLine("Process Success >>> Delete >>> " + model.Id);
            }
        }
コード例 #8
0
 public void NUnit_CutOffDuration_Domain_Edit()
 {
     Att_CutOffDurationServices service = new Att_CutOffDurationServices();
     var model = new Att_CutOffDuration
     {
         Id = 5,
         MonthYear = DateTime.Now,
         DateStart = DateTime.Now,
         DateEnd = DateTime.Now
     };
     var result = service.Edit<Att_CutOffDuration>(model);
     NUnit.Framework.Assert.IsNull(result);
     if (result != null)
     {
         Console.WriteLine("Process Success >>> Update >>> " + model.Id);
     }
 }
コード例 #9
0
        public void NUnit_CutOffDuration_Domain_Edit()
        {
            Att_CutOffDurationServices service = new Att_CutOffDurationServices();
            var model = new Att_CutOffDuration
            {
                Id        = 5,
                MonthYear = DateTime.Now,
                DateStart = DateTime.Now,
                DateEnd   = DateTime.Now
            };
            var result = service.Edit <Att_CutOffDuration>(model);

            NUnit.Framework.Assert.IsNull(result);
            if (result != null)
            {
                Console.WriteLine("Process Success >>> Update >>> " + model.Id);
            }
        }
コード例 #10
0
 public void NUnit_CutOffDuration_Domain_Get(ListQueryModel model)
 {
     Att_CutOffDurationServices service = new Att_CutOffDurationServices();
     var repo = service.GetDataCondition<Att_CutOffDurationEntity>(model, ConstantSql.hrm_att_sp_get_CutOffDurations, ref status);
     Console.Write("Total Record: " + repo.Count());
 }
コード例 #11
0
 public void NUnit_CutOffDuration_Domain_Delete()
 {
     Att_CutOffDurationServices service = new Att_CutOffDurationServices();
     int rs = 0;
     var model = new Att_CutOffDuration { Id = 2 };
     var result = service.Delete<Att_CutOffDuration>(model.Id);
     NUnit.Framework.Assert.IsNull(result);
     if (result != null)
     {
         rs += 1;
         Console.WriteLine("Process Success >>> Delete >>> " + model.Id);
     }
 }
コード例 #12
0
ファイル: Sal_HoldSalaryServices.cs プロジェクト: radtek/vnr
        public List <Sal_HoldSalaryEntity> ComputeHoldSalary(Guid?cutOffDurationID, Guid[] ProfileIDs, string orgStructureID, Guid TimeAnalyze, string userLoginName)
        {
            using (var context = new VnrHrmDataContext())
            {
                #region Get Data
                string status = string.Empty;
                List <Sal_HoldSalaryEntity> lstHoldSalaryEntity = new List <Sal_HoldSalaryEntity>();

                //ds kỳ công
                var cutOffServies = new Att_CutOffDurationServices();
                var lstObjCutOff  = new List <object>();
                lstObjCutOff.Add(null);
                lstObjCutOff.Add(1);
                lstObjCutOff.Add(int.MaxValue - 1);
                var lstCutOff = cutOffServies.GetData <Att_CutOffDurationEntity>(Common.DotNetToOracle(cutOffDurationID.Value.ToString()), ConstantSql.hrm_att_sp_get_CutOffDurationById, userLoginName, ref status).FirstOrDefault();

                //ds nv
                var           hrService = new Hre_ProfileServices();
                List <object> strOrgIDs = new List <object>();
                strOrgIDs.AddRange(new object[3]);
                strOrgIDs[0] = (object)orgStructureID;
                var lstProfile = hrService.GetData <Hre_ProfileEntity>(strOrgIDs, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, userLoginName, ref status);

                if (ProfileIDs != null)
                {
                    lstProfile = lstProfile.Where(s => ProfileIDs.Contains(s.ID)).ToList();
                }

                //ds ngày nghỉ
                var leaveDayServices = new Att_LeavedayServices();
                var lstObjLeaveDay   = new List <object>();
                lstObjLeaveDay.AddRange(new object[11]);
                lstObjLeaveDay[4]  = lstCutOff.DateStart;
                lstObjLeaveDay[5]  = lstCutOff.DateEnd;
                lstObjLeaveDay[9]  = 1;
                lstObjLeaveDay[10] = int.MaxValue - 1;
                var lstLeaveDay = leaveDayServices.GetData <Att_LeaveDayEntity>(lstObjLeaveDay, ConstantSql.hrm_att_sp_get_Leaveday, userLoginName, ref status);

                //ds loại ngày nghỉ
                var leavedayTypeServices = new Cat_LeaveDayTypeServices();
                var lstObjLeavedayType   = new List <object>();
                lstObjLeavedayType.Add(null);
                lstObjLeavedayType.Add(null);
                lstObjLeavedayType.Add(1);
                lstObjLeavedayType.Add(int.MaxValue - 1);
                var lstLeavedayType = leavedayTypeServices.GetData <Cat_LeaveDayTypeEntity>(lstObjLeavedayType, ConstantSql.hrm_cat_sp_get_LeaveDayType, userLoginName, ref status);

                lstObjLeavedayType = new List <object>();
                lstObjLeavedayType.Add(null);
                lstObjLeavedayType.Add(EnumDropDown.EntityType.E_CountAnalyzeHoldSalary.ToString());
                lstObjLeavedayType.Add(1);
                lstObjLeavedayType.Add(int.MaxValue - 1);
                var ListNameEntity = leavedayTypeServices.GetData <Cat_NameEntityEntity>(lstObjLeavedayType, ConstantSql.hrm_cat_sp_get_NameEntityByKPI, userLoginName, ref status);

                ////ds chế độ lương
                //var Sal_GradeServices = new Sal_GradeServices();
                //var lstObjSal_Grade = new List<object>();
                //lstObjSal_Grade.AddRange(new object[7]);
                //lstObjSal_Grade[3] = lstCutOff.DateStart;
                //lstObjSal_Grade[4] = lstCutOff.DateEnd;//sửa lại store lấy lên tất cả các grade mà ko có ngày kết thúc
                //lstObjSal_Grade[5] = 1;
                //lstObjSal_Grade[6] = int.MaxValue - 1;
                //var lstSal_Grade = Sal_GradeServices.GetData<Sal_GradeEntity>(lstObjSal_Grade, ConstantSql.hrm_sal_sp_get_Sal_Grade, ref status).ToList();

                Sys_AttOvertimePermitConfigServices Sys_Services = new Sys_AttOvertimePermitConfigServices();
                double DATECLOSE_SALARY = Sys_Services.GetConfigValue <double>(AppConfig.HRM_SAL_DATECLOSE_SALARY);

                foreach (var profile in lstProfile)
                {
                    Sal_HoldSalaryEntity entity = new Sal_HoldSalaryEntity();

                    entity.ProfileID        = profile.ID;
                    entity.CodeEmp          = profile.CodeEmp;
                    entity.ProfileName      = profile.ProfileName;
                    entity.CodeAttendance   = profile.CodeAttendance;
                    entity.EmployeeTypeName = profile.EmployeeTypeName;
                    entity.WorkPlaceName    = profile.WorkPlaceName;
                    entity.IDNo             = profile.IDNo;
                    entity.MonthSalary      = lstCutOff.MonthYear;
                    entity.TimeAnalyzeID    = TimeAnalyze;
                    entity.CatNameEntity    = ListNameEntity.FirstOrDefault(m => m.ID == TimeAnalyze) != null?ListNameEntity.FirstOrDefault(m => m.ID == TimeAnalyze).NameEntityName : "";

                    var lstLeavedayByProfileID = lstLeaveDay.Where(s => profile.ID == s.ProfileID).ToList();

                    #region NV Nghỉ việc trước ngày 18
                    if (profile.DateQuit != null)
                    {
                        if (profile.DateQuit.Value <= lstCutOff.DateEnd && profile.IsSettlement != true)
                        {
                            //if (profile.DateQuit.Value.Day <= 18)
                            //{
                            entity.Terminate = true;
                            lstHoldSalaryEntity.Add(entity);
                            continue;
                            //}
                        }
                    }
                    #endregion

                    #region kiểm tra nghỉ quá 12 ngày
                    if (lstLeavedayByProfileID.Count > 0)
                    {
                        var    lstLeavedayTypeBy12 = lstLeavedayType.Where(m => m.Code == "SP" || m.Code == "SC" || m.Code == "DSP" || m.Code == "DL" || m.Code == "M").ToList();
                        var    _tmp  = lstLeavedayByProfileID.Where(m => !lstLeavedayTypeBy12.Any(t => t.ID == m.LeaveDayTypeID)).ToList();
                        double count = 0;
                        foreach (var i in _tmp)
                        {
                            count += i.LeaveDays != null ? (double)i.LeaveDays : 0;
                        }
                        if (count >= 12)
                        {
                            entity.DayLeave = (int)count;
                            lstHoldSalaryEntity.Add(entity);
                            continue;
                        }
                    }
                    #endregion

                    #region trường hợp đăng ký thai sản trước ngày 18
                    if (lstLeavedayByProfileID.Count > 0)
                    {
                        var lstLeavedayTypeBy12 = lstLeavedayType.Where(m => m.Code == "M").ToList();
                        var _tmp = lstLeavedayByProfileID.FirstOrDefault(m => lstLeavedayTypeBy12.Any(t => t.ID == m.LeaveDayTypeID) && m.DateStart.Day < 18);
                        if (_tmp != null)
                        {
                            entity.IsLeaveM = true;
                            lstHoldSalaryEntity.Add(entity);
                            continue;
                        }
                    }
                    #endregion

                    #region Nghỉ liên tục 3 ngày
                    if (lstLeavedayByProfileID.Count > 0)
                    {
                        var lstLeavedayTypeBy3 = lstLeavedayType.Where(m => m.Code == "D").ToList();
                        //lấy ngày nghỉ theo loại ngày nghỉ D
                        var lstLeavedayByProfileID3 = lstLeavedayByProfileID.Where(m => lstLeavedayTypeBy3.Any(t => t.ID == m.LeaveDayTypeID)).ToList();

                        lstLeavedayByProfileID3 = lstLeavedayByProfileID3.Where(m => m.DateEnd.Day <= DATECLOSE_SALARY).ToList();
                        double count = 0;
                        //còn 1 bug đó là khi đăng ký 3 dòng  liền kế ngày nhau
                        foreach (var i in lstLeavedayByProfileID3)
                        {
                            count = i.LeaveDays != null ? (double)i.LeaveDays : 0;
                            if (count >= 3)
                            {
                                entity.IsLeaveContinuous = true;
                                break;
                            }
                        }
                        if (entity.IsLeaveContinuous != null && entity.IsLeaveContinuous == true)
                        {
                            lstHoldSalaryEntity.Add(entity);
                            continue;
                        }
                    }

                    #endregion
                }
                return(lstHoldSalaryEntity);

                #endregion
            }
        }