コード例 #1
0
ファイル: Hre_StopWorkingServices.cs プロジェクト: dtafe/vnr
 public string ActionApproved(string selectedIds, string userLogin)
 {
     using (var context = new VnrHrmDataContext())
     {
         string message = string.Empty;
         var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         var repo = new Hre_StopWorkingRepository(unitOfWork);
         var profileServices = new Hre_ProfileServices();
         string status = string.Empty;
         List<Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList();
         var lstStopWorkings = repo.FindBy(m => m.ID != null && lstIds.Contains(m.ID)).ToList();
         foreach (var StopWorking in lstStopWorkings)
         {
             if (StopWorking.StopWorkType == HRM.Infrastructure.Utilities.EnumDropDown.StopWorkType.E_STOP.ToString())
             {
                 var profile = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(StopWorking.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();
                 StopWorking.LastStatusSyn = profile.StatusSyn;
                 profile.StatusSyn = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkType.E_STOP.ToString();
                 StopWorking.Status = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_APPROVED.ToString();
                 profile.TypeSuspense = StopWorking.TypeSuspense;
                 profile.RequestDate = StopWorking.RequestDate;
                 profile.StopWorkType = StopWorking.StopWorkType;
                 profile.DateQuit = StopWorking.DateStop;
                 profile.ResReasonID = StopWorking.ResignReasonID;
                 profile.IsHoldSal = StopWorking.IsHoldSal;
                 profile.TypeOfStop = StopWorking.TypeOfStop;
                 profile.ResignNo = StopWorking.DecisionNo;
                 profileServices.Edit(profile);
             }
             else if (StopWorking.StopWorkType == HRM.Infrastructure.Utilities.EnumDropDown.StopWorkType.E_SUSPENSE.ToString())
             {
                 var profile = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(StopWorking.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();
                 profile.StatusSyn = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkType.E_SUSPENSE.ToString();
                 profile.TypeOfStop = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkType.E_SUSPENSE.ToString();
                 StopWorking.LastStatusSyn = profile.StatusSyn;
                 StopWorking.Status = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_APPROVED.ToString();
                 profile.TypeSuspense = StopWorking.TypeSuspense;
                 profile.RequestDate = StopWorking.RequestDate;
                 profile.StopWorkType = StopWorking.StopWorkType;
                 profile.DateQuit = StopWorking.DateStop;
                 profile.ResReasonID = StopWorking.ResignReasonID;
                 profile.ResignNo = StopWorking.DecisionNo;
                 profile.IsHoldSal = null;
                 profileServices.Edit(profile);
             }
         }
         repo.SaveChanges();
         message = NotificationType.Success.ToString();
         return message;
     }
 }
コード例 #2
0
ファイル: Sal_HoldSalaryServices.cs プロジェクト: dtafe/vnr
        /// <summary>
        /// Lay DS luong hieu luc cua toan cong ty. Moi nhan vien chi co 1 muc luong trong danh sach.
        /// </summary>
        /// <param name="lstSalaryAll">get all Salary</param>
        /// <param name="monthEffect"></param>
        /// <returns></returns>


        public void Approved(List<Guid> selectedIds, string status, string userLoginName)
        {
            using (var context = new VnrHrmDataContext())
            {
                string statusMessage = string.Empty;
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoProfile = new Hre_ProfileRepository(unitOfWork);
                var repoHoldSalary = new Sal_HoldSalaryRepository(unitOfWork);
                var lstHoldSalary = repoHoldSalary.FindBy(s => selectedIds.Contains(s.ID)).ToList();
                var lstProfileIDs = lstHoldSalary.Select(s => s.ProfileID).ToList();
                var profileServices = new Hre_ProfileServices();
                var objProfile = new List<object>();
                objProfile.AddRange(new object[17]);
                objProfile[15] = 1;
                objProfile[16] = int.MaxValue - 1;
                var lstProfile = profileServices.GetData<Hre_ProfileEntity>(objProfile, ConstantSql.hrm_hr_sp_get_ProfileAll,userLoginName, ref statusMessage).ToList().Translate<Hre_Profile>();
                //var lstProfiles = repoProfile.FindBy(m => m.ID != null && lstProfileIDs.Contains(m.ID)).ToList();

                foreach (var holdSalary in lstHoldSalary)
                {
                    holdSalary.Status = status;
                    var profileByID = lstProfile.Where(s => s.ID == holdSalary.ProfileID.Value).FirstOrDefault();
                    profileByID.MonthHoldSal = holdSalary.MonthSalary;
                    profileByID.IsHoldSal = true;
                }
                repoHoldSalary.SaveChanges();
                repoProfile.SaveChanges();


            }
        }
コード例 #3
0
 /// <summary>
 /// [Tho.Bui] - Lấy dữ liệu Nhân Viên (Hre_ProfilePartyUnion) theo ProfileId
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Hre_ProfilePartyUnionModel Put(Hre_ProfilePartyUnionModel model)
 {
     var service = new Hre_ProfileServices();
     string status = string.Empty;
     List<object> listObj = new List<object>() { model.ProfileID };
     var entity = service.GetData<Hre_ProfilePartyUnionEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfilePartyUnionprofileId, UserLogin, ref status).FirstOrDefault();
     var model1 = entity.CopyData<Hre_ProfilePartyUnionModel>();
     model.ActionStatus = status;
     return model1;
 }
コード例 #4
0
ファイル: HrMultiSelectController.cs プロジェクト: dtafe/vnr
 public JsonResult GetMultiProfileOrQuit(string text,bool isProfileQuit)
 {
     //hrm_hr_sp_get_ProfileQuit_multi
     string status = string.Empty;
     var service = new Hre_ProfileServices();
     var get = service.GetData<Hre_ProfileMultiEntity>(text, ConstantSql.hrm_hr_sp_get_Profile_multi, UserLogin, ref status);
     if (isProfileQuit)
     {
         get = service.GetData<Hre_ProfileMultiEntity>(text, ConstantSql.hrm_hr_sp_get_ProfileQuit_multi, UserLogin, ref status);
     }
     if (get != null)
     {
         var result = get.Select(item => new Hre_ProfileMultiModel()
         {
             ID = item.ID,
             ProfileName = item.ProfileName,
         });
         return Json(result, JsonRequestBehavior.AllowGet);
     }
     return Json(null);            
 }
コード例 #5
0
ファイル: HrMultiSelectController.cs プロジェクト: dtafe/vnr
 /// <summary> Load Profile la nguoi phê duyệt </summary>
 /// <param name="text"></param>
 /// <returns></returns>
 public JsonResult GetMultiProfileApprove(string text)
 {
     string status = string.Empty;
     var service = new Hre_ProfileServices();
     var get = service.GetData<Hre_ProfileMultiEntity>(text, ConstantSql.hrm_hr_sp_get_ApproveProfile_multi, UserLogin, ref status);
     var result = get.Select(item => new Hre_ProfileMultiModel()
     {
         ID = item.ID,
         ProfileName = item.ProfileName,
     });
     return Json(result, JsonRequestBehavior.AllowGet);
 }
コード例 #6
0
ファイル: PersonalController.cs プロジェクト: dtafe/vnr
        public ActionResult Paysips(string userLogin)
        {
            if (!CheckPermission()) return RedirectToAction("Denied", "Portal");
            var id = Session[SessionObjects.ProfileID];
            var service = new Hre_ProfileServices();
            string status = string.Empty;
            var listModel = service.GetData<Hre_ProfileModelPortal>(HRM.Infrastructure.Utilities.Common.DotNetToOracle(id.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();
            if (listModel != null)
            {
                Session["ProfileName"] = listModel.ProfileName;
                listModel.ActionStatus = status;
            }
            return GetOnlyView(listModel);

           
        }
コード例 #7
0
ファイル: Hre_ProfileController.cs プロジェクト: dtafe/vnr
        /// <summary>
        /// [Chuc.Nguyen] - Lấy dữ liệu Nhân Viên (Hre_Profile) theo Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Hre_ProfileModel GetById(Guid id)
        {
            var service = new Hre_ProfileServices();
            string status = string.Empty;
            var entity = service.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(id.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, UserLogin, ref status).FirstOrDefault();
            //xu ly tam de lay ten loai nghi viec vi hien tai left join nhiu qa trong store khong chay dc
            if (entity.TypeOfStopID != null)
            {
                var catservice = new Cat_NameEntityServices();
                var entityNameEntity = catservice.GetData<Cat_NameEntityEntity>(Common.DotNetToOracle(entity.TypeOfStopID.ToString()), ConstantSql.hrm_cat_sp_get_NameEntityById, UserLogin, ref status).FirstOrDefault();
                if (entityNameEntity != null)
                {
                    entity.TypeOfStopName = entityNameEntity.NameEntityName;
                }

            }
            var model = entity.CopyData<Hre_ProfileModel>();
            if (model != null && model.DateOfEffect != null)
            {
                model.DateOfEffectOld = model.DateOfEffect;
            }
            model.ActionStatus = status;
            return model;
        }
コード例 #8
0
ファイル: Att_LeavedayServices.cs プロジェクト: dtafe/vnr
        public void SaveLeaveData(List<Att_WorkdayEntity> lstWorkDate, Guid LeaveDayCode, Guid? UserApproved,string userLogin, string Comment)
        {
            string status = string.Empty;
            List<Att_LeaveDayEntity> lstLeaveDaySave = new List<Att_LeaveDayEntity>();
            var workDate = new Att_WorkDayServices();
            var hre_Profile = new Hre_ProfileServices();
            #region getData
            List<object> lstobject = new List<object>();
            lstobject.AddRange(new object[18]);
            lstobject[16] = 1;
            lstobject[17] = int.MaxValue - 1;

            List<Guid> lstProfileId = lstWorkDate.Select(m => m.ProfileID).ToList();

            var lstProfile = hre_Profile.GetData<Hre_ProfileEntity>(lstobject, ConstantSql.hrm_hr_sp_get_Profile, userLogin, ref status).Where(m => lstProfileId.Contains(m.ID)).Select(m => new { m.ID, m.CodeEmp, m.ProfileName }).ToList();

            #endregion
            string Duplicate = string.Empty;
            foreach (var item in lstWorkDate)
            {
                if (!string.IsNullOrEmpty(item.udLeavedayCode1))
                {
                    var profile = lstProfile.Where(m => m.ID == item.ProfileID).FirstOrDefault();
                    if (profile != null)
                    {
                        bool isHaveValue = false;
                        if (profile.ProfileName != string.Empty)
                        {
                            Duplicate += profile.ProfileName;
                            isHaveValue = true;
                        }
                        if (profile.CodeEmp != string.Empty)
                        {
                            Duplicate += "[" + profile.CodeEmp + "]";
                            isHaveValue = true;
                        }
                        if (isHaveValue)
                        {
                            Duplicate += "; ";
                        }
                    }
                    continue;
                }
                //Att_WorkdayEntity WorkdayModify = SaveLeaveDataItem(item.ID, LeaveDayCode, UserApproved, Comment, false);
                var message = SaveLeaveDataItem(item.ID, LeaveDayCode, UserApproved, Comment, false);
            }
            //DataErrorCode ErrorCode = EntityService.SubmitChanges(GuidContext, LoginUserID);
            return;
        }
コード例 #9
0
ファイル: Hre_StopWorkingServices.cs プロジェクト: dtafe/vnr
 public string UpdateWorkingPosition(string selectedIds, string userLogin)
 {
     string message = string.Empty;
     string status = string.Empty;
     var profileServices = new Hre_ProfileServices();
     var workhistoryServices = new Hre_WorkHistoryServices();
     List<Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList();
     //   var lstSuspenses = repo.FindBy(m => m.ID != null && lstIds.Contains(m.ID)).ToList();
     var services = new BaseService();
     var lstObj = new List<object>();
     lstObj.AddRange(new object[14]);
     lstObj[12] = 1;
     lstObj[13] = int.MaxValue - 1;
     var lstComback = services.GetData<Hre_StopWorkingEntity>(lstObj, ConstantSql.hrm_hr_sp_get_RegisterComback, userLogin, ref status).ToList().Translate<Hre_StopWorking>();
     lstComback = lstComback.Where(s => lstIds.Contains(s.ID)).ToList();
     Hre_WorkHistoryEntity workHistoryEntity;
     foreach (var item in lstComback)
     {
         var profile = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(item.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();
         profile.DateOfEffect = item.DateComeBack;
         string supervisor = null;
         if (profile.SupervisorID != null)
         {
             var supervisorbyProfile = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(profile.SupervisorID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();
             if (supervisorbyProfile != null)
             {
                 supervisor = supervisorbyProfile.ProfileName;
             }
         }
         workHistoryEntity = new Hre_WorkHistoryEntity();
         workHistoryEntity.ProfileID = item.ProfileID.Value;
         workHistoryEntity.DateEffective = item.DateComeBack != null ? item.DateComeBack.Value : DateTime.Now;
         workHistoryEntity.OrganizationStructureID = profile.OrgStructureID;
         workHistoryEntity.JobTitleID = profile.JobTitleID;
         workHistoryEntity.PositionID = profile.PositionID;
         workHistoryEntity.Supervisor = supervisor;
         profileServices.Edit(profile);
         workhistoryServices.Add(workHistoryEntity);
     }
     message = NotificationType.Success.ToString();
     return message;
 }
コード例 #10
0
ファイル: PersonalController.cs プロジェクト: dtafe/vnr
        public ActionResult SalaryInfo(string userLogin)
        {
            if (!CheckPermission()) return RedirectToAction("Denied", "Portal");
             var id = Session[SessionObjects.ProfileID];
            var service = new Hre_ProfileServices();
            string status = string.Empty;
            Sal_SalaryInformationModel listModel1 = null;
            var listModel = service.GetData<Sal_SalaryInformationModel>(HRM.Infrastructure.Utilities.Common.DotNetToOracle(id.ToString()), ConstantSql.hrm_sal_sp_get_Sal_SalaryInfomationByProfileId, userLogin,ref status);
            if (listModel != null && listModel.Count > 0)
            {
                listModel1 = listModel.FirstOrDefault();
                listModel1.ActionStatus = status;
            }
            return GetOnlyView(listModel1);


        }
コード例 #11
0
ファイル: Hre_StopWorkingServices.cs プロジェクト: dtafe/vnr
        public string ActionApprovedComeBack(string selectedIds, string userLogin)
        {
            using (var context = new VnrHrmDataContext())
            {
                string message = string.Empty;
                string status = string.Empty;
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repo = new Hre_StopWorkingRepository(unitOfWork);
                var profileServices = new Hre_ProfileServices();
                var contractSevices = new Hre_ContractServices();
                var ContractExtendServices = new Hre_ContractExtendServices();
                var contractTypeSevices = new Cat_ContractTypeServices();

                List<Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList();
                //   var lstSuspenses = repo.FindBy(m => m.ID != null && lstIds.Contains(m.ID)).ToList();
                var services = new BaseService();
                var lstObj = new List<object>();
                lstObj.AddRange(new object[14]);
                lstObj[12] = 1;
                lstObj[13] = int.MaxValue - 1;
                var lstSuspenses = services.GetData<Hre_StopWorkingEntity>(lstObj, ConstantSql.hrm_hr_sp_get_RegisterComback, userLogin, ref status).ToList().Translate<Hre_StopWorking>();
                lstSuspenses = lstSuspenses.Where(s => lstIds.Contains(s.ID)).ToList();
                var lstSuspense = new List<Hre_StopWorkingEntity>();
                foreach (var Suspense in lstSuspenses)
                {
                    var profile = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(Suspense.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();
                    Suspense.Status = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_APPROVED.ToString();
                    Suspense.StatusComeBack = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_APPROVED.ToString();
                    profile.StatusSyn = Suspense.LastStatusSyn;
                    profile.RequestDate = null;
                    profile.DateQuit = null;
                    profile.IsHoldSal = false;
                    profile.TypeSuspense = null;
                    profile.StopWorkType = null;
                    profile.ResReasonID = null;
                    profile.TypeOfStop = null;
                    profile.ResignNo = null;
                    profileServices.Edit(profile);
                    var contract = contractSevices.GetData<Hre_ContractEntity>(Common.DotNetToOracle(Suspense.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ContractsByProfileId, userLogin, ref status).OrderByDescending(s => s.DateStart).FirstOrDefault();

                    if (contract != null)
                    {
                        var contractType = contractSevices.GetData<Cat_ContractTypeEntity>(Common.DotNetToOracle(contract.ContractTypeID.ToString()), ConstantSql.hrm_cat_sp_get_ContractTypeById, userLogin, ref status).FirstOrDefault();
                        if (Suspense.TypeSuspense == HRM.Infrastructure.Utilities.EnumDropDown.TypeSuspense.E_MILITARY.ToString())
                        {
                            int month = 0;
                            if (contractType == null)
                            {
                                continue;
                            }

                            if (contractType.ValueTime != null)
                            {
                                month = (int)contractType.ValueTime.Value;
                                if (contractType.UnitTime == HRM.Infrastructure.Utilities.EnumDropDown.UnitType.E_YEAR.ToString())
                                {
                                    month = month * 12;
                                }
                                contract.DayContract = month;
                                if (contract.DateEnd != null)
                                {
                                    if (Suspense.DateComeBack <= contract.DateEnd.Value)
                                    {
                                        if (Suspense.DateStop != null)
                                        {
                                            double daySus = ((Suspense.DateComeBack.Value.Subtract(Suspense.DateStop.Value)).TotalDays / 30);
                                            contract.DayExtend = (int)Math.Floor(daySus);
                                            if (contract.DateExtend == null)
                                            {
                                                contract.DateExtend = contract.DateEnd.Value.AddMonths(contract.DayExtend.Value);
                                            }
                                            else
                                            {
                                                contract.DateExtend = contract.DateExtend.Value.AddMonths(contract.DayExtend.Value);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (Suspense.DateStop != null)
                                        {
                                            double daySus = (contract.DateEnd.Value.Subtract(Suspense.DateStop.Value)).TotalDays / 30;
                                            contract.DayExtend = (int)Math.Floor(daySus);
                                            if (contract.DateExtend == null)
                                            {
                                                contract.DateExtend = contract.DateEnd.Value.AddMonths(contract.DayExtend.Value);
                                            }
                                            else
                                            {
                                                contract.DateExtend = contract.DateExtend.Value.AddMonths(contract.DayExtend.Value);
                                            }
                                            Suspense.DateComeBack = Suspense.DateComeBack.Value.AddMonths(contract.DayExtend.Value);
                                        }
                                    }
                                }
                            }
                            contract.StatusEvaluation = HRM.Infrastructure.Utilities.EnumDropDown.Status.E_APPROVED.ToString();
                            Hre_ContractExtendEntity contractExtend = new Hre_ContractExtendEntity();
                            contractExtend.ContractID = contract.ID;
                            contractExtend.DateStart = Suspense.DateComeBack;
                            contractExtend.DateEnd = contract.DateExtend;
                            contractSevices.Edit(contract);
                            ContractExtendServices.Add(contractExtend);
                        }
                    }
                    repo.Edit(Suspense);
                }
                repo.SaveChanges();
                message = NotificationType.Success.ToString();
                return message;
            }
        }
コード例 #12
0
ファイル: Tra_ReportServices.cs プロジェクト: dtafe/vnr
        public DataTable GetReportTraineeJoinCourse(Guid[] rankIds, string[] courseIds, string orderNumber, bool IsCreateTemplate, DateTime? dateSeniory, string UserLogin)
        {

            DataTable table = CreateReportTraineeJoinCourseSchema();
            if (IsCreateTemplate)
            {
                return table;
            }
            using (var context = new VnrHrmDataContext())
            {
                string status = string.Empty;

                var dateCheck = DateTime.Now;
                //var dateSeniotyConfig = "31/03/N";
                // var strDateSeniorty = dateSeniotyConfig.Split('/');
                var dateCheckConfig = DateTime.Now;

                //if (dateCheckConfig.Day <= int.Parse(strDateSeniorty[0]) && dateCheckConfig.Month <= int.Parse(strDateSeniorty[1]))
                //{
                //    dateCheckConfig = new DateTime(dateCheckConfig.Year - 1, dateCheckConfig.Month, dateCheckConfig.Day);
                //}
                if (dateSeniory != null)
                {
                    dateCheckConfig = dateSeniory.Value;
                }

                var profileServices = new Hre_ProfileServices();
                var objProfile = new List<object>();
                objProfile.AddRange(new object[17]);
                objProfile[2] = orderNumber;
                objProfile[15] = 1;
                objProfile[16] = int.MaxValue - 1;
                //objProfile.Add(orderNumber);
                //objProfile.Add(null);
                //objProfile.Add(null);
                var lstProfile = profileServices.GetData<Hre_ProfileEntity>(objProfile, ConstantSql.hrm_hr_sp_get_ProfileAll, UserLogin, ref status).Where(s => s.DateQuit == null).ToList();
                //var lstProfile = profileServices.GetData<Hre_ProfileEntity>(objProfile, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).ToList();
                var lstProfileID = lstProfile.Select(s => s.ID).ToList();

                var orgsService = new Cat_OrgStructureServices();
                var objOrg = new List<object>();
                objOrg.AddRange(new object[5]);
                objOrg[3] = 1;
                objOrg[4] = int.MaxValue - 1;
                var lstallorgs = orgsService.GetData<Cat_OrgStructureEntity>(objOrg, ConstantSql.hrm_cat_sp_get_OrgStructure, UserLogin, ref status).ToList();

                var courseServices = new Tra_CourseServices();
                var objCourse = new List<object>();
                objCourse.AddRange(new object[11]);
                objCourse[9] = 1;
                objCourse[10] = int.MaxValue - 1;
                var lstCourse = courseServices.GetData<Tra_CourseEntity>(objCourse, ConstantSql.hrm_tra_sp_get_Course, UserLogin, ref status).ToList();
                if (courseIds != null)
                {
                    lstCourse = lstCourse.Where(s => courseIds.Contains(s.Code)).ToList();
                }

                var jobTitleServices = new Cat_JobTitleServices();
                var objJobtitle = new List<object>();
                objJobtitle.Add(null);
                objJobtitle.Add(null);
                objJobtitle.Add(null);
                objJobtitle.Add(1);
                objJobtitle.Add(int.MaxValue - 1);
                var lstJobtitle = jobTitleServices.GetData<Cat_JobTitleEntity>(objJobtitle, ConstantSql.hrm_cat_sp_get_JobTitle, UserLogin, ref status).ToList();

                var classServices = new Tra_ClassServices();
                var objClass = new List<object>();
                objClass.Add(null);
                objClass.Add(null);
                objClass.Add(null);
                objClass.Add(null);
                objClass.Add(null);
                objClass.Add(null);
                objClass.Add(null);
                objClass.Add(null);
                objClass.Add(1);
                objClass.Add(int.MaxValue - 1);
                var lstClass = classServices.GetData<Tra_ClassEntity>(objClass, ConstantSql.hrm_tra_sp_get_Class, UserLogin, ref status).ToList();

                var salaryClassServices = new Cat_SalaryClassServices();
                var objSalaryClass = new List<object>();
                objSalaryClass.Add(null);
                objSalaryClass.Add(1);
                objSalaryClass.Add(int.MaxValue - 1);
                var lstSalaryClass = salaryClassServices.GetData<Cat_SalaryClassEntity>(objSalaryClass, ConstantSql.hrm_cat_sp_get_SalaryClass, UserLogin, ref status).ToList();
                if (rankIds != null)
                {
                    lstSalaryClass = lstSalaryClass.Where(s => rankIds.Contains(s.ID)).ToList();
                }

                var rankServices = new Cat_SalaryRankServices();
                var objRank = new List<object>();
                objRank.Add(null);
                objRank.Add(null);
                objRank.Add(1);
                objRank.Add(int.MaxValue - 1);
                var lstRank = rankServices.GetData<Cat_SalaryRankEntity>(objRank, ConstantSql.hrm_cat_sp_get_SalaryRank, UserLogin, ref status).ToList();

                var traineeServices = new Tra_TraineeServices();
                var objTrainee = new List<object>();
                objTrainee.AddRange(new object[15]);
                objTrainee[13] = 1;
                objTrainee[14] = int.MaxValue - 1;
                var lstTrainee = rankServices.GetData<Tra_TraineeEntity>(objTrainee, ConstantSql.hrm_tra_sp_get_Trainee, UserLogin, ref status).ToList();

                var workingHistoryServices = new Hre_WorkHistoryServices();
                var objWorking = new List<object>();
                objWorking.AddRange(new object[17]);
                objWorking[15] = 1;
                objWorking[16] = int.MaxValue - 1;
                var lstWorking = workingHistoryServices.GetData<Hre_WorkHistoryEntity>(objWorking, ConstantSql.hrm_hr_sp_get_WorkHistory, UserLogin, ref status).ToList();


                var stopWorkingServices = new Hre_StopWorkingServices();
                var objStopWorking = new List<object>();
                objStopWorking.AddRange(new object[17]);
                objStopWorking[15] = 1;
                objStopWorking[16] = int.MaxValue - 1;
                var lstStopWorking = stopWorkingServices.GetData<Hre_StopWorkingEntity>(objStopWorking, ConstantSql.hrm_hr_sp_get_StopWorking, UserLogin, ref status).ToList();

                var traineeCertificateServices = new Tra_TraineeCertificateServices();
                var objTraineeCertificate = new List<object>();
                objTraineeCertificate.Add(1);
                objTraineeCertificate.Add(int.MaxValue - 1);
                var lstTraineeCertificate = traineeCertificateServices.GetData<Tra_TraineeCertificateEntity>(objTraineeCertificate, ConstantSql.hrm_tra_sp_get_TraineeCertificate, UserLogin, ref status).ToList();
                var lstTraineeIDFromTraineeCertificate = lstTraineeCertificate.Select(s => s.TraineeID).ToList();

                var requirmentDetailServices = new Tra_RequirementTrainDetailServices();
                var objRequirementDetail = new List<object>();
                objRequirementDetail.Add(null);
                objRequirementDetail.Add(1);
                objRequirementDetail.Add(int.MaxValue - 1);
                var lstRequirementDetail = requirmentDetailServices.GetData<Tra_RequirementTrainDetailEntity>(objRequirementDetail, ConstantSql.hrm_tra_sp_get_RequirementDetail, UserLogin, ref status).ToList();

                //if(lstTrainee != null)
                //{
                //    lstTrainee = lstTrainee.Where(s => lstProfileID.Contains(s.ProfileID)).ToList();
                //}

                if (lstTraineeCertificate != null)
                {
                    lstTrainee = lstTrainee.Where(s => !lstTraineeIDFromTraineeCertificate.Contains(s.ID)).ToList();
                }

                foreach (var item in lstCourse)
                {
                    string[] arrCourse = new string[1];
                    if (!string.IsNullOrEmpty(item.CourseListID))
                    {
                        arrCourse = item.CourseListID.Split(',').ToArray();
                    }

                    string[] arrJobtitle = new string[1];
                    int[] arrOrg = new int[1];
                    if (!string.IsNullOrEmpty(item.JobTitleListCode1))
                    {
                        arrJobtitle = item.JobTitleListCode1.Split(',').ToArray();
                    }
                    if (!string.IsNullOrEmpty(item.OrgListCode1))
                    {
                        arrOrg = item.OrgListCode1.Split(',').Select(s => int.Parse(s)).ToArray();
                    }

                    var lstJobtitleByJobtitleCode = lstJobtitle.Where(s => arrJobtitle.Contains(s.Code)).Select(s => s.ID).ToList();
                    var lstOrgByOrderNumber = lstallorgs.Where(s => arrOrg.Contains(s.OrderNumber)).Select(s => s.ID).ToList();
                    string[] _ranklistID = new string[1];
                    if (!string.IsNullOrEmpty(item.RankListID))
                    {
                        _ranklistID = item.RankListID.Split(',').ToArray();
                    }

                    // var lstClassByCourseID = lstClass.Where(s => s.CourseID == item.ID && arrCourse.Contains(s.CourseID)).ToList();
                    var salaryClassEntity = lstSalaryClass.Where(s => _ranklistID.Contains(s.Code)).ToList();
                    var lstSalaryClassID = salaryClassEntity.Select(s => s.ID).ToList();

                    var lstTraineePassedCourse = new List<Tra_TraineeEntity>();
                    // var lstTraineeForProfile = lstProfile.Where(s => s.CodeEmp == "M26423");
                    if (arrCourse[0] != null)
                    {
                        lstTraineePassedCourse = lstTrainee.Where(s => arrCourse.Contains(s.CourseCode) && s.Status == EnumDropDown.TraineeStatus.E_PASSED.ToString()).ToList();
                        int soLuongKhoaTienQUyet = arrCourse.Count();
                        var lstCheckTraineePassedCourse = lstTraineePassedCourse.GroupBy(m => m.ProfileID).Where(m => m.Count() >= soLuongKhoaTienQUyet).ToList();
                        var lstProfileIDPassedCourse = lstCheckTraineePassedCourse.Select(s => s.Key).Distinct().ToList();
                        lstProfile = lstProfile.Where(s => lstProfileIDPassedCourse.Contains(s.ID)).ToList();
                    }

                    foreach (var profileEntity in lstProfile)
                    {
                        var traineePassCourse = lstTrainee.Where(s => s.CourseID == item.ID && profileEntity.ID == s.ProfileID && s.Status == EnumDropDown.TraineeStatus.E_PASSED.ToString()).FirstOrDefault();
                        if (traineePassCourse != null)
                        {
                            continue;
                        }
                        Guid? orgId = profileEntity.OrgStructureID;
                        //    var org = lstOrg.FirstOrDefault(s => s.ID == profileEntity.OrgStructureID);
                        //   var orgOrg = LibraryService.GetNearestParentEntity(orgId, OrgUnit.E_DEPARTMENT, lstOrg, lstOrgType);
                        DataRow dr = table.NewRow();
                        bool flag = false;
                        var lstTraineeByProfileID = lstTrainee.Where(s => s.ProfileID == profileEntity.ID && arrCourse.Contains(s.CourseCode)).ToList();
                        dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.ID] = profileEntity.ID != null ? profileEntity.ID : Guid.Empty;
                        dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.CodeEmp] = profileEntity.CodeEmp != null ? profileEntity.CodeEmp : string.Empty;
                        dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.TraineeName] = profileEntity.ProfileName != null ? profileEntity.ProfileName : string.Empty;
                        dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.IDNo] = profileEntity.IDNo != null ? profileEntity.IDNo : string.Empty;
                        dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.OrgStructureName] = profileEntity.OrgStructureName != null ? profileEntity.OrgStructureName : string.Empty;
                        dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.E_UNIT] = profileEntity.E_UNIT != null ? profileEntity.E_UNIT : string.Empty;
                        dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.E_DIVISION] = profileEntity.E_DIVISION != null ? profileEntity.E_DIVISION : string.Empty;
                        dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.E_DEPARTMENT] = profileEntity.E_DEPARTMENT != null ? profileEntity.E_DEPARTMENT : string.Empty;
                        dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.E_SECTION] = profileEntity.E_SECTION != null ? profileEntity.E_SECTION : string.Empty;
                        dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.E_TEAM] = profileEntity.E_TEAM != null ? profileEntity.E_TEAM : string.Empty;
                        dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.JobTitleName] = profileEntity.JobTitleName != null ? profileEntity.JobTitleName : string.Empty;
                        dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.PositionName] = profileEntity.PositionName != null ? profileEntity.PositionName : string.Empty;
                        dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.CourseName] = item.CourseName != null ? item.CourseName : string.Empty;

                        //var profileEntity = lstProfile.Where(s => s.ID == trainee.ProfileID && s.SalaryClassID != null).FirstOrDefault();
                        var stopWorkingEntity = lstStopWorking.Where(s => s.ProfileID.Value == profileEntity.ID).OrderByDescending(s => s.DateUpdate).FirstOrDefault();

                        //var workingEntity = new Hre_WorkHistoryEntity();
                        var lstWorkingByProfileID = lstWorking.Where(s => s.ProfileID == profileEntity.ID && lstSalaryClassID.Contains(s.SalaryClassID == null ? Guid.Empty : s.SalaryClassID.Value)).ToList();
                        if (lstJobtitleByJobtitleCode.Count > 0)
                        {
                            lstWorkingByProfileID = lstWorkingByProfileID.Where(s => lstJobtitleByJobtitleCode.Contains(s.JobTitleID != null ? s.JobTitleID.Value : Guid.Empty)).ToList();

                        }
                        if (lstOrgByOrderNumber.Count > 0)
                        {
                            lstWorkingByProfileID = lstWorkingByProfileID.Where(s => lstOrgByOrderNumber.Contains(s.OrganizationStructureID != null ? s.OrganizationStructureID.Value : Guid.Empty)).ToList();
                        }
                        var workingEntity = lstWorkingByProfileID.OrderByDescending(s => s.DateUpdate).FirstOrDefault();

                        var dateSuspend = new TimeSpan();
                        var dateSeniority = new TimeSpan();
                        double dateResult = 0;
                        double monthSeniority = 0;
                        if (profileEntity.DateHire == null)
                        {
                            continue;
                        }
                        dateSeniority = dateCheckConfig.Subtract(profileEntity.DateHire.Value);

                        if (stopWorkingEntity != null && stopWorkingEntity.DateStop != null && stopWorkingEntity.DateComeBack != null)
                        {
                            dateSuspend = stopWorkingEntity.DateComeBack.Value.Subtract(stopWorkingEntity.DateStop.Value);
                            dateResult = dateSeniority.Subtract(dateSuspend).TotalDays / 30;
                            monthSeniority = Math.Floor(dateResult);
                        }

                        dateSeniority = dateCheckConfig.Subtract(profileEntity.DateHire.Value);
                        monthSeniority = Math.Floor(dateSeniority.TotalDays / 30);

                        dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.Seniority] = monthSeniority;


                        #region KT điều kiện seniority và maxSeniority != null
                        if (item.Seniority != null && item.MaxSeniority != null)
                        {
                            if (monthSeniority >= item.Seniority && item.MaxSeniority >= monthSeniority)
                            {

                                if (salaryClassEntity != null)
                                {
                                    if (workingEntity != null)
                                    {
                                        // if (profileEntity.SalaryClassID != workingEntity.SalaryClassID)
                                        // {
                                        var dateCheckRank = dateCheck.Subtract(workingEntity.DateEffective).TotalDays / 30;
                                        var monthRank = Math.Floor(dateCheckRank);
                                        if (item.TimeOnCurrentRank != null)
                                        {
                                            if (monthRank < item.TimeOnCurrentRank)
                                            {
                                                flag = true;
                                                // table.Rows.Add(dr);
                                            }
                                        }

                                        //}

                                    }
                                }

                            }
                            else
                            {
                                flag = true;
                            }
                        }
                        #endregion

                        #region KT điều kiện seniority != null && maxSeniority == null
                        if (item.Seniority != null && item.MaxSeniority == null)
                        {
                            if (monthSeniority >= item.Seniority)
                            {
                                if (salaryClassEntity != null)
                                {
                                    if (workingEntity != null)
                                    {
                                        //  if (profileEntity.SalaryClassID != workingEntity.SalaryClassID)
                                        // {
                                        var dateCheckRank = dateCheck.Subtract(workingEntity.DateEffective).TotalDays / 30;
                                        var monthRank = Math.Floor(dateCheckRank);
                                        if (item.TimeOnCurrentRank != null)
                                        {
                                            if (monthRank < item.TimeOnCurrentRank)
                                            {
                                                flag = true;
                                                //  table.Rows.Add(dr);
                                            }
                                        }
                                        // }
                                    }
                                }
                            }
                            else
                            {
                                flag = true;
                            }
                        }
                        #endregion

                        #region KT điều kiện seniority == && maxSeniority != null
                        if (item.MaxSeniority != null && item.Seniority == null)
                        {
                            if (monthSeniority <= item.MaxSeniority)
                            {
                                if (salaryClassEntity != null)
                                {
                                    if (workingEntity != null)
                                    {
                                        // if (profileEntity.SalaryClassID != workingEntity.SalaryClassID)
                                        // {
                                        var dateCheckRank = dateCheck.Subtract(workingEntity.DateEffective).TotalDays / 30;
                                        var monthRank = Math.Floor(dateCheckRank);
                                        if (item.TimeOnCurrentRank != null)
                                        {
                                            if (item.TimeOnCurrentRank != null)
                                            {
                                                if (monthRank < item.TimeOnCurrentRank)
                                                {
                                                    flag = true;
                                                    // table.Rows.Add(dr);
                                                }
                                            }

                                        }

                                        //}

                                    }
                                }
                            }
                            else
                            {
                                flag = true;
                            }

                        }
                        #endregion

                        //#region kiem tra dk Seniority == null và MaxSeniority == null
                        //if (item.Seniority == null && item.MaxSeniority == null)
                        //{
                        //    if (salaryClassEntity != null)
                        //    {
                        //        if (workingEntity != null)
                        //        {
                        //           // if (profileEntity.SalaryClassID != workingEntity.SalaryClassID)
                        //           // {
                        //                var dateCheckRank = dateCheck.Subtract(workingEntity.DateEffective).TotalDays / 30;
                        //                var monthRank = Math.Floor(dateCheckRank);
                        //                if (item.TimeOnCurrentRank != null)
                        //                {
                        //                    if (item.TimeOnCurrentRank != null)
                        //                    {
                        //                        if (monthRank < item.TimeOnCurrentRank)
                        //                        {
                        //                            flag = true;
                        //                          //  table.Rows.Add(dr);
                        //                        }
                        //                    }

                        //                }
                        //            //}

                        //        }
                        //    }
                        //}
                        //#endregion


                        if (lstTraineeByProfileID.Count > 0)
                        {
                            foreach (var traineeEntity in lstTraineeByProfileID)
                            {
                                // dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.Note] = traineeEntity.TeacherComment != null ? traineeEntity.TeacherComment : string.Empty;
                                double monthCourse = Math.Floor(dateCheck.Subtract(traineeEntity.EndDate.Value).TotalDays / 30);
                                var traineeInRequirementDetail = lstRequirementDetail.Where(s => s.CourseID == traineeEntity.ID && traineeEntity.ID == s.ProfileID && s.YearAnalyze != null && s.YearAnalyze.Value.Year == dateCheckConfig.Year).ToList();

                                if (traineeInRequirementDetail.Count >= 1)
                                {
                                    flag = true;
                                    continue;
                                }
                                if (traineeEntity.EndDate == null)
                                {
                                    flag = true;
                                    continue;
                                }

                                if (item.DurationMinCourse != null)
                                {
                                    if (monthCourse < item.DurationMinCourse)
                                    {
                                        flag = true;
                                        continue;
                                    }

                                }
                            }
                        }
                        else
                        {
                            var traineeInRequirementDetail = lstRequirementDetail.Where(s => s.CourseID == item.ID && profileEntity.ID == s.ProfileID && s.YearAnalyze != null && s.YearAnalyze.Value.Year == dateCheckConfig.Year).ToList();
                            if (traineeInRequirementDetail.Count >= 1)
                            {
                                flag = true;
                                continue;
                            }

                        }


                        if (flag == false)
                        {
                            if (salaryClassEntity != null)
                            {
                                if (workingEntity != null)
                                {
                                    // if (profileEntity.SalaryClassID != workingEntity.SalaryClassID)
                                    // {
                                    var dateCheckRank = dateCheck.Subtract(workingEntity.DateEffective).TotalDays / 30;
                                    var monthRank = Math.Floor(dateCheckRank);
                                    if (item.TimeOnCurrentRank != null)
                                    {
                                        if (item.TimeOnCurrentRank != null)
                                        {
                                            if (monthRank >= item.TimeOnCurrentRank)
                                            {
                                                flag = true;
                                                table.Rows.Add(dr);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        table.Rows.Add(dr);
                                    }
                                    // }
                                }
                            }
                        }
                    }
                }
            }

            return table;
        }
コード例 #13
0
ファイル: PersonalController.cs プロジェクト: dtafe/vnr
        public ActionResult SaleEvaluation(string userLogin)
        {
            if (!CheckPermission()) return RedirectToAction("Denied", "Portal");
             var id = Session[SessionObjects.ProfileID];
           
            var service = new Hre_ProfileServices();
            string status = string.Empty;
            List<object> lstObjSaleEvaluation = new List<object>();
            lstObjSaleEvaluation.Add(id);
       //     lstObjSaleEvaluation.Add(1);
     //       lstObjSaleEvaluation.Add(1000000000);

            var listModel = service.GetData<Eva_SaleEvaluationModel>(lstObjSaleEvaluation, ConstantSql.hrm_eva_sp_get_SaleEvaluationByProId, userLogin,ref status);
            if (listModel != null && listModel.Count > 0)
            {
                var model = listModel.FirstOrDefault();
                model.ActionStatus = status;
                return GetOnlyView(model);
            }
            return View();
        }
コード例 #14
0
ファイル: Eva_ReportServices.cs プロジェクト: dtafe/vnr
        public DataTable GetEvalutionDataByTemplate(int year, int? time, string orgStructureID,string userLogin)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));

                DataTable table = CreateEvalutionDataSchema();

                DateTime _daystart = new DateTime(year - 1, 04, 01);
                int daysInFeb = System.DateTime.DaysInMonth(year, 2);
                DateTime _dayend = new DateTime(year, 02, daysInFeb);
                if (time == 2)
                {
                    int daysInMar = System.DateTime.DaysInMonth(year, 3);
                    _dayend = new DateTime(year, 03, daysInMar);
                }
                string status = string.Empty;
                List<Eva_EvalutionDataEntity> lstEvalutionDataEntity = new List<Eva_EvalutionDataEntity>();
                //    //ds nv
                var hrService = new Hre_ProfileServices();
                var service = new BaseService();
                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, userLogin, ref status).ToList();
                if (lstProfile == null)
                    return table;
                DateTime _datetime = new DateTime(year, 01, 01);
                List<object> paraEvalutionData = new List<object>();
                paraEvalutionData.AddRange(new object[13]);

                paraEvalutionData[0] = orgStructureID;
                paraEvalutionData[1] = year;
                paraEvalutionData[2] = _datetime;
                paraEvalutionData[3] = time;
                paraEvalutionData[11] = 1;
                paraEvalutionData[12] = int.MaxValue - 1;

                var evaServiceEvalutionData = new Eva_EvalutionDataServices();
                var lstEvalutionData = evaServiceEvalutionData.GetData<Eva_EvalutionDataEntity>(paraEvalutionData, ConstantSql.hrm_eva_sp_get_EvalutionData, userLogin, ref status);
                foreach (var item in lstEvalutionData)
                {
                    var profile = lstProfile.Where(s => s.ID == item.ProfileID).FirstOrDefault();
                    if (profile != null)
                    {
                        DataRow row = table.NewRow();

                        row[Eva_ReportEvalutionDataEntity.FieldNames.CodeEmp] = profile.CodeEmp;
                        row[Eva_ReportEvalutionDataEntity.FieldNames.ProfileName] = profile.ProfileName;
                        if (item.C1 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C1] = item.C1;
                        if (item.C2 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C2] = item.C2;
                        if (item.C3 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C3] = item.C3;
                        if (item.C4 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C4] = item.C4;
                        if (item.C5 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C5] = item.C5;
                        if (item.C6 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C6] = item.C6;
                        if (item.C7 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C7] = item.C7;
                        if (item.C8 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C8] = item.C8;
                        if (item.C9 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C9] = item.C9;
                        if (item.C10 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C10] = item.C10;
                        if (item.C11 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C11] = item.C11;
                        if (item.C12 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C12] = item.C12;
                        if (item.C13 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C13] = item.C13;
                        if (item.C14 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C14] = item.C14;
                        if (item.C15 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C15] = item.C15;
                        if (item.C16 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C16] = item.C16;
                        if (item.C17 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C17] = item.C17;
                        if (item.C18 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C18] = item.C18;
                        if (item.C19 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C19] = item.C19;
                        if (item.C20 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C20] = item.C20;
                        if (item.C21 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C21] = item.C21;
                        if (item.C22 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C22] = item.C22;
                        if (item.C23 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C23] = item.C23;
                        if (item.C24 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C24] = item.C24;
                        if (item.C25 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C25] = item.C25;
                        if (item.C26 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C26] = item.C26;
                        if (item.C27 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C27] = item.C27;
                        if (item.C28 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C28] = item.C28;
                        if (item.C29 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C29] = item.C29;
                        if (item.C30 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C30] = item.C30;
                        if (item.C31 != null)
                            row[Eva_ReportEvalutionDataEntity.FieldNames.C31] = item.C31;
                        table.Rows.Add(row);
                    }
                }
                return table.ConfigTable(true);
                //    #endregion
            }
        }
コード例 #15
0
ファイル: Hre_ReportServices.cs プロジェクト: dtafe/vnr
        public List<Hre_ReportProfileWorkingEntity> GetReportProfileWorking(DateTime? DateFrom, DateTime? DateTo, string lstOrgOrderNumber, string codeEmp, string userLogin)
        {
            string status = string.Empty;
            List<Hre_ReportProfileWorkingEntity> lstReportProfileWorkingEntity = new List<Hre_ReportProfileWorkingEntity>();

            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));

                var orgsService = new Cat_OrgStructureServices();
                var orgs = orgsService.GetDataNotParam<Cat_OrgStructure>(ConstantSql.hrm_cat_sp_get_AllOrg, userLogin, ref status).ToList();

                var empoyeeTypesServices = new Cat_EmployeeTypeServices();
                var empoyeeTypes = empoyeeTypesServices.GetDataNotParam<Cat_EmployeeTypeEntity>(ConstantSql.hrm_cat_sp_get_AllEmpType, userLogin, ref status).ToList();

                var postionsServices = new Cat_PositionServices();
                var postions = postionsServices.GetDataNotParam<Cat_PositionEntity>(ConstantSql.hrm_cat_sp_get_AllPosition, userLogin, ref status).ToList();

                var orgTypesServices = new Cat_OrgStructureTypeServices();
                var orgTypes = orgTypesServices.GetDataNotParam<Cat_OrgStructureType>(ConstantSql.hrm_cat_sp_get_AllOrgType, userLogin, ref status).ToList();

                var hrService = new Hre_ProfileServices();
                List<object> listObjHr = new List<object>();
                listObjHr.Add(lstOrgOrderNumber);
                listObjHr.Add(DateFrom);
                listObjHr.Add(DateTo);
                listObjHr.Add(codeEmp);
                var profiles = hrService.GetData<Hre_ProfileEntity>(listObjHr, ConstantSql.hrm_hr_sp_get_RptWorkingProfile, userLogin,ref status).ToList();

                foreach (var profile in profiles)
                {
                    Hre_ReportProfileWorkingEntity ReportProfileWorkingEntity = new Hre_ReportProfileWorkingEntity();
                    Guid? orgId = profile.OrgStructureID;
                    var org = orgs.FirstOrDefault(s => s.ID == profile.OrgStructureID);
                    var orgBranch = LibraryService.GetNearestParent(orgId, OrgUnit.E_BRANCH, orgs, orgTypes);
                    var orgOrg = LibraryService.GetNearestParent(orgId, OrgUnit.E_DEPARTMENT, orgs, orgTypes);
                    var orgTeam = LibraryService.GetNearestParent(orgId, OrgUnit.E_TEAM, orgs, orgTypes);
                    var orgSection = LibraryService.GetNearestParent(orgId, OrgUnit.E_SECTION, orgs, orgTypes);
                    ReportProfileWorkingEntity.CodeBranch = orgBranch != null ? orgBranch.Code : string.Empty;
                    ReportProfileWorkingEntity.CodeOrg = orgOrg != null ? orgOrg.Code : string.Empty;
                    ReportProfileWorkingEntity.CodeTeam = orgTeam != null ? orgTeam.Code : string.Empty;
                    ReportProfileWorkingEntity.CodeSection = orgSection != null ? orgSection.Code : string.Empty;
                    ReportProfileWorkingEntity.BranchName = orgBranch != null ? orgBranch.OrgStructureName : string.Empty;
                    ReportProfileWorkingEntity.OrgName = orgOrg != null ? orgOrg.OrgStructureName : string.Empty;
                    ReportProfileWorkingEntity.TeamName = orgTeam != null ? orgTeam.OrgStructureName : string.Empty;
                    ReportProfileWorkingEntity.SectionName = orgSection != null ? orgSection.OrgStructureName : string.Empty;
                    ReportProfileWorkingEntity.CodeEmp = profile.CodeEmp;
                    ReportProfileWorkingEntity.ProfileName = profile.ProfileName;
                    ReportProfileWorkingEntity.IDNo = profile.IDNo;
                    ReportProfileWorkingEntity.Gender = profile.Gender;
                    ReportProfileWorkingEntity.CodeAttendance = profile.CodeAttendance;
                    ReportProfileWorkingEntity.PAStreet = profile.PAddress;
                    ReportProfileWorkingEntity.DateHire = profile.DateHire;
                    var employeeType = empoyeeTypes.Where(s => profile.EmpTypeID == s.ID).FirstOrDefault();
                    if (employeeType != null)
                    {
                        ReportProfileWorkingEntity.EmployeeTypeName = employeeType.EmployeeTypeName;
                    }
                    var position = postions.Where(s => profile.PositionID == s.ID).FirstOrDefault();
                    if (position != null)
                    {
                        ReportProfileWorkingEntity.PositionName = position.PositionName;
                    }
                    lstReportProfileWorkingEntity.Add(ReportProfileWorkingEntity);
                }
                return lstReportProfileWorkingEntity;
            }
        }
コード例 #16
0
ファイル: Tra_TraineeController.cs プロジェクト: dtafe/vnr
        public Tra_TraineeModel Post([Bind]Tra_TraineeModel model)
        {
            #region Validate
            string message = string.Empty;
            var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Tra_TraineeModel>(model, "Tra_Trainee", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return model;
            }
            #endregion
        
            var traineeServices = new Tra_TraineeServices();
            ActionService service = new ActionService(UserLogin);
            var isTraineeInRequireDetail = traineeServices.IsAddTraineeDependOnRequirementDetail();
            var traineeTopicServices = new Tra_TraineeTopicServices();
            var planServices = new Tra_PlanServices();
            var status = string.Empty;
            var lstObjPlan = new List<object>();
            lstObjPlan.Add(null);
            lstObjPlan.Add(null);
            lstObjPlan.Add(null);
            lstObjPlan.Add(null);
            lstObjPlan.Add(1);
            lstObjPlan.Add(int.MaxValue - 1);
            var lstPlan = planServices.GetData<Tra_PlanEntity>(lstObjPlan, ConstantSql.hrm_tra_sp_get_Plan, UserLogin, ref status).ToList();


            var planDetailServices = new Tra_PlanDetailServices();
            var lstObjPlanDetail = new List<object>();
            lstObjPlanDetail.Add(null);
            lstObjPlanDetail.Add(1);
            lstObjPlanDetail.Add(int.MaxValue - 1);
            var lstPlanDetail = planDetailServices.GetData<Tra_PlanDetailEntity>(lstObjPlanDetail, ConstantSql.hrm_tra_sp_get_PlanDetail, UserLogin, ref status).ToList();

            var classServices = new Tra_ClassServices();
            var lstObjClass = new List<object>();
            lstObjClass.Add(null);
            lstObjClass.Add(null);
            lstObjClass.Add(null);
            lstObjClass.Add(null);
            lstObjClass.Add(null);
            lstObjClass.Add(null);
            lstObjClass.Add(null);
            lstObjClass.Add(null);
            lstObjClass.Add(1);
            lstObjClass.Add(int.MaxValue - 1);
            var lstClass = classServices.GetData<Tra_ClassEntity>(lstObjClass, ConstantSql.hrm_tra_sp_get_Class, UserLogin, ref status).ToList();

            var lstObjTraineeInClass = new List<object>();
            lstObjTraineeInClass.Add(model.ClassID);
            var lstTraineeInClass = classServices.GetData<Tra_ClassEntity>(lstObjTraineeInClass, ConstantSql.hrm_cat_sp_get_TraineeByClassID, UserLogin, ref status).ToList();

            var courseTopicServices = new Tra_TraineeTopicServices();
            var objCourseTopic = new List<object>();
            objCourseTopic.Add(1);
            objCourseTopic.Add(int.MaxValue - 1);
            var lstCourseTopic = courseTopicServices.GetData<Tra_CourseTopicEntity>(objCourseTopic, ConstantSql.hrm_tra_sp_get_CourseTopic, UserLogin, ref status);


            var classEntity = lstClass.Where(s => s.ID == model.ClassID).FirstOrDefault();
            var profileServices = new Hre_ProfileServices();
            var profileEntity = profileServices.GetData<Hre_ProfileEntity>(model.ProfileID, ConstantSql.hrm_hr_sp_get_ProfileById, UserLogin, ref status).FirstOrDefault();

            var requirementServices = new Tra_RequirementTrainServices();
            var objRequirement = new List<object>();
            objRequirement.AddRange(new object[7]);
            objRequirement[5] = 1;
            objRequirement[6] = int.MaxValue - 1;
            var lstRequirement = requirementServices.GetData<Tra_RequirementTrainEntity>(objRequirement, ConstantSql.hrm_tra_sp_get_RequirementTrain, UserLogin, ref status).ToList();

            var requirementDetailServices = new Tra_RequirementTrainDetailServices();
            var objRequirementDetail = new List<object>();
            objRequirementDetail.Add(null);
            objRequirementDetail.Add(1);
            objRequirementDetail.Add(int.MaxValue - 1);
            var lstRequirementDetail = requirementDetailServices.GetData<Tra_RequirementTrainDetailEntity>(objRequirementDetail, ConstantSql.hrm_tra_sp_get_RequirementDetail, UserLogin, ref status).ToList();

            var objTrainee = new List<object>();
            objTrainee.AddRange(new object[15]);
            objTrainee[13] = 1;
            objTrainee[14] = int.MaxValue - 1;
            var lstObjTrainee = traineeServices.GetData<Tra_TraineeEntity>(objTrainee, ConstantSql.hrm_tra_sp_get_Trainee, UserLogin, ref status).ToList();
            var traineeEntity = lstObjTrainee.Where(s => s.ClassID == model.ClassID && model.ProfileID == s.ProfileID).ToList();

            #region Check Học Viên
            if(model.ID == Guid.Empty)
            {
                if (isTraineeInRequireDetail)
                {
                    if (traineeEntity.Count > 0)
                    {
                        model.ActionStatus = ConstantMessages.WarningProfileHaveClass.ToString().TranslateString();
                        return model;
                    }
                    if (classEntity != null)
                    {

                        if (classEntity.PlanID != null)
                        {
                            var lstRequirementByPlanID = lstRequirement.Where(s => s.PlanID != null && s.PlanID.Value == classEntity.PlanID).ToList();
                            foreach (var item in lstRequirementByPlanID)
                            {
                                var requirementDetailEntity = lstRequirementDetail.Where(s => item.ID == s.RequirementTrainID && s.CourseID == classEntity.CourseID && s.ProfileID == model.ProfileID).FirstOrDefault();
                                if (requirementDetailEntity != null)
                                {
                                    model = service.UpdateOrCreate<Tra_TraineeEntity, Tra_TraineeModel>(model);

                                    var lstCourseTopicByCourseID = lstCourseTopic.Where(s => s.CourseID == classEntity.CourseID).ToList();
                                    foreach (var courseTopic in lstCourseTopicByCourseID)
                                    {
                                        var traineeTopicEntity = new Tra_TraineeTopicEntity();
                                        traineeTopicEntity.TopicID = courseTopic.TopicID;
                                        traineeTopicEntity.TraineeID = model.ID;
                                        message = traineeTopicServices.Add(traineeTopicEntity);
                                    }
                                    // edit classID trong RequirementDetail
                                    requirementDetailEntity.ClassID = model.ClassID;
                                    message = requirementDetailServices.Edit(requirementDetailEntity);
                                }
                                else
                                {
                                    model.ActionStatus = ConstantMessages.WarningProfileNotInRequirement.ToString().TranslateString();
                                }
                            }
                        }
                        else
                        {
                            model.ActionStatus = ConstantMessages.WarningProfileNotInRequirement.ToString().TranslateString();
                        }
                        model.ActionStatus = ConstantMessages.WarningProfileNotInRequirement.ToString().TranslateString();
                    }
                    if (message == NotificationType.Success.ToString())
                    {
                        model.ActionStatus = message;
                    }
                    return model;

                    //if (classEntity != null)
                    //{
                    //    if (classEntity.PlanID != null)
                    //    {
                    //        var planEntity = lstPlan.Where(s => s.ID == classEntity.PlanID.Value).FirstOrDefault();
                    //        if (planEntity != null)
                    //        {
                    //            var lstPlanDetailByPlanID = lstPlanDetail.Where(s => s.PlanID == planEntity.ID).ToList();

                    //            foreach (var item in lstPlanDetailByPlanID)
                    //            {
                    //                var lstTraineeInClassForOrg = lstTraineeInClass.Where(s => s.OrgStructureID.Value == item.OrgStructureID.Value).ToList();
                    //                //Kiểm tra số lượng của plan detail với sumQuantity của plan
                    //                if (planEntity.SumQuantity == lstPlanDetailByPlanID.Sum(s => s.Quantity))
                    //                {
                    //                    if (lstTraineeInClass.Count < lstPlanDetailByPlanID.Sum(s => s.Quantity))
                    //                    {
                    //                        // Xử Lý kiểm tra nv có thuộc phòng ban trong plan detail ko
                    //                        if (profileEntity != null)
                    //                        {
                    //                            if (lstTraineeInClassForOrg.Count < item.Quantity)
                    //                            {
                    //                                if (profileEntity.OrgStructureID.Value == item.OrgStructureID.Value)
                    //                                {
                    //                                    var traineeEntity = new Tra_TraineeEntity();
                    //                                    model.OrgStructureID = profileEntity.OrgStructureID != null ? profileEntity.OrgStructureID.Value : profileEntity.OrgStructureID;

                    //                                    model = service.UpdateOrCreate<Tra_TraineeEntity, Tra_TraineeModel>(model);

                    //                                    var lstCourseTopicByCourseID = lstCourseTopic.Where(s => s.CourseID == classEntity.CourseID).ToList();
                    //                                    foreach (var courseTopic in lstCourseTopicByCourseID)
                    //                                    {
                    //                                        var traineeTopicEntity = new Tra_TraineeTopicEntity();
                    //                                        traineeTopicEntity.TopicID = courseTopic.TopicID;
                    //                                        traineeTopicEntity.TraineeID = model.ID;
                    //                                        message = traineeTopicServices.Add(traineeTopicEntity);
                    //                                    }
                    //                                    return model;  
                    //                                }
                    //                                model.ActionStatus = ConstantMessages.WarningProfileNotDependantOrgStructure.TranslateString();
                    //                            }
                    //                            else
                    //                            {
                    //                                model.ActionStatus = ConstantMessages.WarningTraineeOverLimit.TranslateString();
                    //                            }
                    //                        }
                    //                    }
                    //                    else
                    //                    {
                    //                        model.ActionStatus = ConstantMessages.WarningTraineeOverLimit.TranslateString();
                    //                    }
                    //                }
                    //                if (planEntity.SumQuantity > lstPlanDetailByPlanID.Sum(s => s.Quantity))
                    //                {
                    //                        model = service.UpdateOrCreate<Tra_TraineeEntity, Tra_TraineeModel>(model);
                    //                        var lstCourseTopicByCourseID = lstCourseTopic.Where(s => s.CourseID == classEntity.CourseID).ToList();
                    //                        foreach (var courseTopic in lstCourseTopicByCourseID)
                    //                        {
                    //                            var traineeTopicEntity = new Tra_TraineeTopicEntity();
                    //                            traineeTopicEntity.TopicID = courseTopic.TopicID;
                    //                            traineeTopicEntity.TraineeID = model.ID;
                    //                            message = traineeTopicServices.Add(traineeTopicEntity);
                    //                        }
                    //                        return model;  
                    //                }

                    //            }

                    //            return model;
                    //        }
                    //    }
                    //}

                }
                if (classEntity != null)
                {
                    if (traineeEntity.Count > 0)
                    {
                        model.ActionStatus = ConstantMessages.WarningProfileHaveClass.ToString().TranslateString();
                        return model;
                    }

                    model = service.UpdateOrCreate<Tra_TraineeEntity, Tra_TraineeModel>(model);

                    var lstCourseTopicByCourseID = lstCourseTopic.Where(s => s.CourseID == classEntity.CourseID).ToList();
                    if (lstCourseTopicByCourseID.Count == 0)
                    {
                        return model;
                    }
                    foreach (var courseTopic in lstCourseTopicByCourseID)
                    {
                        var traineeTopicEntity = new Tra_TraineeTopicEntity();
                        traineeTopicEntity.TopicID = courseTopic.TopicID;
                        traineeTopicEntity.TraineeID = model.ID;
                        model.ActionStatus = traineeTopicServices.Add(traineeTopicEntity);
                    }


                    return model;

                }
            }

            return service.UpdateOrCreate<Tra_TraineeEntity, Tra_TraineeModel>(model);

            



            #endregion
        }
コード例 #17
0
ファイル: Sal_UnusualEDController.cs プロジェクト: dtafe/vnr
        public Sal_UnusualAllowanceModel Post([Bind]Sal_UnusualAllowanceModel model)
        {
            var hrService = new Hre_ProfileServices();
            var UnusualAllowanceServices = new Sal_UnusualAllowanceServices();
            string status = string.Empty;
            #region Validate
            string message = string.Empty;
            var checkValidate = false;
            //kiểm tra xem có phải là đang create ở trang chi tiết nv ko
            if (model.IsGeneralProfile != null && model.IsGeneralProfile == true)
            {
                checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_UnusualAllowanceModel>(model, "Sal_UnusualEDGeneralProfile", ref message);

                if (!checkValidate)
                {
                    model.ActionStatus = message;
                    return model;
                }
                ActionService service = new ActionService(UserLogin);
                return service.UpdateOrCreate<Sal_UnusualAllowanceEntity, Sal_UnusualAllowanceModel>(model);
            }
            else
            {
                if (!string.IsNullOrEmpty(model.OrgStructureIDs))
                {
                    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_UnusualAllowanceModel>(model, "Sal_UnusualEDOrg", ref message);
                }
                else
                {
                    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_UnusualAllowanceModel>(model, "Sal_UnusualED", ref message);
                }
                if (!checkValidate)
                {
                    model.ActionStatus = message;
                    return model;
                }

                if (!string.IsNullOrEmpty(model.OrgStructureIDs))
                {
                    List<Guid> listGuid = new List<Guid>();
                    if (model.ProfileIDExclusion != null)
                    {
                        var listStr = model.ProfileIDExclusion.Split(',');

                        if (listStr[0] != "")
                        {
                            foreach (var item in listStr)
                            {
                                listGuid.Add(Guid.Parse(item));
                            }
                        }
                    }
                    List<object> listObj = new List<object>();
                    listObj.Add(model.OrgStructureID);
                    listObj.Add(string.Empty);
                    listObj.Add(string.Empty);
                    var lstProfile = hrService.GetData<Hre_ProfileIdEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure, userLogin, ref status).Select(s => s.ID).ToList();
                    if (listGuid != null)
                    {
                        lstProfile = lstProfile.Where(s => !listGuid.Contains(s)).ToList();
                    }

                    List<Sal_UnusualAllowanceEntity> lstUnusualAllowance = new List<Sal_UnusualAllowanceEntity>();
                    foreach (var i in lstProfile)
                    {
                        Sal_UnusualAllowanceEntity item = new Sal_UnusualAllowanceEntity();
                        item = model.Copy<Sal_UnusualAllowanceEntity>();
                        item.ProfileID = i;
                        lstUnusualAllowance.Add(item);
                    }
                    model.ActionStatus = UnusualAllowanceServices.Add(lstUnusualAllowance);
                    return model;
                }
                else
                {
                    string[] listProfile = model.ProfileIDs.Split(',');
                    List<Sal_UnusualAllowanceEntity> lstUnusualAllowance = new List<Sal_UnusualAllowanceEntity>();
                    foreach (var i in listProfile)
                    {
                        Sal_UnusualAllowanceEntity item = new Sal_UnusualAllowanceEntity();
                        item = model.Copy<Sal_UnusualAllowanceEntity>();
                        item.ProfileID = Guid.Parse(i);
                        lstUnusualAllowance.Add(item);
                    }
                    model.ActionStatus = UnusualAllowanceServices.Add(lstUnusualAllowance);
                    return model;
                }
            }
            #endregion

        }
コード例 #18
0
ファイル: Hre_DisciplineController.cs プロジェクト: dtafe/vnr
        public Hre_DisciplineModel Post([Bind]Hre_DisciplineModel model)
        {
            #region Validate

            string message = string.Empty;
            var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Hre_DisciplineModel>(model, "Hre_Discipline", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return model;
            }

            #endregion

            #region cột DepartmentName = phòng ban hiện tại của NV
            string status = string.Empty;
            var orgServices = new Cat_OrgStructureServices();
            var profileServices = new Hre_ProfileServices();
            var lstObjOrg = new List<object>();
            lstObjOrg.Add(null);
            lstObjOrg.Add(null);
            lstObjOrg.Add(null);
            lstObjOrg.Add(1);
            lstObjOrg.Add(int.MaxValue - 1);
            var lstOrg = orgServices.GetData<Cat_OrgStructureEntity>(lstObjOrg, ConstantSql.hrm_cat_sp_get_OrgStructure, UserLogin, ref status).ToList();

            var orgTypeService = new Cat_OrgStructureTypeServices();
            var lstObjOrgType = new List<object>();
            lstObjOrgType.Add(null);
            lstObjOrgType.Add(null);
            lstObjOrgType.Add(1);
            lstObjOrgType.Add(int.MaxValue - 1);
            var lstOrgType = orgTypeService.GetData<Cat_OrgStructureTypeEntity>(lstObjOrgType, ConstantSql.hrm_cat_sp_get_OrgStructureType, UserLogin, ref status).ToList();

            string orgstructureNameByProfile = string.Empty;
            if (model.ProfileID != null)
            {
                var profilebydis = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(model.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, UserLogin, ref status).FirstOrDefault();
                if (profilebydis != null)
                {
                    Guid? orgId = profilebydis.OrgStructureID;
                    var org = lstOrg.FirstOrDefault(s => s.ID == profilebydis.OrgStructureID);
                    var department = LibraryService.GetNearestParentEntity(orgId, OrgUnit.E_DEPARTMENT, lstOrg, lstOrgType);
                    orgstructureNameByProfile = department != null ? department.OrgStructureName : string.Empty;
                }
            }
            model.DepartmentName = orgstructureNameByProfile; 
            #endregion
            ActionService service = new ActionService(UserLogin);
            return service.UpdateOrCreate<Hre_DisciplineEntity, Hre_DisciplineModel>(model);
        }
コード例 #19
0
ファイル: Hre_GetDataController.cs プロジェクト: dtafe/vnr
        public string SaveContractAndNextSalaryApprovedEvaluation(Hre_ContractEntity contract)
        {

            if (contract.DateEndNextContract == null)
            {
                return string.Empty;
            }

            // Lấy biến Dateend này gắn cho quá trình công tác khi cập nhật quá trinh công tác ở dưới
            DateTime? dateEnd = contract.DateEnd;

            string message = string.Empty;
            var actionService = new ActionService(UserLogin);
            string status = string.Empty;

            var profile = actionService.GetData<Hre_ProfileEntity>(contract.ProfileID, ConstantSql.hrm_hr_sp_get_ProfileById, ref status).FirstOrDefault();
            var hrService = new Hre_ProfileServices();
            var salaryRankServices = new Cat_SalaryRankServices();
            var lstObjSalaryRank = new List<object>();
            lstObjSalaryRank.Add(null);
            lstObjSalaryRank.Add(null);
            lstObjSalaryRank.Add(1);
            lstObjSalaryRank.Add(int.MaxValue - 1);
            var lstSalaryRank = actionService.GetData<Cat_SalaryRankEntity>(lstObjSalaryRank, ConstantSql.hrm_cat_sp_get_SalaryRank, ref status).ToList();

            var contractServices = new Hre_ContractServices();

            var workhistoryService = new Hre_WorkHistoryServices();
            var lstObjWorkhistory = new List<object>();
            lstObjWorkhistory.AddRange(new object[17]);
            lstObjWorkhistory[15] = 1;
            lstObjWorkhistory[16] = int.MaxValue - 1;
            var lstWorkhistory = actionService.GetData<Hre_WorkHistoryEntity>(lstObjWorkhistory, ConstantSql.hrm_hr_sp_get_WorkHistory, ref status).ToList();

            var basicSalaryService = new Sal_BasicSalaryServices();

            var attGradeService = new Att_GradeServices();
            var lstObjAttGrade = new List<object>();
            lstObjAttGrade.AddRange(new object[6]);
            lstObjAttGrade[4] = 1;
            lstObjAttGrade[5] = int.MaxValue - 1;
            var lstAttGrade = actionService.GetData<Att_GradeEntity>(lstObjAttGrade, ConstantSql.hrm_att_sp_get_Att_Grade, ref status).ToList();

            var gradeService = new Sal_GradeServices();
            var lstObjSalGrade = new List<object>();
            lstObjSalGrade.AddRange(new object[7]);
            lstObjSalGrade[5] = 1;
            lstObjSalGrade[6] = int.MaxValue - 1;
            var lstSalGrade = actionService.GetData<Sal_GradeEntity>(lstObjSalGrade, ConstantSql.hrm_sal_sp_get_Sal_Grade, ref status).ToList();

            var gradePayrollService = new Cat_GradePayrollServices();
            var lstObjGradePayroll = new List<object>();
            lstObjGradePayroll.Add(null);
            lstObjGradePayroll.Add(null);
            lstObjGradePayroll.Add(1);
            lstObjGradePayroll.Add(int.MaxValue - 1);
            var lstGradePayroll = actionService.GetData<Cat_GradePayrollEntity>(lstObjGradePayroll, ConstantSql.hrm_cat_sp_get_GradePayroll, ref status).ToList();

            var gradeAttService = new Cat_GradeAttendanceServices();
            var lstObjGradeAtt = new List<object>();
            lstObjGradeAtt.AddRange(new object[10]);
            lstObjGradeAtt[8] = 1;
            lstObjGradeAtt[9] = int.MaxValue - 1;
            var lstGradeAtt = actionService.GetData<Cat_GradeAttendanceEntity>(lstObjGradeAtt, ConstantSql.hrm_cat_sp_get_Cat_GradeAttendance, ref status).ToList();

            var currencyServices = new Cat_CurrencyServices();
            var lstObjCurrency = new List<object>();
            lstObjCurrency.Add(null);
            lstObjCurrency.Add(null);
            lstObjCurrency.Add(1);
            lstObjCurrency.Add(int.MaxValue - 1);
            var lstCurrency = actionService.GetData<Cat_CurrencyEntity>(lstObjCurrency, ConstantSql.hrm_cat_sp_get_Currency, ref status).ToList();
            var lstCurrencyNew = lstCurrency.Where(s => s.CurrencyName == "VND").FirstOrDefault();

            var contractTypeService = new Cat_ContractTypeServices();
            var lstObjContractType = new List<object>();
            lstObjContractType.Add(null);
            lstObjContractType.Add(null);
            lstObjContractType.Add(null);
            lstObjContractType.Add(null);
            lstObjContractType.Add(1);
            lstObjContractType.Add(int.MaxValue - 1);
            var lstContractType = actionService.GetData<Cat_ContractTypeEntity>(lstObjContractType, ConstantSql.hrm_cat_sp_get_ContractType, ref status).ToList();

            var insuranceConfigServices = new Cat_InsuranceConfigServices();
            var objInsuranceConfig = new List<object>();
            objInsuranceConfig.Add(1);
            objInsuranceConfig.Add(int.MaxValue - 1);
            var lstInsuranceConfig = actionService.GetData<Cat_InsuranceConfigEntity>(objInsuranceConfig, ConstantSql.hrm_cat_sp_get_InsuranceConfig, ref status).ToList();

            var insuranceServices = new Sal_InsuranceSalaryServices();
            var objInsurance = new List<object>();
            objInsurance.AddRange(new object[9]);
            objInsurance[7] = 1;
            objInsurance[8] = int.MaxValue - 1;
            var lstInsurance = actionService.GetData<Sal_InsuranceSalaryEntity>(objInsurance, ConstantSql.hrm_sal_sp_get_InsuranceSalary, ref status).ToList();


            var contractTypeEntity = new Cat_ContractTypeEntity();
            var objContract = new List<object>();
            objContract.Add(contract.ProfileID);
            var lstContractIdByProfileID = actionService.GetData<Hre_ContractEntity>(objContract, ConstantSql.hrm_hr_sp_get_ContractsByProfileId, ref status);
            var listIdContract = string.Empty;
            if (lstContractIdByProfileID != null)
            {
                listIdContract = string.Join(",", lstContractIdByProfileID.Select(d => d.ContractTypeID));
            }

            if (contract.NextContractTypeID != null)
            {
                contractTypeEntity = lstContractType.Where(s => contract.NextContractTypeID.Value == s.ID).FirstOrDefault();
            }
            else
            {
                message = ConstantMessages.WarningContractHaveNotNextContract.ToString().TranslateString();
                return message;
            }


            if (contractTypeEntity != null)
            {
                if (contractTypeEntity.Type == EnumDropDown.TypeContract.E_NODURATION.ToString())
                {
                    return string.Empty;
                }
            }

            var workingHistoryEntity = lstWorkhistory.Where(s => s.ProfileID == contract.ProfileID).FirstOrDefault();
            var objSalGrade = new List<object>();
            objSalGrade.Add(contract.ProfileID);
            objSalGrade.Add(null);
            objSalGrade.Add(1);
            objSalGrade.Add(int.MaxValue - 1);
            var salGradeByProfileIDEntity = actionService.GetData<Sal_GradeEntity>(objSalGrade, ConstantSql.hrm_sal_sp_get_GradeAndAllownaceByProId, ref status).FirstOrDefault();
            var objAttGrade = new List<object>();
            objAttGrade.Add(contract.ProfileID);
            objAttGrade.Add(null);
            objAttGrade.Add(1);
            objAttGrade.Add(int.MaxValue - 1);
            var attGradeByProfileIDEntity = actionService.GetData<Att_GradeEntity>(objAttGrade, ConstantSql.hrm_att_sp_get_GradeAttendanceByProIdCutID, ref status).FirstOrDefault();

            if (contractTypeEntity == null)
            {
                return string.Empty;
            }

            var contracttypeByContract = lstContractType.Where(s => s.ID == contract.ContractTypeID).FirstOrDefault();

            if (contract.ContractResult == EnumDropDown.ResultContract.PASS.ToString())
            {
                if (contract.ContractEvaType == EnumDropDown.ContractEvaType.E_EXPIRED_APPRENTICE.ToString())
                {

                    //chưa tìm dc cách xử lý nên hard code 
                    var lstSalaryRankNew = new Cat_SalaryRankEntity();
                    if (contract.RankDetailForNextContract != null)
                    {
                        lstSalaryRankNew = lstSalaryRank.Where(s => contract.RankDetailForNextContract != null && s.ID == contract.RankDetailForNextContract.Value).FirstOrDefault();
                    }
                    else
                    {
                        lstSalaryRankNew = lstSalaryRank.Where(s => contract.RankRateID != null && s.ID == contract.RankRateID.Value).FirstOrDefault();
                    }

                    #region Xử lý Hre_Contract
                    if (contract.TypeOfPass == EnumDropDown.TypeOfPass.E_SIGNED_NEXTCONTRACT.ToString())
                    {
                        int month = 0;
                        if (contractTypeEntity != null && contractTypeEntity.ValueTime != null)
                        {
                            month = (int)contractTypeEntity.ValueTime.Value;
                            if (contractTypeEntity.UnitTime == HRM.Infrastructure.Utilities.EnumDropDown.UnitType.E_YEAR.ToString())
                            {
                                month = month * 12;
                            }
                            contractTypeEntity.DateStart = contract.DateEnd.Value.AddDays(1);

                            //chưa tìm dc cách xử lý nên hard code 
                            //  var nextContractTypeID = Common.ConvertToGuid(contractTypeEntity.ContractNextID).ToString();
                            var contractEntity = new Hre_ContractEntity
                            {
                                //   ContractNo = getContractNo(item, item.DateSigned),
                                ProfileID = contract.ProfileID,
                                ProfileName = contract.ProfileName,
                                DateStart = contract.DateEnd.Value.AddDays(1),
                                DateSigned = contract.DateEnd.Value.AddDays(1),
                                JobTitleID = contract.JobTitleID,
                                PositionID = contract.PositionID,
                                DateEnd = contractTypeEntity.DateStart.Value.AddMonths(month),
                                Salary = lstSalaryRankNew == null ? 0 : lstSalaryRankNew.SalaryStandard,
                                RankRateID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.ID,
                                ClassRateID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID,
                                ClassRateName = lstSalaryRankNew == null ? string.Empty : lstSalaryRankNew.SalaryClassName,
                                SalaryRankName = lstSalaryRankNew == null ? string.Empty : lstSalaryRankNew.SalaryRankName,
                                ContractTypeID = contractTypeEntity.ID,
                                DateEndNextContract = contract.DateEndNextContract,
                            };
                            if (contract.DateEndNextContract != null)
                            {
                                contractEntity.DateEnd = contract.DateEndNextContract.Value;
                            }
                            contractEntity = SetNewCodeContract(contractEntity, listIdContract);

                            #region Nếu là loại hđ xác định thời hạn thì update lại cột TimesContract theo task 0049731
                            if (contracttypeByContract != null && contracttypeByContract.Type == HRM.Infrastructure.Utilities.EnumDropDown.TypeContract.E_DURATION.ToString())
                            {
                                try
                                {
                                    string times = contractEntity.ContractNo.Substring(contractEntity.ContractNo.Length - 1, 1);
                                    int Year = int.Parse(times);
                                    contractEntity.TimesContract = Year;
                                }
                                catch
                                {
                                }
                            }
                            #endregion
                            contractEntity.Status = "E_APPROVED";
                            contractEntity.StatusEvaluation = "E_APPROVED";
                            contractEntity.DateExtend = contract.DateEnd;
                            if (!string.IsNullOrEmpty(contractEntity.ErrorMessage))
                            {
                                return string.Empty;
                            }
                            message = contractServices.Add(contractEntity);
                        }
                        else
                        {
                            contractTypeEntity.DateStart = contract.DateEnd.Value.AddDays(1);

                            //chưa tìm dc cách xử lý nên hard code 
                            //  var nextContractTypeID = Common.ConvertToGuid(contractTypeEntity.ContractNextID).ToString();
                            var contractEntity = new Hre_ContractEntity
                            {
                                //  ContractNo = getContractNo(item, item.DateSigned),
                                ProfileID = contract.ProfileID,
                                ProfileName = contract.ProfileName,
                                DateStart = contract.DateEnd.Value.AddDays(1),
                                DateSigned = contract.DateEnd.Value.AddDays(1),
                                JobTitleID = contract.JobTitleID,
                                PositionID = contract.PositionID,
                                //   DateEnd = contractTypeEntity.DateStart.Value.AddMonths(month),
                                Salary = lstSalaryRankNew == null ? 0 : lstSalaryRankNew.SalaryStandard,
                                RankRateID = lstSalaryRankNew == null ? contract.RankRateID : lstSalaryRankNew.ID,
                                ClassRateID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID,
                                ClassRateName = lstSalaryRankNew == null ? string.Empty : lstSalaryRankNew.SalaryClassName,
                                SalaryRankName = lstSalaryRankNew == null ? string.Empty : lstSalaryRankNew.SalaryRankName,
                                ContractTypeID = contractTypeEntity.ID
                            };

                            //if (!string.IsNullOrEmpty(contractTypeEntity.Formula))
                            //{
                            //    contractEntity = SetNewDateEndContract(contractEntity);
                            //}
                            if (contract.DateEndNextContract != null)
                            {
                                contractEntity.DateEnd = contract.DateEndNextContract.Value;
                            }
                            contractEntity.DateExtend = contract.DateEnd;
                            contractEntity.StatusEvaluation = "E_APPROVED";

                            if (!string.IsNullOrEmpty(contractEntity.ErrorMessage))
                            {
                                return string.Empty;
                            }

                            message = contractServices.Add(contractEntity);
                        }
                    }

                    //Edit lai StatusEvaluation 
                    contract.StatusEvaluation = "E_APPROVED";
                    message = contractServices.Edit(contract);

                    #endregion

                    #region Xử Lý Sal_BasicSalary
                    var salaryEntity = new Sal_BasicSalaryEntity
                    {
                        ProfileID = contract.ProfileID,
                        ClassRateID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID,
                        RankRateID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.ID,
                        GrossAmount = lstSalaryRankNew == null ? string.Empty : lstSalaryRankNew.SalaryStandard.ToString(),
                        DateOfEffect = contract.DateSigned != null ? contract.DateSigned.Value : DateTime.Now,
                        CurrencyID = lstCurrencyNew.ID,
                        Note = contract.Remark,
                        Status = "E_APPROVED"
                    };
                    message = basicSalaryService.Add(salaryEntity);

                    #endregion

                    #region Xử Lý Hre_Profile
                    var profileEntity = profile.CopyData<Hre_ProfileEntity>();
                    Guid? _AbilityTileID = null;
                    profileEntity.SalaryClassID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID;
                    if (profileEntity.SalaryClassID != null)
                    {
                        var abilityTitleBySalaryClass = hrService.GetData<Cat_AbilityTileEntity>(Common.DotNetToOracle(profileEntity.SalaryClassID.ToString()), ConstantSql.hrm_cat_sp_get_AbilityTileBySalaryClassId, UserLogin, ref status).FirstOrDefault();
                        if (abilityTitleBySalaryClass != null)
                        {
                            _AbilityTileID = abilityTitleBySalaryClass.ID;
                            profileEntity.AbilityTileID = _AbilityTileID;
                        }
                    }

                    hrService.Edit(profileEntity);

                    if (workingHistoryEntity != null)
                    {
                        if (workingHistoryEntity.SalaryClassID != lstSalaryRankNew.SalaryClassID)
                        {
                            var workhistoryEntity = new Hre_WorkHistoryEntity
                            {
                                ProfileID = contract.ProfileID,
                                SalaryClassID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID,
                                DateEffective = dateEnd != null ? dateEnd.Value.AddDays(1) : DateTime.Now,
                                AbilityTileID = _AbilityTileID,
                                Status = "E_APPROVED"

                            };
                            message = workhistoryService.Add(workhistoryEntity);
                        }


                    }
                    else
                    {
                        var workhistoryEntity = new Hre_WorkHistoryEntity
                        {
                            ProfileID = contract.ProfileID,
                            SalaryClassID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID,
                            DateEffective = dateEnd != null ? dateEnd.Value.AddDays(1) : DateTime.Now,
                            Status = "E_APPROVED",

                        };
                        message = workhistoryService.Add(workhistoryEntity);
                    }

                    #endregion

                    #region Sal_Grade
                    var lstGradeByProfileID = lstSalGrade.Where(s => contract.ProfileID == s.ProfileID).ToList().OrderByDescending(s => s.MonthEnd <= DateTime.Now).FirstOrDefault();
                    var lstGradePayrollByProfileID = lstGradePayroll.Where(s => s.Code == lstSalaryRankNew.Code).FirstOrDefault();
                    if (salGradeByProfileIDEntity != null)
                    {
                        if (salGradeByProfileIDEntity.GradePayrollID != lstGradePayrollByProfileID.ID)
                        {
                            var gradeEntity = new Sal_GradeEntity
                            {
                                //   ID = lstGradeByProfileID == null ? Guid.Empty : lstGradeByProfileID.ID,
                                ProfileID = contract.ProfileID,
                                GradePayrollID = lstGradePayrollByProfileID == null ? Guid.Empty : lstGradePayrollByProfileID.ID,
                                MonthStart = contract.DateSigned.Value,
                            };
                            message = gradeService.Add(gradeEntity);
                        }

                    }
                    else
                    {
                        var gradeEntity = new Sal_GradeEntity
                        {
                            //   ID = lstGradeByProfileID == null ? Guid.Empty : lstGradeByProfileID.ID,
                            ProfileID = contract.ProfileID,
                            GradePayrollID = lstGradePayrollByProfileID == null ? Guid.Empty : lstGradePayrollByProfileID.ID,
                            MonthStart = contract.DateSigned.Value,
                        };
                        message = gradeService.Add(gradeEntity);
                    }

                    #endregion

                    #region Att_Grade
                    var lstAttGradeByProfileID = lstAttGrade.Where(s => contract.ProfileID == s.ProfileID).ToList().OrderByDescending(s => s.MonthEnd <= DateTime.Now).FirstOrDefault();
                    var lstGradeAttByProfileID = lstGradeAtt.Where(s => s.Code == lstSalaryRankNew.Code).FirstOrDefault();
                    if (attGradeByProfileIDEntity != null)
                    {
                        if (attGradeByProfileIDEntity.GradeAttendanceID != lstGradeAttByProfileID.ID)
                        {
                            var gradeAttEntity = new Att_GradeEntity
                            {
                                // ID = lstGradeAttByProfileID == null ? Guid.Empty: lstAttGradeByProfileID.ID,
                                ProfileID = contract.ProfileID,
                                GradeAttendanceID = lstAttGradeByProfileID == null ? Guid.Empty : lstGradeAttByProfileID.ID,
                                MonthStart = contract.DateSigned.Value,
                            };
                            message = attGradeService.Add(gradeAttEntity);
                        }
                    }
                    else
                    {
                        var gradeAttEntity = new Att_GradeEntity
                        {
                            // ID = lstGradeAttByProfileID == null ? Guid.Empty: lstAttGradeByProfileID.ID,
                            ProfileID = contract.ProfileID,
                            GradeAttendanceID = lstGradeAttByProfileID == null ? Guid.Empty : lstGradeAttByProfileID.ID,
                            MonthStart = contract.DateSigned.Value,
                        };
                        message = attGradeService.Add(gradeAttEntity);
                    }


                    #endregion

                    #region Xử Lý Lương BHXH
                    if (contractTypeEntity.NoneTypeInsuarance == true)
                    {
                        var insuranceEntityByProfileID = lstInsurance.Where(s => s.ProfileID == contract.ProfileID && s.DateEffect == contract.DateEnd.Value.AddDays(1)).OrderByDescending(s => s.DateUpdate).FirstOrDefault();

                        var insuranceEntity = new Sal_InsuranceSalaryEntity
                        {
                            ProfileID = contract.ProfileID,
                            InsuranceAmount = lstSalaryRankNew.SalaryStandard,
                            DateEffect = contract.DateSigned != null ? contract.DateSigned.Value : DateTime.Now,
                            IsSocialIns = contractTypeEntity.IsSocialInsurance == null ? null : contractTypeEntity.IsSocialInsurance,
                            IsMedicalIns = contractTypeEntity.IsHealthInsurance == null ? null : contractTypeEntity.IsHealthInsurance,
                            IsUnimploymentIns = contractTypeEntity.IsUnEmployInsurance == null ? null : contractTypeEntity.IsUnEmployInsurance,
                            CurrencyID = lstCurrencyNew.ID
                        };
                        if (insuranceEntityByProfileID != null)
                        {
                            insuranceEntityByProfileID.InsuranceAmount = lstSalaryRankNew.SalaryStandard;
                            insuranceEntityByProfileID.IsSocialIns = contractTypeEntity.IsSocialInsurance == null ? null : contractTypeEntity.IsSocialInsurance;
                            insuranceEntityByProfileID.IsUnimploymentIns = contractTypeEntity.IsUnEmployInsurance == null ? null : contractTypeEntity.IsUnEmployInsurance;
                            insuranceEntityByProfileID.IsMedicalIns = contractTypeEntity.IsHealthInsurance == null ? null : contractTypeEntity.IsHealthInsurance;
                            message = insuranceServices.Edit(insuranceEntityByProfileID);
                        }
                        else
                        {
                            message = insuranceServices.Add(insuranceEntity);
                        }


                    }

                    if (contractTypeEntity.NoneTypeInsuarance == false)
                    {

                        var insuranceConfigEntity = lstInsuranceConfig.Where(s => s.ContractTypeID != null && s.ContractTypeID.Value == contractTypeEntity.ID).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                        if (insuranceConfigEntity != null)
                        {
                            var insuranceEntityByProfileID = lstInsurance.Where(s => s.ProfileID == contract.ProfileID && s.DateEffect == contract.DateEnd.Value.AddDays(1)).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                            var insuranceEntity = new Sal_InsuranceSalaryEntity
                            {
                                ProfileID = contract.ProfileID,
                                InsuranceAmount = lstSalaryRankNew.SalaryStandard,
                                DateEffect = contract.DateSigned != null ? contract.DateSigned.Value : DateTime.Now,
                                IsSocialIns = insuranceConfigEntity.IsSocial == null ? null : insuranceConfigEntity.IsSocial,
                                IsUnimploymentIns = insuranceConfigEntity.IsUnEmploy == null ? null : insuranceConfigEntity.IsUnEmploy,
                                IsMedicalIns = insuranceConfigEntity.IsHealth == null ? null : insuranceConfigEntity.IsHealth,
                                CurrencyID = lstCurrencyNew.ID
                            };

                            if (insuranceEntityByProfileID != null)
                            {
                                insuranceEntityByProfileID.InsuranceAmount = lstSalaryRankNew.SalaryStandard;
                                insuranceEntityByProfileID.IsSocialIns = insuranceConfigEntity.IsSocial == null ? null : insuranceConfigEntity.IsSocial;
                                insuranceEntityByProfileID.IsUnimploymentIns = insuranceConfigEntity.IsUnEmploy == null ? null : insuranceConfigEntity.IsUnEmploy;
                                insuranceEntityByProfileID.IsMedicalIns = insuranceConfigEntity.IsHealth == null ? null : insuranceConfigEntity.IsHealth;
                                message = insuranceServices.Edit(insuranceEntityByProfileID);
                            }
                            else
                            {
                                message = insuranceServices.Add(insuranceEntity);
                            }

                        }
                    }
                    #endregion
                }

                if (contract.ContractEvaType == EnumDropDown.ContractEvaType.E_ANNUAL_EVALUATION.ToString() && contract.ContractResult == EnumDropDown.ResultContract.PASS.ToString())
                {
                    var lstSalaryRankNew = new Cat_SalaryRankEntity();
                    if (contract.RankDetailForNextContract != null)
                    {
                        lstSalaryRankNew = lstSalaryRank.Where(s => contract.RankDetailForNextContract != null && s.ID == contract.RankDetailForNextContract.Value).FirstOrDefault();
                    }
                    else
                    {
                        lstSalaryRankNew = lstSalaryRank.Where(s => contract.RankRateID != null && s.ID == contract.RankRateID.Value).FirstOrDefault();
                    }

                    #region Xử lý Hre_Contract
                    int month = 0;
                    if (contractTypeEntity != null && contractTypeEntity.ValueTime != null)
                    {
                        month = (int)contractTypeEntity.ValueTime.Value;
                        if (contractTypeEntity.UnitTime == HRM.Infrastructure.Utilities.EnumDropDown.UnitType.E_YEAR.ToString())
                        {
                            month = month * 12;
                        }
                        contractTypeEntity.DateStart = contract.DateEnd.Value.AddDays(1);

                        //chưa tìm dc cách xử lý nên hard code 

                        var contractEntity = new Hre_ContractEntity
                        {
                            // ContractNo = getContractNo(item, item.DateSigned),
                            ProfileID = contract.ProfileID,
                            ProfileName = contract.ProfileName,
                            DateStart = new DateTime(DateTime.Now.Year, 6, 1),
                            DateSigned = new DateTime(DateTime.Now.Year, 6, 1),
                            JobTitleID = contract.JobTitleID,
                            PositionID = contract.PositionID,
                            DateEnd = contractTypeEntity.DateStart.Value.AddMonths(month),
                            Salary = lstSalaryRankNew == null ? 0 : lstSalaryRankNew.SalaryStandard,
                            RankRateID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.ID,
                            ClassRateID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID,
                            ClassRateName = lstSalaryRankNew == null ? string.Empty : lstSalaryRankNew.SalaryClassName,
                            SalaryRankName = lstSalaryRankNew == null ? string.Empty : lstSalaryRankNew.SalaryRankName,
                            ContractTypeID = contractTypeEntity.ID
                        };

                        //if (!string.IsNullOrEmpty(contractTypeEntity.Formula))
                        //{
                        //    contractEntity = SetNewDateEndContract(contractEntity);
                        //}
                        if (contract.DateEndNextContract != null)
                        {
                            contractEntity.DateEnd = contract.DateEndNextContract.Value;
                        }
                        contractEntity = SetNewCodeContract(contractEntity, listIdContract);

                        #region Nếu là loại hđ xác định thời hạn thì update lại cột TimesContract theo task 0049731
                        if (contracttypeByContract != null && contracttypeByContract.Type == HRM.Infrastructure.Utilities.EnumDropDown.TypeContract.E_DURATION.ToString())
                        {
                            try
                            {
                                string times = contractEntity.ContractNo.Substring(contractEntity.ContractNo.Length - 1, 1);
                                int Year = int.Parse(times);
                                contractEntity.TimesContract = Year;
                            }
                            catch
                            {
                            }
                        }
                        #endregion

                        contractEntity.Status = "E_APPROVED";
                        contractEntity.DateExtend = contract.DateEnd;
                        contractEntity.StatusEvaluation = "E_APPROVED";

                        if (!string.IsNullOrEmpty(contractEntity.ErrorMessage))
                        {
                            return string.Empty;
                        }
                        message = contractServices.Add(contractEntity);
                    }
                    else
                    {
                        contractTypeEntity.DateStart = contract.DateEnd.Value.AddDays(1);

                        //chưa tìm dc cách xử lý nên hard code 

                        var contractEntity = new Hre_ContractEntity
                        {
                            // ContractNo = getContractNo(item, item.DateSigned),
                            ProfileID = contract.ProfileID,
                            ProfileName = contract.ProfileName,
                            DateStart = new DateTime(DateTime.Now.Year, 6, 1),
                            DateSigned = new DateTime(DateTime.Now.Year, 6, 1),
                            JobTitleID = contract.JobTitleID,
                            PositionID = contract.PositionID,
                            // DateEnd = null,
                            Salary = lstSalaryRankNew == null ? 0 : lstSalaryRankNew.SalaryStandard,
                            RankRateID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.ID,
                            ClassRateID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID,
                            ClassRateName = lstSalaryRankNew == null ? string.Empty : lstSalaryRankNew.SalaryClassName,
                            SalaryRankName = lstSalaryRankNew == null ? string.Empty : lstSalaryRankNew.SalaryRankName,
                            ContractTypeID = contractTypeEntity.ID
                        };

                        //if (!string.IsNullOrEmpty(contractTypeEntity.Formula))
                        //{
                        //    contractEntity = SetNewDateEndContract(contractEntity);
                        //}

                        if (contract.DateEndNextContract != null)
                        {
                            contractEntity.DateEnd = contract.DateEndNextContract.Value;
                        }
                        contractEntity.DateExtend = contract.DateEnd;
                        contractEntity.StatusEvaluation = "E_APPROVED";
                        if (!string.IsNullOrEmpty(contractEntity.ErrorMessage))
                        {

                            return string.Empty;
                        }
                        message = contractServices.Add(contractEntity);
                    }
                    //Edit lai StatusEvaluation 
                    contract.StatusEvaluation = "E_APPROVED";
                    message = contractServices.Edit(contract);

                    #endregion

                    #region Xử Lý Sal_BasicSalary
                    var salaryEntity = new Sal_BasicSalaryEntity
                    {
                        ProfileID = contract.ProfileID,
                        ClassRateID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID,
                        RankRateID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.ID,
                        GrossAmount = lstSalaryRankNew == null ? string.Empty : lstSalaryRankNew.SalaryStandard.ToString(),
                        DateOfEffect = new DateTime(DateTime.Now.Year, 6, 1),
                        CurrencyID = lstCurrencyNew.ID,
                        Note = contract.Remark,
                        Status = "E_APPROVED"

                    };
                    message = basicSalaryService.Add(salaryEntity);

                    #endregion

                    #region Xử Lý Hre_Profile
                    var profileEntity = profile.CopyData<Hre_ProfileEntity>();
                    profileEntity.SalaryClassID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID;
                    Guid? _AbilityTileID = null;
                    if (profileEntity.SalaryClassID != null)
                    {
                        var abilityTitleBySalaryClass = actionService.GetData<Cat_AbilityTileEntity>(Common.DotNetToOracle(profileEntity.SalaryClassID.ToString()), ConstantSql.hrm_cat_sp_get_AbilityTileBySalaryClassId, ref status).FirstOrDefault();
                        if (abilityTitleBySalaryClass != null)
                        {
                            _AbilityTileID = abilityTitleBySalaryClass.ID;
                            profileEntity.AbilityTileID = _AbilityTileID;
                        }
                    }
                    message = hrService.Edit(profileEntity);
                    if (workingHistoryEntity != null)
                    {
                        if (workingHistoryEntity.SalaryClassID != lstSalaryRankNew.SalaryClassID)
                        {
                            var workhistoryEntity = new Hre_WorkHistoryEntity
                            {
                                ProfileID = contract.ProfileID,
                                SalaryClassID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID,
                                DateEffective = dateEnd != null ? dateEnd.Value.AddDays(1) : DateTime.Now,
                                AbilityTileID = _AbilityTileID,
                                Status = "E_APPROVED"
                            };
                            message = workhistoryService.Add(workhistoryEntity);
                        }
                    }
                    else
                    {
                        var workhistoryEntity = new Hre_WorkHistoryEntity
                        {
                            ProfileID = contract.ProfileID,
                            SalaryClassID = lstSalaryRankNew == null ? Guid.Empty : lstSalaryRankNew.SalaryClassID,
                            DateEffective = dateEnd != null ? dateEnd.Value.AddDays(1) : DateTime.Now,
                            Status = "E_APPROVED"

                        };
                        message = workhistoryService.Add(workhistoryEntity);
                    }
                    #endregion

                    #region Sal_Grade
                    var lstGradeByProfileID = lstSalGrade.Where(s => contract.ProfileID == s.ProfileID).ToList().OrderByDescending(s => s.MonthEnd <= DateTime.Now).FirstOrDefault();
                    var lstGradePayrollByProfileID = lstGradePayroll.Where(s => s.Code == lstSalaryRankNew.Code).FirstOrDefault();
                    if (salGradeByProfileIDEntity != null)
                    {
                        if (salGradeByProfileIDEntity.GradePayrollID != lstGradePayrollByProfileID.ID)
                        {
                            var gradeEntity = new Sal_GradeEntity
                            {
                                //   ID = lstGradeByProfileID == null ? Guid.Empty : lstGradeByProfileID.ID,
                                ProfileID = contract.ProfileID,
                                GradePayrollID = lstGradePayrollByProfileID == null ? Guid.Empty : lstGradePayrollByProfileID.ID,
                                MonthStart = new DateTime(DateTime.Now.Year, 6, 1),

                            };
                            message = gradeService.Add(gradeEntity);
                        }
                    }
                    else
                    {
                        var gradeEntity = new Sal_GradeEntity
                        {
                            //  ID = lstGradeByProfileID == null ? Guid.Empty : lstGradeByProfileID.ID,
                            ProfileID = contract.ProfileID,
                            GradePayrollID = lstGradePayrollByProfileID == null ? Guid.Empty : lstGradePayrollByProfileID.ID,
                            MonthStart = new DateTime(DateTime.Now.Year, 6, 1)
                        };
                        message = gradeService.Add(gradeEntity);
                    }


                    #endregion

                    #region Att_Grade
                    var lstAttGradeByProfileID = lstAttGrade.Where(s => contract.ProfileID == s.ProfileID).ToList().OrderByDescending(s => s.MonthEnd <= DateTime.Now).FirstOrDefault();
                    var lstGradeAttByProfileID = lstGradeAtt.Where(s => s.Code == lstSalaryRankNew.Code).FirstOrDefault();
                    if (attGradeByProfileIDEntity != null)
                    {
                        if (attGradeByProfileIDEntity.GradeAttendanceID != lstGradeAttByProfileID.ID)
                        {
                            var gradeAttEntity = new Att_GradeEntity
                            {
                                //ID = lstAttGradeByProfileID == null ? Guid.Empty: lstAttGradeByProfileID.ID,
                                ProfileID = contract.ProfileID,
                                GradeAttendanceID = lstGradeAttByProfileID == null ? Guid.Empty : lstGradeAttByProfileID.ID,
                                MonthStart = new DateTime(DateTime.Now.Year, 6, 1)
                            };
                            message = attGradeService.Add(gradeAttEntity);
                        }
                    }
                    else
                    {
                        var gradeAttEntity = new Att_GradeEntity
                        {
                            //ID = lstAttGradeByProfileID == null ? Guid.Empty: lstAttGradeByProfileID.ID,
                            ProfileID = contract.ProfileID,
                            GradeAttendanceID = lstGradeAttByProfileID == null ? Guid.Empty : lstGradeAttByProfileID.ID,
                            MonthStart = new DateTime(DateTime.Now.Year, 6, 1)
                        };
                        message = attGradeService.Add(gradeAttEntity);
                    }


                    #endregion

                    #region Xử Lý Lương BHXH
                    if (contractTypeEntity.NoneTypeInsuarance == true)
                    {
                        var insuranceEntityByProfileID = lstInsurance.Where(s => s.ProfileID == contract.ProfileID && s.DateEffect == contract.DateEnd.Value.AddDays(1)).OrderByDescending(s => s.DateUpdate).FirstOrDefault();

                        var insuranceEntity = new Sal_InsuranceSalaryEntity
                        {
                            ProfileID = contract.ProfileID,
                            InsuranceAmount = lstSalaryRankNew.SalaryStandard,
                            DateEffect = contract.DateEnd.Value.AddDays(1),
                            IsSocialIns = contractTypeEntity.IsSocialInsurance == null ? null : contractTypeEntity.IsSocialInsurance,
                            IsUnimploymentIns = contractTypeEntity.IsUnEmployInsurance == null ? null : contractTypeEntity.IsUnEmployInsurance,
                            IsMedicalIns = contractTypeEntity.IsHealthInsurance == null ? null : contractTypeEntity.IsHealthInsurance,
                            CurrencyID = lstCurrencyNew.ID,

                        };

                        if (insuranceEntityByProfileID != null)
                        {
                            insuranceEntityByProfileID.InsuranceAmount = lstSalaryRankNew.SalaryStandard;
                            insuranceEntityByProfileID.IsSocialIns = contractTypeEntity.IsSocialInsurance == null ? null : contractTypeEntity.IsSocialInsurance;
                            insuranceEntityByProfileID.IsUnimploymentIns = contractTypeEntity.IsUnEmployInsurance == null ? null : contractTypeEntity.IsUnEmployInsurance;
                            insuranceEntityByProfileID.IsMedicalIns = contractTypeEntity.IsHealthInsurance == null ? null : contractTypeEntity.IsHealthInsurance;
                            message = insuranceServices.Edit(insuranceEntityByProfileID);
                        }
                        else
                        {
                            message = insuranceServices.Add(insuranceEntity);
                        }
                    }
                    if (contractTypeEntity.NoneTypeInsuarance == false)
                    {
                        var insuranceConfigEntity = lstInsuranceConfig.Where(s => s.ContractTypeID != null && s.ContractTypeID.Value == contractTypeEntity.ID).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                        if (insuranceConfigEntity != null)
                        {
                            var insuranceEntityByProfileID = lstInsurance.Where(s => s.ProfileID == contract.ProfileID && s.DateEffect == contract.DateEnd.Value.AddDays(1)).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                            var insuranceEntity = new Sal_InsuranceSalaryEntity
                            {
                                ProfileID = contract.ProfileID,
                                InsuranceAmount = lstSalaryRankNew.SalaryStandard,
                                DateEffect = contract.DateEnd.Value.AddDays(1),
                                IsSocialIns = insuranceConfigEntity.IsSocial == null ? null : insuranceConfigEntity.IsSocial,
                                IsUnimploymentIns = insuranceConfigEntity.IsUnEmploy == null ? null : insuranceConfigEntity.IsUnEmploy,
                                IsMedicalIns = insuranceConfigEntity.IsHealth == null ? null : insuranceConfigEntity.IsHealth,
                                CurrencyID = lstCurrencyNew.ID
                            };
                            if (insuranceEntityByProfileID != null)
                            {
                                insuranceEntityByProfileID.InsuranceAmount = lstSalaryRankNew.SalaryStandard;
                                insuranceEntityByProfileID.IsSocialIns = insuranceConfigEntity.IsSocial == null ? null : insuranceConfigEntity.IsSocial;
                                insuranceEntityByProfileID.IsUnimploymentIns = insuranceConfigEntity.IsUnEmploy == null ? null : insuranceConfigEntity.IsUnEmploy;
                                insuranceEntityByProfileID.IsMedicalIns = insuranceConfigEntity.IsHealth == null ? null : insuranceConfigEntity.IsHealth;
                                message = insuranceServices.Edit(insuranceEntityByProfileID);
                            }
                            else
                            {
                                message = insuranceServices.Add(insuranceEntity);
                            }
                        }
                    }
                    #endregion

                }
            }

            return message;
            //   return null;
        }
コード例 #20
0
ファイル: Hre_GetDataController.cs プロジェクト: dtafe/vnr
 public ActionResult GetCandidateGeneralByProfileId(string ProfileIDs)
 {
     var service = new Hre_ProfileServices();
     var status = string.Empty;
     if (!string.IsNullOrEmpty(ProfileIDs))
     {
         var lstCandidateGeneral = service.GetData<Hre_CandidateGeneralEntity>(Common.DotNetToOracle(ProfileIDs), ConstantSql.hrm_hr_sp_get_CandidateGeneralByProfileID, UserLogin, ref status).ToList();
         if (lstCandidateGeneral != null && lstCandidateGeneral.Count >= 1)
         {
             var candidateByProfile = lstCandidateGeneral.FirstOrDefault();
             return Json(candidateByProfile, JsonRequestBehavior.AllowGet);
         }
     }
     return Json(string.Empty);
 }
コード例 #21
0
        public DataTable GetReportNotHaveSocial(DateTime? dateFrom, DateTime? dateTo, string OrgStructureID,string userLogin) 
        {
            using (var context = new VnrHrmDataContext())
            {
                string status = string.Empty;

                //string type_COLLECT_SOCIAL_INSURANCE = AppConfig.E_COLLECT_SOCIAL_INSURANCE.ToString();
                //bool _e_PROBATION_NoPay_INSURANCE = false;


                var profileServices = new Hre_ProfileServices();
                DataTable table = GetReportNotHaveSocialSchema();
                var lstObjProfile = new List<object>();
                lstObjProfile.Add(OrgStructureID);
                lstObjProfile.Add(null);
                lstObjProfile.Add(null);
                var lstProfile = profileServices.GetData<Hre_ProfileEntity>(lstObjProfile, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, userLogin, ref status).ToList();

                var gradePayrollService = new Cat_GradePayrollServices();
                var lstObjGradePayroll = new List<object>();
                lstObjGradePayroll.Add(null);
                lstObjGradePayroll.Add(null);
                lstObjGradePayroll.Add(1);
                lstObjGradePayroll.Add(int.MaxValue -1);

                var contractServices = new Hre_ContractServices();
                var lstObjContract = new List<object>();
                lstObjContract.AddRange(new object[15]);
                lstObjContract[13] = 1;
                lstObjContract[14] = int.MaxValue -1;


                var provinceServices = new Cat_ProvinceServices();
                var lstObjProvince = new List<object>();
                lstObjProvince.Add(null);
                lstObjProvince.Add(null);
                lstObjProvince.Add(null);
                lstObjProvince.Add(null);
                lstObjProvince.Add(null);
                lstObjProvince.Add(null);
                var lstProvince = provinceServices.GetData<Cat_ProvinceEntity>(lstObjProvince, ConstantSql.hrm_cat_sp_get_Province, userLogin, ref status).ToList();

                foreach (var item in lstProfile)
                {
                    DataRow dr = table.NewRow();
                    dr[Ins_ReportNotHaveSocialEntity.FieldNames.ID] = item.ID;
                    dr[Ins_ReportNotHaveSocialEntity.FieldNames.CodeEmp] = item.CodeEmp == null ? string.Empty : item.CodeEmp;
                    dr[Ins_ReportNotHaveSocialEntity.FieldNames.ProfileName] = item.ProfileName == null ? string.Empty : item.ProfileName;
                    dr[Ins_ReportNotHaveSocialEntity.FieldNames.E_DEPARTMENT] = item.OrgStructureName == null ? string.Empty : item.E_DEPARTMENT;
                    dr[Ins_ReportNotHaveSocialEntity.FieldNames.E_DIVISION] = item.OrgStructureName == null ? string.Empty : item.E_DIVISION;
                    dr[Ins_ReportNotHaveSocialEntity.FieldNames.E_SECTION] = item.OrgStructureName == null ? string.Empty : item.E_SECTION;
                    dr[Ins_ReportNotHaveSocialEntity.FieldNames.E_TEAM] = item.OrgStructureName == null ? string.Empty : item.E_TEAM;
                    dr[Ins_ReportNotHaveSocialEntity.FieldNames.E_UNIT] = item.OrgStructureName == null ? string.Empty : item.E_UNIT;
                    dr[Ins_ReportNotHaveSocialEntity.FieldNames.PositionName] = item.PositionName == null ? string.Empty : item.PositionName;
                    dr[Ins_ReportNotHaveSocialEntity.FieldNames.JobTitleName] = item.JobTitleName == null ? string.Empty : item.JobTitleName;
                    dr[Ins_ReportNotHaveSocialEntity.FieldNames.EthnicGroupName] = item.EthnicGroupName == null ? string.Empty : item.EthnicGroupName;
                    
                    dr[Ins_ReportNotHaveSocialEntity.FieldNames.HealthTreatmentPlace] = item.HealthTreatmentPlace == null ? string.Empty : item.HealthTreatmentPlace;
                    dr[Ins_ReportNotHaveSocialEntity.FieldNames.HealthTreatmentPlaceCode] = item.HealthTreatmentPlaceCode == null ? string.Empty : item.HealthTreatmentPlaceCode;

                    
                    var province = lstProvince.Where(s => s.ID == item.PlaceOfIssueID).FirstOrDefault();
                    if(province != null)
                    {
                        dr[Ins_ReportNotHaveSocialEntity.FieldNames.IDPOI_Code] = province.Code == null ? string.Empty : province.Code;
                        dr[Ins_ReportNotHaveSocialEntity.FieldNames.IDPOI] = province.ProvinceName == null ? string.Empty : province.ProvinceName;
                    }
                    dr[Ins_ReportNotHaveSocialEntity.FieldNames.Origin] = item.Origin == null ? string.Empty : item.Origin;
                    dr[Ins_ReportNotHaveSocialEntity.FieldNames.PAddress] = item.PAddress == null ? string.Empty : item.PAddress;
                    dr[Ins_ReportNotHaveSocialEntity.FieldNames.TAddress] = item.TAddress == null ? string.Empty : item.TAddress;
                    
                    if (item.DateHire != null)
                    {
                        dr[Ins_ReportNotHaveSocialEntity.FieldNames.DateHire] = item.DateHire.Value;
                    }
                    if (item.DateQuit != null)
                    {
                        dr[Ins_ReportNotHaveSocialEntity.FieldNames.DateHire] = item.DateQuit.Value;
                    }
                    if (item.DateOfBirth != null)
                    {
                        dr[Ins_ReportNotHaveSocialEntity.FieldNames.DateOfBirth] = item.DateOfBirth.Value;
                    }

                    var provinceTreatment = lstProvince.Where(s => s.ID == item.ProvinceInsuranceID).FirstOrDefault();
                    if (provinceTreatment != null)
                    {
                        dr[Ins_ReportNotHaveSocialEntity.FieldNames.PlaceOfTreatmentProvince] = provinceTreatment.Code == null ? string.Empty : provinceTreatment.Code;
                    }
                    table.Rows.Add(dr);

                }
                return table;
            }
            
        }
コード例 #22
0
ファイル: Att_RosterController.cs プロジェクト: dtafe/vnr
        public Att_RosterModel Post([Bind]Att_RosterModel model)
        {
            ActionService service = new ActionService(UserLogin);
            var baseService = new BaseService();
            string status = string.Empty;
            var hrService = new Hre_ProfileServices();
            string strMessages = string.Empty;
            var rosterService = new Att_RosterServices();
            var sysAllSetttingService = new Sys_AllSettingServices();
            #region Validate
            string message = string.Empty;
            var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Att_RosterModel>(model, "Att_Roster", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return model;
            }
            checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Att_RosterModel>(model, "Att_ProfileNotRoster", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return model;
            }
            if (string.IsNullOrEmpty(model.OrgStructureIDs) && string.IsNullOrEmpty(model.ProfileIds) && model.ProfileID == Guid.Empty)
            {
                message = string.Format(ConstantMessages.FieldNotAllowNull.TranslateString(), ("ProfileID").TranslateString());
                model.ActionStatus = message;
                return model;
            }
            #endregion

            List<Guid> lstProfileIDs = new List<Guid>();

            if(!string.IsNullOrEmpty(model.OrgStructureIDs))
            {
                List<object> listObj = new List<object>();
                listObj.Add(model.OrgStructureIDs);
                listObj.Add(string.Empty);
                listObj.Add(string.Empty);
                var lstProfile = hrService.GetData<Hre_ProfileEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure,UserLogin, ref status).Select(s => s.ID).ToList();
               lstProfileIDs.AddRange(lstProfile);
            }
            else if (model.ProfileIds != null && model.ProfileIds!="")
            {
               var listGuid = model.ProfileIds.Split(',').Select(s => Guid.Parse(s)).ToArray();
               lstProfileIDs.AddRange(listGuid);
            }
            var lstRosterEntity_Validate = new List<Att_RosterEntity>();
            foreach (var item in lstProfileIDs)
            {
                Att_RosterEntity rosterEntity = model.CopyData<Att_RosterEntity>();
                rosterEntity.ProfileID = item;
                if (rosterEntity.ID != null && rosterEntity.ID!= Guid.Empty)
                {
                }
                else
                {
                    rosterEntity.ID = Guid.NewGuid();
                }
                lstRosterEntity_Validate.Add(rosterEntity);
            }
            var key = AppConfig.HRM_ATT_ALLOWSAVEDUPLICATE.ToString();
            var lstSysAllSetting = sysAllSetttingService.GetData<Sys_AllSettingEntity>(key,ConstantSql.hrm_sys_sp_get_AllSettingByKey,UserLogin, ref status).FirstOrDefault();


            var ValidateLess12Hour = AppConfig.HRM_ATT_VALIDATE_ROSTER_NON_CONTINUE_12HOUR.ToString();
            var lstSysSetting_ValidateLess12Hour = sysAllSetttingService.GetData<Sys_AllSettingEntity>(ValidateLess12Hour, ConstantSql.hrm_sys_sp_get_AllSettingByKey,UserLogin, ref status).FirstOrDefault();
            if (lstSysSetting_ValidateLess12Hour != null && lstSysSetting_ValidateLess12Hour.Value1==bool.TrueString)
            {
                string Err = string.Empty;
                Err = rosterService.ValidateShiftHourContinue(lstRosterEntity_Validate);
                if (Err != string.Empty)
                {
                    model.SetPropertyValue(Constant.ActionStatus, NotificationType.Error + "," + Err);
                    return model;
                }
            }

            if (!string.IsNullOrEmpty(model.OrgStructureIDs))
            {
                List<object> listObj = new List<object>();
                listObj.Add(model.OrgStructureIDs);
                listObj.Add(string.Empty);
                listObj.Add(string.Empty);
                var lstProfile = hrService.GetData<Hre_ProfileEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure,UserLogin, ref status).Select(s => s.ID).ToList();
                if(lstProfile.Count==0 || lstProfile == null)
                {
                    model.SetPropertyValue(Constant.ActionStatus, NotificationType.Info + "," + strMessages + ConstantMessages.FieldDuplicate);
                    return model;
                }
                if(lstProfile != null && model.ProfileIds != null)
                {
                        Guid[] listGuid = null;
                        listGuid = model.ProfileIds.Split(',').Select(s => Guid.Parse(s)).ToArray();
                        lstProfile = lstProfile.Where(s => !listGuid.Contains(s)).ToList();
                }
                List<Att_RosterEntity> lstRosterEntity = new List<Att_RosterEntity>();
                List<object> paraRoster = new List<object>();
                paraRoster.AddRange(new object[4]);
                paraRoster[0]=(object)model.OrgStructureIDs;
                paraRoster[1]=null;
                paraRoster[2]=null;
                paraRoster[3]=null;
                var listRosterData = rosterService.GetData<Att_RosterEntity>(paraRoster, ConstantSql.hrm_att_getdata_Roster,UserLogin, ref status);
                foreach (var item in lstProfile)
                {
                    Att_RosterModel modelSave = model.CopyData<Att_RosterModel>();
                    var listRoster = listRosterData.Where(s => s.ProfileID == item);
                    if (modelSave.Type != RosterType.E_CHANGE_SHIFT.ToString()
                        && modelSave.Type != RosterType.E_TIME_OFF.ToString() 
                        && listRoster != null 
                        && listRoster.Any(d => d.DateStart <= model.DateEnd && d.DateEnd >= model.DateStart))
                    {
                        strMessages += listRoster.FirstOrDefault().ProfileName + ", ";
                        continue;
                    }
                    modelSave.ProfileID = item;
                    Att_RosterEntity rosterEntity = modelSave.CopyData<Att_RosterEntity>();
                    lstRosterEntity.Add(rosterEntity);
                }
                if (strMessages == "" && lstRosterEntity.Count > 0)
                {
                    model.ActionStatus = rosterService.Add(lstRosterEntity);
                }
                else
                {
                    if (lstSysAllSetting != null && lstSysAllSetting.Value1 == bool.TrueString && lstRosterEntity.Count > 0)
                    {
                        model.ActionStatus = rosterService.Add(lstRosterEntity);
                    }
                    else if (lstSysAllSetting.Value1 == bool.FalseString)
                    {
                        model.SetPropertyValue(Constant.ActionStatus, NotificationType.Error + "," + strMessages + ConstantMessages.FieldDuplicate);
                        return model;
                    }
                    else if(lstRosterEntity.Count == 0)
                    {
                        model.SetPropertyValue(Constant.ActionStatus, NotificationType.Info + "," + strMessages + ConstantMessages.FieldDuplicate);
                        return model;
                    }
                }
                return model;
            }
            //Xử lý khi chọn nhiều nhân viên
            if (model.ProfileIds != null && model.ProfileIds.IndexOf(',') > 0 && model.OrgStructureIDs == null)
            {
                Guid[] listGuid = null;
                listGuid = model.ProfileIds.Split(',').Select(s => Guid.Parse(s)).ToArray();
                List<Att_RosterEntity> lstRosterEntity = new List<Att_RosterEntity>();
                foreach (var item in listGuid)
                {
                    Att_RosterModel modelSave = model.CopyData<Att_RosterModel>();
                    var listRoster = service.GetData<Att_RosterEntity>(item, ConstantSql.hrm_att_sp_get_RosterByProfileId, ref status);
                    if (modelSave.Type != RosterType.E_CHANGE_SHIFT.ToString()
                        && modelSave.Type != RosterType.E_TIME_OFF.ToString()
                        && listRoster != null
                        && listRoster.Any(d => d.DateStart <= model.DateEnd && d.DateEnd >= model.DateStart))
                    {
                        strMessages += listRoster.FirstOrDefault().ProfileName + ", ";
                        continue;
                    }
                    modelSave.ProfileID = item;
                    Att_RosterEntity rosterEntity = modelSave.CopyData<Att_RosterEntity>();
                    lstRosterEntity.Add(rosterEntity);
                }
                if(strMessages == "")
                {
                    model.ActionStatus = rosterService.Add(lstRosterEntity);
                }
                else
                {
                    if (lstSysAllSetting != null && lstSysAllSetting.Value1 == bool.TrueString)
                    {
                        model.ActionStatus = rosterService.Add(lstRosterEntity);
                    }
                    else
                    {
                        model.SetPropertyValue(Constant.ActionStatus, NotificationType.Error + "," + strMessages + ConstantMessages.FieldDuplicate);
                        return model;
                    }
                }
                return model;
            }
            //Xử lý khi chỉ chọn 1 nhân viên
            if(model.ID == Guid.Empty){
                var lstRoster = service.GetData<Att_RosterEntity>(model.ProfileID, ConstantSql.hrm_att_sp_get_RosterByProfileId, ref status);
                if (model.Type != RosterType.E_CHANGE_SHIFT.ToString()
                    && model.Type != RosterType.E_TIME_OFF.ToString()
                    && lstRoster != null 
                    && lstRoster.Any(d => d.DateStart <= model.DateEnd && d.DateEnd >= model.DateStart))
                {
                    strMessages = lstRoster.FirstOrDefault().ProfileName + ",";
                    model.SetPropertyValue(Constant.ActionStatus, NotificationType.Error + "," + strMessages + ConstantMessages.FieldDuplicate);
                    return model;
                }
                return service.UpdateOrCreate<Att_RosterEntity, Att_RosterModel>(model);
            }
            return service.UpdateOrCreate<Att_RosterEntity, Att_RosterModel>(model);
        }
コード例 #23
0
ファイル: Hre_ReportServices.cs プロジェクト: dtafe/vnr
        public DataTable GetReportProfileNew(DateTime from, DateTime to, string orderNumber, 
            bool IsCreateTemplate, string codeemp, string profilename, Guid? Salaryclassid, 
            string codeCandidate, Guid? workPlaceID, Guid? emptypeID, string userLogin)
        {
            DataTable table = CreateProfileNewSchema();
            if (IsCreateTemplate)
            {
                return table;
            }
            using (var context = new VnrHrmDataContext())
            {
                string status = string.Empty;
                //var orgTypeServices = new Cat_OrgStructureTypeServices();
                //var objOrgType = new List<object>();
                //objOrgType.Add(null);
                //objOrgType.Add(null);
                //objOrgType.Add(1);
                //objOrgType.Add(int.MaxValue - 1);
                //var lstOrgType = orgTypeServices.GetData<Cat_OrgStructureTypeEntity>(objOrgType, ConstantSql.hrm_cat_sp_get_OrgStructureType, ref status).ToList().Translate<Cat_OrgStructureType>();

                //var orgServices = new Cat_OrgStructureServices();
                //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, ref status).ToList().Translate<Cat_OrgStructure>();

                var hrService = new Hre_ProfileServices();
                List<object> listObj = new List<object>();
                listObj.Add(orderNumber);
                listObj.Add(from);
                listObj.Add(to);
                listObj.Add(codeemp);
                listObj.Add(profilename);
                listObj.Add(Salaryclassid);
                listObj.Add(codeCandidate);
                listObj.Add(workPlaceID);
                listObj.Add(emptypeID);
                var lstProfile = hrService.GetData<Hre_ReportProfileNewEntity>(listObj, ConstantSql.hrm_hr_sp_get_RptProfileNew, userLogin, ref status).ToList();

                foreach (var item in lstProfile)
                {
                    DataRow dr = table.NewRow();
                    //Guid? orgId = item.OrgStructureID;
                    //var org = lstOrg.FirstOrDefault(s => s.ID == item.OrgStructureID);
                    //var orgBranch = LibraryService.GetNearestParent(orgId, OrgUnit.E_BRANCH, lstOrg, lstOrgType);
                    //var orgOrg = LibraryService.GetNearestParent(orgId, OrgUnit.E_DEPARTMENT, lstOrg, lstOrgType);
                    //var orgTeam = LibraryService.GetNearestParent(orgId, OrgUnit.E_TEAM, lstOrg, lstOrgType);
                    //var orgSection = LibraryService.GetNearestParent(orgId, OrgUnit.E_SECTION, lstOrg, lstOrgType);
                    dr[Hre_ReportProfileNewEntity.FieldNames.CodeEmp] = item.CodeEmp;
                    dr[Hre_ReportProfileNewEntity.FieldNames.ProfileName] = item.ProfileName;
                    dr[Hre_ReportProfileNewEntity.FieldNames.PositionName] = item.PositionName;
                    dr[Hre_ReportProfileNewEntity.FieldNames.JobTitleName] = item.PositionName;
                    //dr[Hre_ReportProfileNewEntity.FieldNames.OrgStructureName] = item.OrgStructureName;
                    dr[Hre_ReportProfileNewEntity.FieldNames.DateHire] = item.DateHire;
                    dr[Hre_ReportProfileNewEntity.FieldNames.IDNo] = item.IDNo;
                    dr[Hre_ReportProfileNewEntity.FieldNames.IDPlaceOfIssue] = item.IDPlaceOfIssue;
                    if (item.IDDateOfIssue != null)
                    {
                        dr[Hre_ReportProfileNewEntity.FieldNames.IDDateOfIssue] = item.IDDateOfIssue;
                    }

                    dr[Hre_ReportProfileNewEntity.FieldNames.Gender] = item.Gender;
                    dr[Hre_ReportProfileNewEntity.FieldNames.PAStreet] = item.PAStreet;
                    dr[Hre_ReportProfileNewEntity.FieldNames.SalaryClassName] = item.SalaryClassName;
                    dr[Hre_ReportProfileNewEntity.FieldNames.EducationLevelName] = item.EducationLevelName;
                    dr[Hre_ReportProfileNewEntity.FieldNames.GraduatedLevelName] = item.GraduatedLevelName;
                    if (item.DepartmentNameOrg != null)
                        dr[Hre_ReportProfileNewEntity.FieldNames.DepartmentNameOrg] = item.DepartmentNameOrg;
                    if (item.UnitNameOrg != null)
                        dr[Hre_ReportProfileNewEntity.FieldNames.UnitNameOrg] = item.UnitNameOrg;
                    if (item.DivisionNameOrg != null)
                        dr[Hre_ReportProfileNewEntity.FieldNames.DivisionNameOrg] = item.DivisionNameOrg;
                    if (item.SectionNameOrg != null)
                        dr[Hre_ReportProfileNewEntity.FieldNames.SectionNameOrg] = item.SectionNameOrg;
                    dr[Hre_ReportProfileNewEntity.FieldNames.DateOfBirth] = item.DateOfBirth;
                    dr[Hre_ReportProfileNewEntity.FieldNames.PlaceOfBirth] = item.PlaceOfBirth;
                    dr[Hre_ReportProfileNewEntity.FieldNames.PAddress] = item.PAddress;
                    dr[Hre_ReportProfileNewEntity.FieldNames.StatusSyn] = item.StatusSyn;
                    dr[Hre_ReportProfileNewEntity.FieldNames.EmployeeTypeName] = item.EmployeeTypeName;
                    dr[Hre_ReportProfileNewEntity.FieldNames.DateFrom] = from;
                    dr[Hre_ReportProfileNewEntity.FieldNames.DateTo] = to;

                    dr[Hre_ReportProfileNewEntity.FieldNames.E_UNIT] = item.E_UNIT;

                    dr[Hre_ReportProfileNewEntity.FieldNames.E_DIVISION] = item.E_DIVISION;

                    dr[Hre_ReportProfileNewEntity.FieldNames.E_DEPARTMENT] = item.E_DEPARTMENT;


                    dr[Hre_ReportProfileNewEntity.FieldNames.E_TEAM] = item.E_TEAM;


                    dr[Hre_ReportProfileNewEntity.FieldNames.E_SECTION] = item.E_SECTION;

                    dr[Hre_ReportProfileNewEntity.FieldNames.datequit] = item.datequit;
                    dr[Hre_ReportProfileNewEntity.FieldNames.EthnicGroupName] = item.EthnicGroupName;
                    dr[Hre_ReportProfileNewEntity.FieldNames.ContractNo] = item.ContractNo;
                    dr[Hre_ReportProfileNewEntity.FieldNames.DateStart] = item.DateStart;
                    dr[Hre_ReportProfileNewEntity.FieldNames.Code] = item.Code;
                    dr[Hre_ReportProfileNewEntity.FieldNames.InsuranceAmount] = item.InsuranceAmount;
                    dr[Hre_ReportProfileNewEntity.FieldNames.E_MaleBirth] = item.E_MaleBirth;
                    dr[Hre_ReportProfileNewEntity.FieldNames.E_FeMaleBirth] = item.E_FeMaleBirth;
                    dr[Hre_ReportProfileNewEntity.FieldNames.E_ProfileCount] = item.E_ProfileCount;
                    dr[Hre_ReportProfileNewEntity.FieldNames.E_ProfileIsWorking] = item.E_ProfileIsWorking;
                    dr[Hre_ReportProfileNewEntity.FieldNames.E_FEMALE] = item.E_FEMALE;
                    dr[Hre_ReportProfileNewEntity.FieldNames.E_MALE] = item.E_MALE;
                    dr[Hre_ReportProfileNewEntity.FieldNames.ProfileNew] = item.ProfileNew;
                    dr[Hre_ReportProfileNewEntity.FieldNames.E_Profile_FEMALE] = item.E_Profile_FEMALE;
                    dr[Hre_ReportProfileNewEntity.FieldNames.E_Profile_MALE] = item.E_Profile_MALE;
                    dr[Hre_ReportProfileNewEntity.FieldNames.PProvinceName] = item.PProvinceName;
                    dr[Hre_ReportProfileNewEntity.FieldNames.E_GrossAmount] = item.E_GrossAmount;
                    dr[Hre_ReportProfileNewEntity.FieldNames.GrossAmount_Old] = item.GrossAmount_Old;
                    dr[Hre_ReportProfileNewEntity.FieldNames.GrossAmount_Now] = item.GrossAmount_Now;

                    table.Rows.Add(dr);
                }

                return table;
            }
        }
コード例 #24
0
ファイル: PersonalController.cs プロジェクト: dtafe/vnr
        public JsonResult CreateContactInfo(Hre_ProfileModel model, string userLogin)
        {
            var id = Session[SessionObjects.ProfileID];
            var serv = new Hre_ProfileServices();
            string status = string.Empty;
            var profile = serv.GetData<Hre_ProfileModel>(HRM.Infrastructure.Utilities.Common.DotNetToOracle(id.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();

            bool change = false;
            #region check change
            if (profile.Email != model.Email)
                change = true;
            if (profile.Email2 != model.Email2)
                change = true;
            if (profile.Cellphone != model.Cellphone)
                change = true;
            if (profile.HomePhone != model.HomePhone)
                change = true;

            if (profile.TCountryID != model.TCountryID)
                change = true;
            if (profile.TDistrictID != model.TDistrictID)
                change = true;

            if (profile.TProvinceID != model.TProvinceID)
                change = true;

            if (profile.TAVillageID != model.TAVillageID)
                change = true;

            if (profile.TAddress != model.TAddress)
                change = true;



            if (profile.PCountryID != model.PCountryID)
                change = true;
            if (profile.PDistrictID != model.PDistrictID)
                change = true;

            if (profile.PProvinceID != model.PProvinceID)
                change = true;

            if (profile.VillageID != model.VillageID)
                change = true;

            if (profile.PAddress != model.PAddress)
                change = true;

            if (profile.AddressEmergency != model.AddressEmergency)
                change = true;
            
            #endregion

            if (!change)
            {
                profile.ActionStatus = "Success";
                return Json(profile);
            }
            if (profile.ID == model.ID)
            {
                profile.ActionStatus = model.ActionStatus;
                profile.Email = model.Email;
                profile.Email2 = model.Email2;
                profile.Cellphone = model.Cellphone;
                profile.HomePhone = model.HomePhone;
                profile.TCountryID = model.TCountryID;
                profile.TDistrictID = model.TDistrictID;
                profile.TProvinceID = model.TProvinceID;
                profile.TAVillageID = model.TAVillageID;
                profile.TAddress = model.TAddress;
                profile.PCountryID = model.PCountryID;
                profile.PDistrictID = model.PDistrictID;
                profile.PProvinceID = model.PProvinceID;
                profile.VillageID = model.VillageID;
                profile.PAddress = model.PAddress;
                profile.AddressEmergency = model.AddressEmergency;
            }

            var service = new RestServiceClient<Hre_ProfileModel>(UserLogin);
            service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
            var result = service.Post(_Hrm_Hre_Service, "api/Hre_Profile/", profile);
            return Json(result);
        }
コード例 #25
0
        public Tra_RequirementTrainModel Post([Bind]Tra_RequirementTrainModel model)
        {
            #region Validate
            if(model.isAnalysis==true)
            {
                string message = string.Empty;
                var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Tra_RequirementTrainModel>(model,"Tra_RequirementTrain_Tab", "Tra_RequirementTrain", ref message);
                if (!checkValidate)
                {
                    model.ActionStatus = message;
                    return model;
                }
            }
            #endregion

            var requirementDetailServices = new Tra_RequirementTrainDetailServices();
            var profileServices = new Hre_ProfileServices();
             string[] arrCodeEmp = new string[1];
             if (!string.IsNullOrEmpty(model.lstCodeEmp) && model.lstCodeEmp.IndexOf(',') > 1)
             {
                 arrCodeEmp = model.lstCodeEmp.Split(',').ToArray();
             }
             else {
                 arrCodeEmp[0] = model.lstCodeEmp;
             }
        
            ActionService service = new ActionService(UserLogin);
            string status = string.Empty;
            //var objProfile = new List<object>();
            //objProfile.AddRange(new object[17]);
            //objProfile[15] = 1;
            //objProfile[16] = int.MaxValue - 1;
            //var lstProfile = profileServices.GetData<Hre_ProfileEntity>(objProfile, ConstantSql.hrm_hr_sp_get_ProfileAll, UserLogin, ref status).ToList().Translate<Hre_ProfileModel>();
            //if (arrCodeEmp != null)
            //{
            //    lstProfile = lstProfile.Where(s => arrCodeEmp.Contains(s.CodeEmp)).ToList();
            //}
            var lstProfile = profileServices.GetData<Hre_ProfileEntity>(model.lstCodeEmp, ConstantSql.hrm_hr_sp_get_ProfileAllByCodeEmps, UserLogin, ref status).ToList().Translate<Hre_ProfileModel>();

            model = service.UpdateOrCreate<Tra_RequirementTrainEntity, Tra_RequirementTrainModel>(model);

            var objRequirementDetail = new List<object>();
            objRequirementDetail.Add(null);
            objRequirementDetail.Add(1);
            objRequirementDetail.Add(int.MaxValue -1);
            var lstRequirementDetail = requirementDetailServices.GetData<Tra_RequirementTrainDetailEntity>(objRequirementDetail,ConstantSql.hrm_tra_sp_get_RequirementDetail,UserLogin,ref status).ToList();
            foreach (var item in lstProfile)
            {
               
                var entity = lstRequirementDetail.Where(s => s.ProfileID == item.ID && s.RequirementTrainID == model.ID && s.CourseID == model.CourseID).FirstOrDefault();
             
                var requirementDetailEntity = new Tra_RequirementTrainDetailEntity();
                requirementDetailEntity.ProfileID = item.ID;
                requirementDetailEntity.RequirementTrainID = model.ID;
                requirementDetailEntity.CourseID = model.CourseID;
                requirementDetailEntity.YearAnalyze = model.DateSeniority;
                if (item.DateHire != null && model.DateSeniority != null)
                {
                    requirementDetailEntity.Seniority = Math.Floor(model.DateSeniority.Value.Subtract(item.DateHire.Value).TotalDays/30);
                }
                if (entity == null)
                {
                    model.ActionStatus = requirementDetailServices.Add(requirementDetailEntity);
                }
            }

            return model;
            //return service.UpdateOrCreate<Tra_RequirementTrainEntity, Tra_RequirementTrainModel>(model);
        }
コード例 #26
0
ファイル: Tra_ReportServices.cs プロジェクト: dtafe/vnr
        public DataTable GetReportTraineeJoinCoursePass(Guid[] courseIds, string orderNumber, bool IsCreateTemplate, Guid[] RequirementTrainIDs, string UserLogin)
        {

            DataTable table = CreateReportTraineeJoinCoursePassSchema();
            if (IsCreateTemplate)
            {
                return table;
            }
            using (var context = new VnrHrmDataContext())
            {
                string status = string.Empty;

                var profileServices = new Hre_ProfileServices();
                var objProfile = new List<object>();
                objProfile.Add(orderNumber);
                objProfile.Add(null);
                objProfile.Add(null);
                //var lstProfile = profileServices.GetData<Hre_ProfileEntity>(objProfile, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).ToList();

                var lstProfile = profileServices.GetData<Hre_ProfileEntity>(objProfile, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgN, UserLogin, ref status).ToList();
                var lstProfileID = lstProfile.Select(s => s.ID).ToList();
                //var orgsService = new Cat_OrgStructureServices();
                //var objOrg = new List<object>();
                //objOrg.AddRange(new object[5]);
                //objOrg[3] = 1;
                //objOrg[4] = int.MaxValue - 1;
                //var lstallorgs = orgsService.GetData<Cat_OrgStructureEntity>(objOrg, ConstantSql.hrm_cat_sp_get_OrgStructure, ref status).ToList();

                //var courseServices = new Tra_CourseServices();
                //var objCourse = new List<object>();
                //objCourse.AddRange(new object[11]);
                //objCourse[9] = 1;
                //objCourse[10] = int.MaxValue - 1;
                //var lstCourse = courseServices.GetData<Tra_CourseEntity>(objCourse, ConstantSql.hrm_tra_sp_get_Course, ref status).ToList();
                //if (courseIds != null)
                //{
                //    lstCourse = lstCourse.Where(s => courseIds.Contains(s.ID)).ToList();
                //}
                //if (RequirementTrainIDs != null)
                //{

                //    lstCourse = lstCourse.Where(s => s.RequirementTrainID != null && RequirementTrainIDs.Contains((Guid)s.RequirementTrainID)).ToList();
                //}

                var requirmentDetailServices = new Tra_RequirementTrainDetailServices();
                var objRequirementDetail = new List<object>();
                objRequirementDetail.Add(null);
                objRequirementDetail.Add(1);
                objRequirementDetail.Add(int.MaxValue - 1);
                var lstRequirementDetail = requirmentDetailServices.GetData<Tra_RequirementTrainDetailEntity>(objRequirementDetail, ConstantSql.hrm_tra_sp_get_RequirementDetail, UserLogin, ref status).ToList();

                if (RequirementTrainIDs != null)
                {
                    lstRequirementDetail = lstRequirementDetail.Where(s => s.RequirementTrainID != null && RequirementTrainIDs.Contains(s.RequirementTrainID.Value)).ToList();
                }
                
                if(courseIds != null)
                {
                    lstRequirementDetail = lstRequirementDetail.Where(s => s.CourseID != null && courseIds.Contains(s.CourseID.Value)).ToList();
                }

                var traineeServices = new Tra_TraineeServices();
                var objTrainee = new List<object>();
                objTrainee.AddRange(new object[15]);
                objTrainee[13] = 1;
                objTrainee[14] = int.MaxValue - 1;
                var lstTrainee = traineeServices.GetData<Tra_TraineeEntity>(objTrainee, ConstantSql.hrm_tra_sp_get_Trainee, UserLogin, ref status).ToList();

                if (courseIds != null)
                {
                    lstTrainee = lstTrainee.Where(s => courseIds.Contains(s.CourseID)).ToList();
                }

                lstTrainee = lstTrainee.Where(s => lstProfileID.Contains(s.ProfileID)).ToList();

                var lstClassIDByTrainee = lstTrainee.Select(s =>  s.ClassID).ToList();

                var lstTraineeByProfileID = lstTrainee.Select(s => s.ProfileID).ToList();

                var lstCourseId = lstTrainee.Select(s => s.CourseID).ToList();

                if (lstTraineeByProfileID.Count > 0)
                {
                    lstRequirementDetail = lstRequirementDetail.Where(s => s.CourseID != null && s.ClassID != null && s.ProfileID != null && lstTraineeByProfileID.Contains(s.ProfileID.Value) && lstClassIDByTrainee.Contains(s.ClassID.Value) && lstCourseId.Contains(s.CourseID.Value)).ToList();
                }

                foreach (var item in lstRequirementDetail)
                {
                    DataRow dr = table.NewRow();

                    dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.CodeEmp] = item.CodeEmp;
                    dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.TraineeName] = item.ProfileName;
                    dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.CourseName] = item.CourseName;
                    dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.E_DEPARTMENT] = item.E_DEPARTMENT;
                    dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.E_DIVISION] = item.E_DIVISION;
                    dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.E_SECTION] = item.E_SECTION;
                    dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.E_TEAM] = item.E_TEAM;
                    dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.E_UNIT] = item.E_UNIT;
                    dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.JobTitleName] = item.JobTitleName;
                    dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.PositionName] = item.PositionName;
                    dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.Note] = item.Comment;
                    dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.RequirementTrainName] = item.RequirementTrainName;
                    if (item.Seniority != null)
                        dr[Tra_ReportTraineeJoinCourseEntity.FieldNames.Seniority] = item.Seniority;
                    table.Rows.Add(dr);
                } 

            }

            return table;

        }
コード例 #27
0
        public Sal_InsuranceSalaryModel Post([Bind]Sal_InsuranceSalaryModel model)
        {
            #region Validate

            ActionService service = new ActionService(UserLogin);
            string message = string.Empty;
            bool checkValidate = true;
            if (model.IsCreateByProfile != null && model.IsCreateByProfile == true)
            {
                checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_InsuranceSalaryModel>(model, "Sal_InsuranceSalaryByProfile", ref message);
                if (!checkValidate)
                {
                    model.ActionStatus = message;
                    return model;
                }
                return service.UpdateOrCreate<Sal_InsuranceSalaryEntity, Sal_InsuranceSalaryModel>(model);
            }

            //var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_InsuranceSalaryModel>(model, "Sal_InsuranceSalary", ref message);
            if (model.OrgStructureID != null && model.OrgStructureID != string.Empty)
            {
                checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_InsuranceSalaryModel>(model, "Sal_InsuranceSalaryOrgStructure", ref message);
            }
            else
            {
                checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_InsuranceSalaryModel>(model, "Sal_InsuranceSalary", ref message);
            }
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return model;
            }
            #endregion

            string status = string.Empty;

            var hrService = new Hre_ProfileServices();
            var insuranceServices = new Sal_InsuranceSalaryServices();
            if (!string.IsNullOrEmpty(model.OrgStructureID))
            {
                List<Guid> listGuid = new List<Guid>();
                if (model.ProfileIDsExclude != null)
                {
                    var listStr = model.ProfileIDsExclude.Split(',');

                    if (listStr[0] != "")
                    {

                        foreach (var item in listStr)
                        {
                            listGuid.Add(Guid.Parse(item));
                        }
                    }
                }


                List<object> listObj = new List<object>();
                listObj.Add(model.OrgStructureID);
                listObj.Add(string.Empty);
                listObj.Add(string.Empty);
                var lstProfile = hrService.GetData<Hre_ProfileIdEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure, userLogin, ref status).Select(s => s.ID).ToList();
                if (listGuid != null)
                {
                    lstProfile = lstProfile.Where(s => !listGuid.Contains(s)).ToList();
                }

                if (lstProfile.Count == 0 && model.ProfileID == Guid.Empty)
                {
                    model.ActionStatus = ConstantDisplay.HRM_Common_NotEmployee.TranslateString();
                    return model;
                }

                List<Sal_InsuranceSalaryEntity> lstGradeEntity = new List<Sal_InsuranceSalaryEntity>();

                foreach (var item in lstProfile)
                {
                    Sal_InsuranceSalaryEntity gradeEntity = new Sal_InsuranceSalaryEntity
                    {
                        ProfileID = item,
                        DateCreate = model.DateCreate,
                        DateLock = model.DateLock,
                        CurrencyID = model.CurrencyID,
                        InsuranceAmount = model.InsuranceAmount,
                        ID = model.ID,
                        DateEffect = model.DateEffect,
                        IsSocialIns = model.IsSocialIns,
                        IsMedicalIns = model.IsMedicalIns,
                        IsUnimploymentIns = model.IsUnimploymentIns,
                        IsDelete = model.IsDelete,
                        UserUpdate = model.UserCreate,
                        UserCreate = model.UserCreate,
                        DecisionNo = model.DecisionNo
                    };
                    //model.ActionStatus =  gradeServices.Add(gradeEntity);
                    lstGradeEntity.Add(gradeEntity);
                }
                model.ActionStatus = insuranceServices.Add(lstGradeEntity);
                return model;
            }
            if (!string.IsNullOrEmpty(model.ProfileIDs))
            {
                var listStr = model.ProfileIDs.Split(',');
                List<Guid> listGuid = new List<Guid>();
                if (listStr[0] != "")
                {
                    foreach (var item in listStr)
                    {
                        listGuid.Add(Guid.Parse(item));
                    }
                }
                List<Sal_InsuranceSalaryEntity> lstGradeEntity = new List<Sal_InsuranceSalaryEntity>();
                foreach (var item in listGuid)
                {
                    Sal_InsuranceSalaryEntity gradeEntity = new Sal_InsuranceSalaryEntity
                    {
                        ProfileID = item,
                        DateCreate = model.DateCreate,
                        DateLock = model.DateLock,
                        CurrencyID = model.CurrencyID,
                        InsuranceAmount = model.InsuranceAmount,
                        ID = model.ID,
                        DateEffect = model.DateEffect,
                        IsSocialIns = model.IsSocialIns,
                        IsMedicalIns = model.IsMedicalIns,
                        IsUnimploymentIns = model.IsUnimploymentIns,
                        IsDelete = model.IsDelete,
                        UserUpdate = model.UserCreate,
                        UserCreate = model.UserCreate,
                        DecisionNo = model.DecisionNo
                    };
                    //model.ActionStatus =  gradeServices.Add(gradeEntity);
                    lstGradeEntity.Add(gradeEntity);
                }
                model.ActionStatus = insuranceServices.Add(lstGradeEntity);
                return model;
            }

            return service.UpdateOrCreate<Sal_InsuranceSalaryEntity, Sal_InsuranceSalaryModel>(model);
        }
コード例 #28
0
ファイル: PersonalController.cs プロジェクト: dtafe/vnr
        public JsonResult CreateBasicInfo(Hre_ProfileModel model, string userLogin)
        {
            var id = Session[SessionObjects.ProfileID];
            var serv = new Hre_ProfileServices();
            string status = string.Empty;
            var profile = serv.GetData<Hre_ProfileModel>(HRM.Infrastructure.Utilities.Common.DotNetToOracle(id.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();

            bool change = false;
            #region check change
            if (profile.ProfileName != model.ProfileName)
                change = true;
            if (profile.CodeAttendance != model.CodeAttendance)
                change = true;
            if (profile.CodeEmp != model.CodeEmp)
                change = true;
            if (profile.DateApplyAttendanceCode != model.DateApplyAttendanceCode)
                change = true;
            if (profile.WorkPlaceName != model.WorkPlaceName)
                change = true;
            if (profile.CodeTax != model.CodeTax)
                change = true;
            if (profile.DateOfIssuedTaxCode != model.DateOfIssuedTaxCode)
                change = true;
            if (profile.DateHire != model.DateHire)
                change = true;
            if (profile.DateEndProbation != model.DateEndProbation)
                change = true;
            if (profile.JobTitleID != model.JobTitleID)
                change = true;
            if (profile.PositionID != model.PositionID)
                change = true;
            if (profile.EmpTypeID != model.EmpTypeID)
                change = true;
            if (profile.PayrollGroupID != model.PayrollGroupID)
                change = true;
            if (profile.JobTitleID != model.JobTitleID)
                change = true;
            if (profile.PositionID != model.PositionID)
                change = true;
            if (profile.EmpTypeID != model.EmpTypeID)
                change = true;
            if (profile.PayrollGroupID != model.PayrollGroupID)
                change = true;
            if (profile.DateOfEffect != model.DateOfEffect)
                change = true;
            if (profile.LaborType != model.LaborType)
                change = true;
            if (profile.WorkPlaceID != model.WorkPlaceID)
                change = true;
            if (profile.SupervisorID != model.SupervisorID)
                change = true;
            if (profile.HighSupervisorID != model.HighSupervisorID)
                change = true;
            #endregion
            if (!change)
            {
                profile.ActionStatus = "Success";
                return Json(profile);
            }
            if (profile.ID == model.ID)
            {
                profile.ActionStatus = model.ActionStatus;
                profile.ProfileName = model.ProfileName;
                profile.CodeAttendance = model.CodeAttendance;
                profile.CodeEmp = model.CodeEmp;
                profile.DateApplyAttendanceCode = model.DateApplyAttendanceCode;
                profile.LocationCode = model.LocationCode;
                profile.WorkPlaceName = model.WorkPlaceName;
                profile.CodeTax = model.CodeTax;
                profile.DateOfIssuedTaxCode = model.DateOfIssuedTaxCode;
                profile.DateHire = model.DateHire;
                //profile.PromotionCondition = model.PromotionCondition;
                profile.DateEndProbation = model.DateEndProbation;
                profile.JobTitleID = model.JobTitleID;
                profile.PositionID = model.PositionID;
                profile.EmpTypeID = model.EmpTypeID;
                profile.PayrollGroupID = model.PayrollGroupID;
                profile.DateOfEffect = model.DateOfEffect;
                profile.LaborType = model.LaborType;
                profile.WorkPlaceID = model.WorkPlaceID;
                profile.SupervisorID = model.SupervisorID;
                profile.HighSupervisorID = model.HighSupervisorID;
            }

            var service = new RestServiceClient<Hre_ProfileModel>(UserLogin);
            service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
            var result = service.Post(_Hrm_Hre_Service, "api/Hre_Profile/", profile);
            
            return Json(result);
        }
コード例 #29
0
ファイル: Eva_ReportServices.cs プロジェクト: dtafe/vnr
        public List<Eva_EvalutionDataEntity> SummaryEvalutionData(int year, Guid? _TimesGetDataID, string orgStructureID, DateTime? _daystart, DateTime? _dayend,string userLogin)
        {
            using (var context = new VnrHrmDataContext())
            {
                //    #region Get Data
                string status = string.Empty;
                List<Eva_EvalutionDataEntity> lstEvalutionDataEntity = new List<Eva_EvalutionDataEntity>();

                //    //ds nv
                var hrService = new Hre_ProfileServices();
                var service = new BaseService();
                List<object> strOrgIDs = new List<object>();
                strOrgIDs.AddRange(new object[1]);
                strOrgIDs[0] = (object)orgStructureID;

                var lstProfile = hrService.GetData<Hre_ProfileEntity>(strOrgIDs, ConstantSql.hrm_eva_sp_getdata_ProfileByOrg, userLogin, ref status).ToList();
                if (lstProfile == null || lstProfile.Count == 0)
                    return lstEvalutionDataEntity;
                List<Guid> lstProfileIDs = lstProfile.Select(s => s.ID).ToList();
                IUnitOfWork unitOfWork = new UnitOfWork(context);
                var lstattattendancetable = new List<Att_AttendanceTable>().Select(d => new
                {
                    d.LateEarlyDeductionHours,
                    d.ProfileID
                }).ToList();

                foreach (var lstProfileID in lstProfileIDs.Chunk(1000))
                {
                    lstattattendancetable.AddRange(unitOfWork.CreateQueryable<Att_AttendanceTable>(Guid.Empty,
                        d => lstProfileID.Contains(d.ProfileID) && d.MonthYear >= _daystart
                            && d.MonthYear <= _dayend).Select(d => new
                            {
                                d.LateEarlyDeductionHours,
                                d.ProfileID
                            }).ToList());
                }

                #region Lay cau hinh luu vao cot C1->C16
                Sys_AttOvertimePermitConfigServices sysServices = new Sys_AttOvertimePermitConfigServices();
                string DataC1 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C1);
                string DataC2 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C2);
                string DataC3 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C3);
                string DataC4 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C4);
                string DataC5 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C5);
                string DataC6 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C6);
                string DataC7 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C7);
                string DataC8 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C8);
                string DataC9 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C9);
                string DataC10 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C10);
                string DataC11 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C11);
                string DataC12 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C12);
                string DataC13 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C13);
                string DataC14 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C14);
                string DataC15 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C15);
                string DataC16 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C16);
                #endregion

                string[] lstDataC1 = null;
                string[] lstDataC2 = null;
                string[] lstDataC3 = null;
                string[] lstDataC4 = null;
                string[] lstDataC5 = null;
                string[] lstDataC6 = null;
                string[] lstDataC7 = null;
                string[] lstDataC8 = null;
                List<Cat_LeaveDayTypeEntity> templstleavedaytypeC1 = null;
                List<Cat_LeaveDayTypeEntity> templstleavedaytypeC2 = null;
                List<Cat_LeaveDayTypeEntity> templstleavedaytypeC3 = null;
                List<Cat_LeaveDayTypeEntity> templstleavedaytypeC4 = null;
                List<Cat_LeaveDayTypeEntity> templstleavedaytypeC5 = null;
                List<Cat_LeaveDayTypeEntity> templstleavedaytypeC6 = null;
                List<Cat_LeaveDayTypeEntity> templstleavedaytypeC7 = null;
                List<Cat_LeaveDayTypeEntity> templstleavedaytypeC8 = null;
                List<object> tempobjparam = new List<object>();
                tempobjparam.Add(orgStructureID);
                var tempcatService = new Cat_LeaveDayTypeServices();
                var templstcatLeaveDayType = tempcatService.GetData<Cat_LeaveDayTypeEntity>(tempobjparam, ConstantSql.hrm_cat_getdata_LeaveDayType, userLogin, ref status).ToList();
                if (templstcatLeaveDayType.Count > 0)
                {

                    #region Loai Nghi
                    #region C1
                    if (DataC1 != null)
                    {
                        DataC1 = DataC1.Replace(" ", "").Trim();
                        lstDataC1 = DataC1.Split(',').ToArray();
                        if (lstDataC1 != null && lstDataC1.Count() > 0)
                        {
                            templstleavedaytypeC1 = templstcatLeaveDayType.Where(s => lstDataC1.Contains(s.Code)).ToList();
                        }
                    }
                    #endregion
                    #region C2
                    if (DataC2 != null)
                    {
                        DataC2 = DataC2.Replace(" ", "").Trim();
                        lstDataC2 = DataC2.Split(',').ToArray();
                        if (lstDataC2 != null && lstDataC2.Count() > 0)
                        {
                            templstleavedaytypeC2 = templstcatLeaveDayType.Where(s => lstDataC2.Contains(s.Code)).ToList();
                        }
                    }
                    #endregion
                    #region C3
                    if (DataC3 != null)
                    {
                        DataC3 = DataC3.Replace(" ", "").Trim();
                        lstDataC3 = DataC3.Split(',').ToArray();
                        if (lstDataC3 != null && lstDataC3.Count() > 0)
                        {
                            templstleavedaytypeC3 = templstcatLeaveDayType.Where(s => lstDataC3.Contains(s.Code)).ToList();
                        }
                    }
                    #endregion
                    #region C4
                    if (DataC4 != null)
                    {
                        DataC4 = DataC4.Replace(" ", "").Trim();
                        lstDataC4 = DataC4.Split(',').ToArray();
                        if (lstDataC4 != null && lstDataC4.Count() > 0)
                        {
                            templstleavedaytypeC4 = templstcatLeaveDayType.Where(s => lstDataC4.Contains(s.Code)).ToList();
                        }
                    }
                    #endregion
                    #region C5
                    if (DataC5 != null)
                    {
                        DataC5 = DataC5.Replace(" ", "").Trim();
                        lstDataC5 = DataC5.Split(',').ToArray();
                        if (lstDataC5 != null && lstDataC5.Count() > 0)
                        {
                            templstleavedaytypeC5 = templstcatLeaveDayType.Where(s => lstDataC5.Contains(s.Code)).ToList();
                        }
                    }
                    #endregion
                    #region C6
                    if (DataC6 != null)
                    {
                        DataC6 = DataC6.Replace(" ", "").Trim();
                        lstDataC6 = DataC6.Split(',').ToArray();
                        if (lstDataC6 != null && lstDataC6.Count() > 0)
                        {
                            templstleavedaytypeC6 = templstcatLeaveDayType.Where(s => lstDataC6.Contains(s.Code)).ToList();
                        }
                    }
                    #endregion
                    #region C7
                    if (DataC7 != null)
                    {
                        DataC7 = DataC7.Replace(" ", "").Trim();
                        lstDataC7 = DataC7.Split(',').ToArray();
                        if (lstDataC7 != null && lstDataC7.Count() > 0)
                        {
                            templstleavedaytypeC7 = templstcatLeaveDayType.Where(s => lstDataC7.Contains(s.Code)).ToList();
                        }
                    }
                    #endregion
                    #region C8
                    if (DataC8 != null)
                    {
                        DataC8 = DataC8.Replace(" ", "").Trim();
                        lstDataC8 = DataC8.Split(',').ToArray();
                        if (lstDataC8 != null && lstDataC8.Count() > 0)
                        {
                            templstleavedaytypeC8 = templstcatLeaveDayType.Where(s => lstDataC8.Contains(s.Code)).ToList();
                        }
                    }
                    #endregion
                    #endregion
                }
                #region doi tuong loc theo loai nghi
                //var catService = new Cat_LeaveDayTypeServices();
                //List<object> objparam = new List<object>();
                //objparam.Add(orgStructureID);
                //var lstcatLeaveDayType = catService.GetData<Cat_LeaveDayTypeEntity>(objparam, ConstantSql.hrm_cat_getdata_LeaveDayType, ref status).ToList();
                //var lstleavedaytypeC1 = lstcatLeaveDayType.Where(s => s.Code == "P").ToList();
                //var lstleavedaytypeC2 = lstcatLeaveDayType.Where(s => s.Code == "M" || s.Code == "SM" || s.Code == "SP" || s.Code == "DL" || s.Code == "DSP").ToList();
                //var lstleavedaytypeC3 = lstcatLeaveDayType.Where(s => s.Code == "SU" || s.Code == "SC").ToList();
                //var lstleavedaytypeC4 = lstcatLeaveDayType.Where(s => s.Code == "DP" || s.Code == "SD").ToList();
                //var lstleavedaytypeC5 = lstcatLeaveDayType.Where(s => s.Code == "AL").ToList();
                //var lstleavedaytypeC7 = lstcatLeaveDayType.Where(s => s.Code == "D").ToList();
                Dictionary<string, List<Cat_LeaveDayTypeEntity>> dicLeaveByType = new Dictionary<string, List<Cat_LeaveDayTypeEntity>>();
                //dicLeaveByType.Add("C1", lstleavedaytypeC1);
                //dicLeaveByType.Add("C2", lstleavedaytypeC2);
                //dicLeaveByType.Add("C3", lstleavedaytypeC3);
                //dicLeaveByType.Add("C4", lstleavedaytypeC4);
                //dicLeaveByType.Add("C5", lstleavedaytypeC5);
                //dicLeaveByType.Add("C7", lstleavedaytypeC7);
                if (templstleavedaytypeC1 != null && templstleavedaytypeC1.Count > 0)
                    dicLeaveByType.Add("C1", templstleavedaytypeC1);
                if (templstleavedaytypeC2 != null && templstleavedaytypeC2.Count > 0)
                    dicLeaveByType.Add("C2", templstleavedaytypeC2);
                if (templstleavedaytypeC3 != null && templstleavedaytypeC3.Count > 0)
                    dicLeaveByType.Add("C3", templstleavedaytypeC3);
                if (templstleavedaytypeC4 != null && templstleavedaytypeC4.Count > 0)
                    dicLeaveByType.Add("C4", templstleavedaytypeC4);
                if (templstleavedaytypeC5 != null && templstleavedaytypeC5.Count > 0)
                    dicLeaveByType.Add("C5", templstleavedaytypeC5);
                if (templstleavedaytypeC6 != null && templstleavedaytypeC6.Count > 0)
                    dicLeaveByType.Add("C6", templstleavedaytypeC6);
                if (templstleavedaytypeC7 != null && templstleavedaytypeC7.Count > 0)
                    dicLeaveByType.Add("C7", templstleavedaytypeC7);
                if (templstleavedaytypeC8 != null && templstleavedaytypeC8.Count > 0)
                    dicLeaveByType.Add("C8", templstleavedaytypeC8);
                #endregion
                #region ngay nghi
                string strE_APPROVED = LeaveDayStatus.E_APPROVED.ToString();
                var lstLeaveDay = new List<Att_LeaveDay>().Select(d => new
                {
                    d.LeaveDayTypeID,
                    d.ProfileID,
                    d.LeaveDays,
                    d.DateStart,
                    d.DateEnd
                }).ToList();

                foreach (var lstProfileID in lstProfileIDs.Chunk(1000))
                {
                    lstLeaveDay.AddRange(unitOfWork.CreateQueryable<Att_LeaveDay>(Guid.Empty,
                        d => lstProfileID.Contains(d.ProfileID) && d.DateStart <= _dayend
                            && d.DateEnd >= _daystart && d.Status == strE_APPROVED).Select(d => new
                            {
                                d.LeaveDayTypeID,
                                d.ProfileID,
                                d.LeaveDays,
                                d.DateStart,
                                d.DateEnd
                            }).ToList());
                }
                #endregion
                #region ky luat
                var lsthreDiscipline = new List<Hre_Discipline>().Select(d => new
                {
                    d.DisciplinedTypesSuggestID,
                    d.ProfileID
                }).ToList();

                foreach (var lstProfileID in lstProfileIDs.Chunk(1000))
                {
                    lsthreDiscipline.AddRange(unitOfWork.CreateQueryable<Hre_Discipline>(Guid.Empty,
                        d => lstProfileID.Contains(d.ProfileID) && d.DateOfEffective >= _daystart
                            && d.DateOfEffective <= _dayend).Select(d => new
                            {
                                d.DisciplinedTypesSuggestID,
                                d.ProfileID
                            }).ToList());
                }
                #endregion
                #region loai ky luat
                List<object> paraDisciplinedTypes = new List<object>();
                paraDisciplinedTypes.AddRange(new object[3]);
                paraDisciplinedTypes[1] = 1;
                paraDisciplinedTypes[2] = int.MaxValue;
                var catSerciceDisciplinedTypes = new Cat_DisciplinedTypesServices();
                var lstDisciplinedTypes = catSerciceDisciplinedTypes.GetData<Cat_DisciplinedTypesEntity>(paraDisciplinedTypes, ConstantSql.hrm_cat_sp_get_DisciplinedTypes, userLogin, ref status);
                //var objDisciplinedTypeVW = lstDisciplinedTypes.Where(s => s.Code == "VW").FirstOrDefault();
                //var objDisciplinedTypeWW = lstDisciplinedTypes.Where(s => s.Code == "WW").FirstOrDefault();
                //var objDisciplinedTypeDS = lstDisciplinedTypes.Where(s => s.Code == "DS").FirstOrDefault();

                Cat_DisciplinedTypesEntity tempobjDisciplinedType11 = null;
                Cat_DisciplinedTypesEntity tempobjDisciplinedType12 = null;
                Cat_DisciplinedTypesEntity tempobjDisciplinedType13 = null;
                #endregion
                #region Loai ky luat
                if (lstDisciplinedTypes != null)
                {
                    #region C11
                    if (DataC11 != null)
                    {
                        DataC11 = DataC11.Replace(" ", "").Trim();
                        tempobjDisciplinedType11 = lstDisciplinedTypes.Where(s => s.Code == DataC11).FirstOrDefault();
                    }
                    #endregion
                    #region C12
                    if (DataC12 != null)
                    {
                        DataC12 = DataC12.Replace(" ", "").Trim();
                        tempobjDisciplinedType12 = lstDisciplinedTypes.Where(s => s.Code == DataC12).FirstOrDefault();
                    }
                    #endregion
                    #region C13
                    if (DataC13 != null)
                    {
                        DataC13 = DataC13.Replace(" ", "").Trim();
                        tempobjDisciplinedType13 = lstDisciplinedTypes.Where(s => s.Code == DataC13).FirstOrDefault();
                    }
                    #endregion
                }

                #endregion
                #region Danh gia
                var kaiServiceKaizenData = new Kai_KaiZenDataServices();
                var listKaiKaizenData = new List<Kai_KaizenData>().Select(d => new
                {
                    d.Accumulate,
                    d.MarkPerform,
                    d.ProfileID
                }).ToList();

                foreach (var lstProfileID in lstProfileIDs.Chunk(1000))
                {
                    listKaiKaizenData.AddRange(unitOfWork.CreateQueryable<Kai_KaizenData>(Guid.Empty, d => d.ProfileID.HasValue
                        && lstProfileID.Contains(d.ProfileID.Value) && d.Month >= _daystart && d.Month <= _dayend).Select(d => new
                        {
                            d.Accumulate,
                            d.MarkPerform,
                            d.ProfileID
                        }).ToList());
                }
                #endregion
                #region Loai thieu quet the la quen quet the voi ma la FC
                var objTamScanResonMissID = unitOfWork.CreateQueryable<Cat_TAMScanReasonMiss>(Guid.Empty, s => s.Code.Trim() == "FC").Select(s => s.ID).FirstOrDefault();
                #endregion
                #region lay du lieu quen quet the
          
                var lstworkDayProfiles = new List<Att_Workday>().Select(d => new
                {
                    d.ProfileID,
                    d.WorkDate
                    
                }).ToList();
                if (objTamScanResonMissID != null)
                {
                    List<string> lstType = new List<string> 
                    { 
                        WorkdayType.E_MISS_IN.ToString(),
                        WorkdayType.E_MISS_IN_OUT.ToString(),
                        WorkdayType.E_MISS_OUT.ToString()
                    };
                    foreach (var lstProfileID in lstProfileIDs.Chunk(1000))
                    {
                        lstworkDayProfiles.AddRange(unitOfWork.CreateQueryable<Att_Workday>(Guid.Empty, d => lstProfileID.Contains(d.ProfileID) && _daystart <= d.WorkDate && d.WorkDate <= _dayend && lstType.Contains(d.Type) && d.MissInOutReason == objTamScanResonMissID).Select(d => new
                        {
                            d.ProfileID,
                            d.WorkDate
                        }).ToList());
                    }
                }
              
                #endregion
                bool? _tempC9LATEEARLYDEDUCTIONHOURS = false;
                bool? _tempC9FAILINGTORECORDCARD = false;
                bool? _tempC10LATEEARLYDEDUCTIONHOURS = false;
                bool? _tempC10FAILINGTORECORDCARD = false;

                #region xac dinh dlieu luu cot C9 va C10
                if (DataC9 != null)
                {
                    if (DataC9.Replace(" ", "").Trim() == "LATEEARLYDEDUCTIONHOURS")
                    {
                        _tempC9LATEEARLYDEDUCTIONHOURS = true;
                    }
                    else if (DataC9.Replace(" ", "").Trim() == "FAILINGTORECORDCARD")
                    {
                        _tempC9FAILINGTORECORDCARD = true;
                    }
                }
                if (DataC10 != null)
                {
                    if (DataC10.Replace(" ", "").Trim() == "LATEEARLYDEDUCTIONHOURS")
                    {
                        _tempC10LATEEARLYDEDUCTIONHOURS = true;
                    }
                    else if (DataC10.Replace(" ", "").Trim() == "FAILINGTORECORDCARD")
                    {
                        _tempC10FAILINGTORECORDCARD = true;
                    }
                }
                #endregion
                #region xac dinh dlieu luu cot C14->C16
                bool? _tempC14MARKPERFORM = false;
                bool? _tempC14ACCUMULATE = false;
                bool? _tempC15MARKPERFORM = false;
                bool? _tempC15ACCUMULATE = false;
                bool? _tempC16MARKPERFORM = false;
                bool? _tempC16ACCUMULATE = false;

                if (DataC14 != null)
                {
                    if (DataC14.Replace(" ", "").Trim() == "MARKPERFORM")
                    {
                        _tempC14MARKPERFORM = true;
                    }
                    else if (DataC14.Replace(" ", "").Trim() == "ACCUMULATE")
                    {
                        _tempC14ACCUMULATE = true;
                    }
                }
                if (DataC15 != null)
                {
                    if (DataC15.Replace(" ", "").Trim() == "MARKPERFORM")
                    {
                        _tempC15MARKPERFORM = true;
                    }
                    else if (DataC15.Replace(" ", "").Trim() == "ACCUMULATE")
                    {
                        _tempC15ACCUMULATE = true;
                    }
                }
                if (DataC16 != null)
                {
                    if (DataC16.Replace(" ", "").Trim() == "MARKPERFORM")
                    {
                        _tempC16MARKPERFORM = true;
                    }
                    else if (DataC16.Replace(" ", "").Trim() == "ACCUMULATE")
                    {
                        _tempC16ACCUMULATE = true;
                    }
                }

                #endregion

                foreach (var profile in lstProfile)
                {
                    Eva_EvalutionDataEntity entity = new Eva_EvalutionDataEntity();
                    entity.CodeEmp = profile.CodeEmp;
                    entity.ProfileName = profile.ProfileName;
                    entity.ProfileID = profile.ID;
                    entity.TimesGetDataID = _TimesGetDataID;
                    entity.Year = new DateTime(year, 01, 01);
                    int C1 = 0;
                    int C2 = 0;
                    int C3 = 0;
                    int C4 = 0;
                    int C5 = 0;
                    int C6 = 0;
                    int C7 = 0;
                    int C8 = 0;
                    int C9 = 0;
                    int C10 = 0;
                    var lstLeaveDayprofile = lstLeaveDay.Where(s => s.ProfileID == profile.ID).ToList();
                    if (lstLeaveDayprofile.Count > 0)
                    {
                        foreach (var attLeaveDayprofile in lstLeaveDayprofile)
                        {
                            #region C1->C8
                            foreach (var item in dicLeaveByType)
                            {
                                List<Cat_LeaveDayTypeEntity> lstLeavetype = (List<Cat_LeaveDayTypeEntity>)item.Value;
                                int temp = 0;
                                if (attLeaveDayprofile.LeaveDayTypeID != null && lstLeavetype.Any(m => m.ID == attLeaveDayprofile.LeaveDayTypeID) && attLeaveDayprofile.LeaveDays > 0)
                                {
                                    string _strLeaveDays = attLeaveDayprofile.LeaveDays.ToString();
                                    string[] _partLeaveDays = _strLeaveDays.Split('.');
                                    int _intLeaveDays = int.Parse(_partLeaveDays[0]);
                                    if (_partLeaveDays.Count() > 1)
                                    {
                                        int _modLeaveDays = int.Parse(_partLeaveDays[1]);
                                        if (_modLeaveDays > 0)
                                        {
                                            temp += _intLeaveDays + 1;
                                        }
                                    }
                                    else
                                    {
                                        temp += _intLeaveDays;
                                    }
                                }
                                if (item.Key == "C1")
                                {
                                    C1 += temp;
                                }
                                if (item.Key == "C2")
                                {
                                    C2 += temp;
                                }
                                if (item.Key == "C3")
                                {
                                    C3 += temp;
                                }
                                if (item.Key == "C4")
                                {
                                    C4 += temp;
                                }
                                if (item.Key == "C5")
                                {
                                    C5 += temp;
                                }
                                if (item.Key == "C6")
                                {
                                    C6 += temp;
                                }
                                if (item.Key == "C7")
                                {
                                    C7 += temp;
                                }
                                if (item.Key == "C8")
                                {
                                    C8 += temp;
                                }
                            }
                        }
                            #endregion
                    }

                    #region tong tre som va quen quet the C9->C10
                    #region C9
                    if (_tempC9LATEEARLYDEDUCTIONHOURS == true)
                    {
                        var lstattattendancetableprofile = lstattattendancetable.Where(s => s.ProfileID == profile.ID).ToList();
                        if (lstattattendancetableprofile.Count > 0)
                        {
                            C9 = lstattattendancetableprofile.Where(s => s.LateEarlyDeductionHours > 0).Count();
                        }
                    }
                    else if (_tempC9FAILINGTORECORDCARD == true)
                    {
                        var lstworkDayprofile = lstworkDayProfiles.Where(s => s.ProfileID == profile.ID).ToList();
                        if (lstworkDayprofile.Count > 0)
                        {
                            C9 = lstworkDayprofile.Count();
                        }
                        if (lstLeaveDayprofile.Count > 0)
                        {
                            foreach (var objWorkDay in lstworkDayprofile)
                            {
                                var objLeaveDayByWorkDay = lstLeaveDayprofile.Where(s => s.DateStart <= objWorkDay.WorkDate && s.DateEnd >= objWorkDay.WorkDate).ToList();
                                if (objLeaveDayByWorkDay.Count > 0)
                                {
                                    C9 -= 1;
                                }
                            }
                        }
                    }
                    #endregion
                    #region C10
                    if (_tempC10LATEEARLYDEDUCTIONHOURS == true)
                    {
                        var lstattattendancetableprofile = lstattattendancetable.Where(s => s.ProfileID == profile.ID).ToList();
                        if (lstattattendancetableprofile.Count > 0)
                        {
                            C10 = lstattattendancetableprofile.Where(s => s.LateEarlyDeductionHours > 0).Count();
                        }
                    }
                    else if (_tempC10FAILINGTORECORDCARD == true)
                    {
                        var lstworkDayprofile = lstworkDayProfiles.Where(s => s.ProfileID == profile.ID).ToList();
                        if (lstworkDayprofile.Count > 0)
                        {
                            C10 = lstworkDayprofile.Count();
                        }
                        if (lstLeaveDayprofile.Count>0)
                        {
                            foreach (var objWorkDay in lstworkDayprofile)
                            {
                                var objLeaveDayByWorkDay = lstLeaveDayprofile.Where(s => s.DateStart <= objWorkDay.WorkDate && s.DateEnd >= objWorkDay.WorkDate).ToList();
                                if (objLeaveDayByWorkDay.Count > 0)
                                {
                                    C10 -= 1;
                                }
                            }
                        }
                    }
                    #endregion
                    #endregion
                    if (C1 > 0)
                        entity.C1 = C1;
                    if (C2 > 0)
                        entity.C2 = C2;
                    if (C3 > 0)
                        entity.C3 = C3;
                    if (C4 > 0)
                        entity.C4 = C4;
                    if (C5 > 0)
                        entity.C5 = C5;
                    if (C6 > 0)
                        entity.C6 = C6;
                    if (C7 > 0)
                        entity.C7 = C7;
                    if (C8 > 0)
                        entity.C8 = C8;
                    if (C9 > 0)
                        entity.C9 = C9;
                    if (C10 > 0)
                        entity.C10 = C10;
                    #region C11->C13
                    if (lsthreDiscipline.Count > 0)
                    {
                        var lsthreDisciplineprofile = lsthreDiscipline.Where(s => s.ProfileID == profile.ID).ToList();
                        if (lsthreDisciplineprofile.Count > 0)
                        {
                            if (tempobjDisciplinedType11 != null)
                            {
                                var lsthreDiscipline11 = lsthreDisciplineprofile.Where(s => s.DisciplinedTypesSuggestID == tempobjDisciplinedType11.ID).ToList();
                                if (lsthreDiscipline11.Count > 0)
                                    entity.C11 = lsthreDiscipline11.Count;
                            }
                            if (tempobjDisciplinedType12 != null)
                            {
                                var lsthreDiscipline12 = lsthreDisciplineprofile.Where(s => s.DisciplinedTypesSuggestID == tempobjDisciplinedType12.ID).ToList();
                                if (lsthreDiscipline12.Count > 0)
                                    entity.C12 = lsthreDiscipline12.Count;
                            }
                            if (tempobjDisciplinedType13 != null)
                            {
                                var lsthreDiscipline13 = lsthreDisciplineprofile.Where(s => s.DisciplinedTypesSuggestID == tempobjDisciplinedType13.ID).ToList();
                                if (lsthreDiscipline13.Count > 0)
                                    entity.C13 = lsthreDiscipline13.Count;
                            }
                        }
                    }
                    #endregion
                    #region C14->C16
                    if (listKaiKaizenData.Count > 0)
                    {
                        var listKaiKaizenDataprofile = listKaiKaizenData.Where(s => s.ProfileID == profile.ID).ToList();
                        int _tempAccumulate = 0;
                        int _MarkPerform = 0;
                        if (listKaiKaizenDataprofile.Count > 0)
                        {
                            #region Danh Gia
                            _MarkPerform = listKaiKaizenDataprofile.Where(s => s.MarkPerform > 0).Count();
                            _tempAccumulate = int.Parse(listKaiKaizenDataprofile.Select(s => s.Accumulate).Sum().ToString());
                            #region C14
                            if (_tempC14MARKPERFORM == true && _MarkPerform > 0)
                            {
                                entity.C14 = _MarkPerform;
                            }
                            else if (_tempC14ACCUMULATE == true && _tempAccumulate > 0)
                            {
                                entity.C14 = _tempAccumulate;
                            }
                            #endregion
                            #region C15
                            if (_tempC15MARKPERFORM == true && _MarkPerform > 0)
                            {
                                entity.C15 = _MarkPerform;
                            }
                            else if (_tempC15ACCUMULATE == true && _tempAccumulate > 0)
                            {
                                entity.C15 = _tempAccumulate;
                            }
                            #endregion
                            #region C16
                            if (_tempC16MARKPERFORM == true && _MarkPerform > 0)
                            {
                                entity.C16 = _MarkPerform;
                            }
                            else if (_tempC16ACCUMULATE == true && _tempAccumulate > 0)
                            {
                                entity.C16 = _tempAccumulate;
                            }
                            #endregion
                            #endregion
                        }

                    }
                    #endregion
                    if (entity != null)
                    {
                        lstEvalutionDataEntity.Add(entity);
                    }
                }
                return lstEvalutionDataEntity;
                //    #endregion
            }
        }
コード例 #30
0
ファイル: PersonalController.cs プロジェクト: dtafe/vnr
        public JsonResult CreatePersonalInfo(Hre_ProfileModel model, string userLogin)
        {
            var id = Session[SessionObjects.ProfileID];
            var serv = new Hre_ProfileServices();
            string status = string.Empty;
            var profile = serv.GetData<Hre_ProfileModel>(HRM.Infrastructure.Utilities.Common.DotNetToOracle(id.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();

            bool change = false;
            #region check change
            if (profile.NameEnglish != model.NameEnglish)
                change = true;
            if (profile.Gender != model.Gender)
                change = true;
            if (profile.DayOfBirth != model.DayOfBirth)
                change = true;
            if (profile.MonthOfBirth != model.MonthOfBirth)
                change = true;
            if (profile.YearOfBirth != model.YearOfBirth)
                change = true;
            if (profile.NationalityID != model.NationalityID)
                change = true;
            if (profile.PlaceOfBirth != model.PlaceOfBirth)
                change = true;
            if (profile.MarriageStatus != model.MarriageStatus)
                change = true;
            if (profile.IDNo != model.IDNo)
                change = true;
            if (profile.IDDateOfIssue != model.IDDateOfIssue)
                change = true;
            if (profile.IDPlaceOfIssue != model.IDPlaceOfIssue)
                change = true;
            if (profile.Origin != model.Origin)
                change = true;
            //if (profile.TypeOfVehicle != model.TypeOfVehicle)
            //    change = true;
            //if (profile.LockerName != model.LockerName)
            //    change = true;
            if (profile.EducationLevelID != model.EducationLevelID)
                change = true;
            if (profile.EthnicID != model.EthnicID)
                change = true;
            if (profile.Notes != model.Notes)
                change = true;
            if (profile.BloodType != model.BloodType)
                change = true;
            if (profile.Height != model.Height)
                change = true;
            if (profile.Weight != model.Weight)
                change = true;
            if (profile.PassportNo != model.PassportNo)
                change = true;
            if (profile.PassportPlaceOfIssue != model.PassportPlaceOfIssue)
                change = true;
            if (profile.PassportDateOfIssue != model.PassportDateOfIssue)
                change = true;
            if (profile.PassportDateOfExpiry != model.PassportDateOfExpiry)
                change = true;

           
            
            #endregion
            if (!change)
            {
                profile.ActionStatus = "Success";
                return Json(profile);
            }
            if (profile.ID == model.ID)
            {

                profile.ActionStatus = model.ActionStatus;
                profile.NameEnglish = model.NameEnglish;
                profile.Gender = model.Gender;
                profile.DayOfBirth = model.DayOfBirth;
                profile.MonthOfBirth = model.MonthOfBirth;
                profile.YearOfBirth = model.YearOfBirth;
                profile.NationalityID = model.NationalityID;
                profile.PlaceOfBirth = model.PlaceOfBirth;
                profile.MarriageStatus = model.MarriageStatus;
                profile.IDNo = model.IDNo;
                profile.IDDateOfIssue = model.IDDateOfIssue;
                profile.IDPlaceOfIssue = model.IDPlaceOfIssue;
                profile.Origin = model.Origin;
                profile.EducationLevelID = model.EducationLevelID;
                profile.EthnicID = model.EthnicID;
                profile.Notes = model.Notes;
                profile.BloodType = model.BloodType;
                profile.Height = model.Height;
                profile.Weight = model.Weight;
                profile.PassportNo = model.PassportNo;
                profile.PassportPlaceOfIssue = model.PassportPlaceOfIssue;
                profile.PassportDateOfIssue = model.PassportDateOfIssue;
                profile.PassportDateOfExpiry = model.PassportDateOfExpiry;

            
            }

            var service = new RestServiceClient<Hre_ProfileModel>(UserLogin);
            service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
            var result = service.Post(_Hrm_Hre_Service, "api/Hre_Profile/", profile);
            return Json(result);
        }