예제 #1
0
 /// <summary>
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Tra_ClassModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new Tra_ClassModel();
     ActionService service = new ActionService(UserLogin);
     var entity = service.GetByIdUseStore<Tra_ClassEntity>(id, ConstantSql.hrm_tra_sp_get_ClassById, ref status);
     if (entity!=null)
     {
         if (entity.TrainerOtherList != null)
             entity.TrainerOtherList = entity.TrainerOtherList.Replace(" ", "");
         model = entity.CopyData<Tra_ClassModel>();
         if(model.IsTrainingOut == false)
         {
             model.IsTrainingInside = true;
         }
             if (entity.Teacher != null)
             {
                 //Guid profileid = Guid.Parse(entity.Teacher);
                 var lstEntityprofile = service.GetData<Tra_RequirementTrainEntity>(entity.Teacher, ConstantSql.hrm_hr_sp_get_ProfileById, ref status);
                 if (lstEntityprofile!=null && lstEntityprofile.Count > 0)
                 {
                     var entityprofile = lstEntityprofile[0];
                     if (entityprofile != null && entityprofile.ProfileID != null && entityprofile.ProfileName != null)
                     {
                         model.ProfileID = entityprofile.ID;
                         model.ProfileName = entityprofile.ProfileName;
                         model.CodeEmp = entityprofile.CodeEmp;
                     }
                 }
                 
             }
     }
     model.ActionStatus = status;
     return model;
 }
 public Rec_InterviewCampaignDetailModel Post([Bind]Rec_InterviewCampaignDetailModel model)
 {
     ActionService service = new ActionService(UserLogin);
     string status = string.Empty;
     if (model.InterviewCampaignID != null)
     {
         var interviewcampaign = service.GetData<Rec_InterviewCampaignEntity>(Common.DotNetToOracle(model.InterviewCampaignID.ToString()), ConstantSql.hrm_rec_sp_get_InterviewCampaignById, ref status).FirstOrDefault();
         if (interviewcampaign != null)
         {
             model.DateFrom = interviewcampaign.DateInterviewFrom;
             model.DateTo = interviewcampaign.DateInterviewTo;
             model.LevelInterview = interviewcampaign.LevelInterview;
         }
     }
     #region Validate
     string message = string.Empty;
     var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Rec_InterviewCampaignDetailModel>(model, "Rec_InterviewCampaignDetail", ref message);
     if (!checkValidate)
     {
         model.ActionStatus = message;
         return model;
     }
     #endregion
    
     return service.UpdateOrCreate<Rec_InterviewCampaignDetailEntity, Rec_InterviewCampaignDetailModel>(model);
 }
예제 #3
0
        public Att_LeaveDayModel GetById(Guid id)
        {
            string status = string.Empty;
            var model = new Att_LeaveDayModel();
            ActionService service = new ActionService(UserLogin);
            var entity = service.GetByIdUseStore<Att_LeaveDayEntity>(id, ConstantSql.hrm_att_sp_get_LeaveDayById, ref status);
            if (entity != null)
            {
                model = entity.CopyData<Att_LeaveDayModel>();
                if (model.LeaveHours != null && model.LeaveHours > 0)
                {
                    if (model.DurationType == LeaveDayDurationType.E_FIRSTHALFSHIFT.ToString() || model.DurationType == LeaveDayDurationType.E_LASTHALFSHIFT.ToString())
                    {
                        var guiId = model.ProfileID;
                        var start = model.DateStart;
                        var end = model.DateEnd;
                        if (guiId != null && guiId != Guid.Empty && start != null && end != null)
                        {
                            var listRoster = service.GetData<Att_RosterEntity>(guiId, ConstantSql.hrm_att_sp_get_RosterByProfileId, ref status);
                            if (listRoster != null)
                            {
                                for (DateTime i = start; i <= end; i = i.AddDays(1))
                                {
                                    var roster = listRoster.Where(d => d.DateStart <= i && d.DateEnd >= i).FirstOrDefault();
                                    if (roster != null)
                                    {
                                        var shift = SearchShift(roster, i);
                                        if (shift != null && shift != Guid.Empty)
                                        {
                                            var catShift = service.GetByIdUseStore<Cat_ShiftEntity>((Guid)shift, ConstantSql.hrm_cat_sp_get_ShiftById, ref status);
                                            if (catShift != null)
                                            {
                                                if (model.DurationType == LeaveDayDurationType.E_FIRSTHALFSHIFT.ToString())
                                                {
                                                    model.HoursFrom = catShift.InTime;
                                                    model.HoursTo = catShift.InTime.AddHours(catShift.CoBreakOut);
                                                    break;
                                                }
                                                else
                                                {
                                                    model.HoursFrom = catShift.InTime.AddHours(catShift.CoBreakIn);
                                                    model.HoursTo = catShift.InTime.AddHours(catShift.CoOut);
                                                    break;
                                                }
                                            }
                                        }

                                    }
                                }
                            }
                        }
                    }
                }
            }
            model.ActionStatus = status;
            return model;

        }
예제 #4
0
 /// <summary>
 /// Chú ý là mượn page để get list Master
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public List<Rep_MasterModel> GetById(Guid id)
 {
     string status = string.Empty;
     var model = new List<Rep_MasterModel>();
     ActionService service = new ActionService(UserLogin);
     var listModel = new List<object>();
     listModel.AddRange(new object[3]);
     listModel[1] = 1;
     listModel[2] = Int32.MaxValue - 1;
     var entity = service.GetData<Rep_MasterModel>(listModel, ConstantSql.hrm_rep_sp_get_Master, ref status);
     return entity != null ? entity.ToList() : new List<Rep_MasterModel>();
 }
예제 #5
0
 public Rep_ConditionItemModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new Rep_ConditionItemModel();
     ActionService service = new ActionService(UserLogin);
     var entity = service.GetData<Rep_ConditionItemEntity>(Common.DotNetToOracle(id.ToString()), ConstantSql.hrm_rep_sp_get_ConditionItemByID, ref status).FirstOrDefault();
     if (entity != null)
     {
         model = entity.CopyData<Rep_ConditionItemModel>();
     }
     model.ActionStatus = status;
     return model;
 }
예제 #6
0
 /// <summary>
 /// [Tin.Nguyen] - Lấy dữ liệu Tủ Đồ(Lau_Locker) theo Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Lau_LaundryRecordModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new Lau_LaundryRecordModel();
     ActionService service = new ActionService(UserLogin);
     var entity = service.GetData<LMS_LaundryRecordEntity>(id, ConstantSql.hrm_lau_sp_get_LaundryRecord_byId, ref status).FirstOrDefault();
     if (entity != null)
     {
         model = entity.CopyData<Lau_LaundryRecordModel>();
     }
     model.ActionStatus = status;
     return model;
 }
 public Can_MealAllowanceTypeSettingModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new Can_MealAllowanceTypeSettingModel();
     ActionService service = new ActionService(UserLogin);
     var entity = service.GetData<Can_MealAllowanceTypeSettingEntity>(id, ConstantSql.hrm_can_sp_get_mealallowtypebyid, ref status).FirstOrDefault();
     if (entity != null)
     {
         model = entity.CopyData<Can_MealAllowanceTypeSettingModel>();
     }
     model.ActionStatus= status;
     return model;
 }
예제 #8
0
 /// <summary>
 /// [Quan.Nguyen] - Lấy dữ liệu Cat_TAMScanReasonMiss(Cat_TAMScanReasonMiss) theo Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Cat_TAMScanReasonMissModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new Cat_TAMScanReasonMissModel();
     ActionService service = new ActionService(UserLogin);
     var entity = service.GetData<Cat_TAMScanReasonMissEntity>(id, ConstantSql.hrm_cat_sp_get_TAMScanReasonMiss_ById, ref status).FirstOrDefault(); 
     if (entity != null)
     {
         model = entity.CopyData<Cat_TAMScanReasonMissModel>();
     }
     model.ActionStatus = status;
     return model;
 }
예제 #9
0
 /// <summary>
 /// [Son.Vo] - Lấy dữ liệu Relatives(Hre_Relatives) theo Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Hre_RelativesModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new Hre_RelativesModel();
     ActionService service = new ActionService(UserLogin);
     var entity = service.GetData<Hre_RelativesEntity>(Common.DotNetToOracle(id.ToString()), ConstantSql.hrm_hr_sp_get_RelativesById, ref status).FirstOrDefault();
     if (entity != null)
     {
         model = entity.CopyData<Hre_RelativesModel>();
     }
     model.ActionStatus = status;
     return model;
 }
예제 #10
0
 public Can_TamScanLogModel Get(Guid id)
 {
     string status = string.Empty;
     var model = new Can_TamScanLogModel();
     ActionService service = new ActionService(UserLogin);
     var entity = service.GetData<Can_TamScanLogEntity>(id, ConstantSql.hrm_can_sp_get_tamscanlogbyid, ref status).FirstOrDefault();
     if (entity != null)
     {
         model = entity.CopyData<Can_TamScanLogModel>();
     }
     model.ActionStatus = status;
     return model;
 }
예제 #11
0
 /// <summary>
 /// [Tam.Le] - Lấy dữ liệu MachineOfLine theo Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Can_MachineOfLineModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new Can_MachineOfLineModel();
     ActionService service = new ActionService(UserLogin);
     var entity = service.GetData<Can_MachineOfLineEntity>(id, ConstantSql.hrm_can_sp_get_machineoflinebyid, ref status).FirstOrDefault();
     if (entity != null)
     {
         model = entity.CopyData<Can_MachineOfLineModel>();
     }
     model.ActionStatus = status;
     return model;
 }
예제 #12
0
 /// <summary>
 /// [Son.Vo] - Lấy dữ liệu Trình độ chuyên môn(Hre_Qualification) theo Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Hre_ProfileLanguageLevelModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new Hre_ProfileLanguageLevelModel();
     ActionService service = new ActionService(UserLogin);
     //var entity = service.GetByIdUseStore<Hre_QualificationEntity>(id,ConstantSql.hrm_hr_sp_get_QualificationById, ref status);
     var entity = service.GetData<Hre_ProfileLanguageLevelEntity>(Common.DotNetToOracle(id.ToString()), ConstantSql.hrm_hr_sp_get_ProfileLanguageById, ref status).FirstOrDefault();
     if (entity != null)
     {
         model = entity.CopyData<Hre_ProfileLanguageLevelModel>();
     }
     model.ActionStatus = status;
     return model;
 }
예제 #13
0
 public JsonResult GetMultiChildSick(string text, Guid profileId)
 {
     string status = string.Empty;
     List<object> lstParam = new List<object>();
     lstParam.Add(text);
     lstParam.Add(profileId);
     var service = new ActionService(UserLogin);
     var get = service.GetData<Ins_ChildSickEntity>(lstParam, ConstantSql.hrm_ins_sp_get_ChildSick_Multi, ref status);
     var result = get.Select(item => new Ins_ChildSickModel()
     {
         ID = item.ID,
         ChildSickName = item.ChildSickName
     });
     return Json(result, JsonRequestBehavior.AllowGet);
 }
예제 #14
0
        //Check nv da nghi viec
        public JsonResult CheckProfileStoWorked(Guid profileid)
        {

            ActionService service = new ActionService(UserLogin);
            if (profileid != Guid.Empty)
            {
                string status = string.Empty;
                var entity = service.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(profileid.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, ref status).FirstOrDefault();
                if (entity != null && entity.DateQuit != null && entity.DateQuit < DateTime.Now)
                {
                    return Json("error");
                }
            }
            return Json("success");
        }
예제 #15
0
        public Hre_CandidateHistoryModel Post([Bind]Hre_CandidateHistoryModel model)
        {
            #region Validate
            string message = string.Empty;
            var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Hre_CandidateHistoryModel>(model, "Hre_CandidateHistory", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return model;
            }
            #endregion
            string status = string.Empty;
            var candidateHistoryservices = new Hre_CandidateHistoryServices();
            ActionService service = new ActionService(UserLogin);
            if(model.CandidateID != null && model.CandidateID != Guid.Empty)
            {
                var profileBycandidateID = service.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(model.CandidateID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileByCandidateID, ref status).FirstOrDefault();
                if (profileBycandidateID != null)
                {
                    var canhisbyprofile = service.GetData<Hre_CandidateHistoryEntity>(Common.DotNetToOracle(profileBycandidateID.ID.ToString()), ConstantSql.hrm_hr_sp_get_CandidateHistoryByProfileId, ref status).FirstOrDefault();
                    if (canhisbyprofile != null)
                    {
                        model.ID = canhisbyprofile.ID;
                        model.ProfileID = canhisbyprofile.ProfileID;
                    }
                }
            }

            if (model.ProfileID != null && model.ProfileID != Guid.Empty)
            {
                var profile = service.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(model.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, ref status).FirstOrDefault();

                if (profile != null)
                {
                    if(profile.CandidateID != null)
                    {
                        var canhisbyprofile = service.GetData<Hre_CandidateHistoryEntity>(Common.DotNetToOracle(profile.CandidateID.ToString()), ConstantSql.hrm_hr_sp_get_CandidateHistoryByCandidateId, ref status).FirstOrDefault();
                        if (canhisbyprofile != null)
                        {
                            model.ID = canhisbyprofile.ID;
                            model.CandidateID = canhisbyprofile.CandidateID;
                        }
                    }
                }
            }

            return service.UpdateOrCreate<Hre_CandidateHistoryEntity, Hre_CandidateHistoryModel>(model);
        }
예제 #16
0
        public Rec_RecruitmentHistoryModel Post([Bind]Rec_RecruitmentHistoryModel model)
        {
            #region Validate
            string message = string.Empty;
            var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Rec_RecruitmentHistoryModel>(model, "Rec_RecruitmentHistory", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return model;
            }
            #endregion
            ActionService service = new ActionService(UserLogin);
            if (model.CandidateID != null)
            {
                string status = string.Empty;
                var candidate = service.GetData<Rec_CandidateEntity>(Common.DotNetToOracle(model.CandidateID.ToString()), ConstantSql.hrm_rec_sp_get_CandidateById, ref status).FirstOrDefault();
                model.CandidateName = candidate != null ? candidate.CandidateName : null;
            }

            return service.UpdateOrCreate<Rec_RecruitmentHistoryEntity, Rec_RecruitmentHistoryModel>(model);
        }
예제 #17
0
        public Hre_StopWorkingModel Post([Bind]Hre_StopWorkingModel model)
        {
            ActionService service = new ActionService(UserLogin);
            #region Validate
            var ValiteConfig = "Hre_StopWorking";
            if (model.RequestDateComeBack != null)
            {
                ValiteConfig = "Hre_StopWorking_RegisterComeBack";
            }
            else if (model.DateStop != null && model.RequestDate != null && model.TypeSuspense != null)
            {
                ValiteConfig = "Hre_StopWorking_RegisterSuspense";
            }
            string message = string.Empty;
            var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Hre_StopWorkingModel>(model, ValiteConfig, ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return model;
            }
            string status = "";
            var result = service.GetData<Hre_StopWorkingEntity>(Common.DotNetToOracle(model.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_StopWorkingByProId, ref status);
            if (result.Count > 0 && result.FirstOrDefault().ID != model.ID)
            {
                model.ActionStatus = ConstantMessages.RegisterDuplicate.TranslateString();
                return model;
            }
            if (model.Status == null)
            {
                model.Status = EnumDropDown.StopWorkStatus.E_WAITAPPROVE.ToString();
            }

            #endregion
           
            
           return service.UpdateOrCreate<Hre_StopWorkingEntity, Hre_StopWorkingModel>(model, model.UserID);

        }
예제 #18
0
        public ActionResult GetReportEmpDetail([DataSourceRequest] DataSourceRequest request, Lau_ReportSearchModel model)
        {
            Lau_ReportServices service = new Lau_ReportServices();
            BaseService baseService = new BaseService();
            var Actionservices = new ActionService(UserLogin);
            bool isIncludeQuitEmp = model.isIncludeQuitEmp ? true : false;

            #region xử lý dateStart - dateEnd
            DateTime dateStart = DateTime.Now;
            DateTime dateEnd = DateTime.Now;
            if (model.DateFrom != null)
            {
                dateStart = model.DateFrom.Value;
            }
            if (model.DateTo != null)
            {
                dateEnd = model.DateTo.Value;
            }
            #endregion

            #region xử lý line - locker - marker

            List<Guid?> lstLine = new List<Guid?>();
            List<Guid?> lstLocker = new List<Guid?>();
            List<Guid?> lstMarker = new List<Guid?>();
            if (model.LineID != null)
            {
                foreach (var line in model.LineID.Split(','))
                {
                    lstLine.Add(new Guid(line));
                }
            }
            if (model.LockerID != null)
            {
                foreach (var locker in model.LockerID.Split(','))
                {
                    lstLocker.Add(new Guid(locker));
                }
            }
            if (model.MarkerID != null)
            {
                foreach (var marker in model.MarkerID.Split(','))
                {
                    lstMarker.Add(new Guid(marker));
                }
            }

            #endregion

            #region xử lý lấy lstProfileIds theo OrgStructureID
            List<Guid> lstProfileIDs = new List<Guid>();
            string status = string.Empty;
            List<object> lstObj = new List<object>();
            lstObj.Add(model.OrgStructureID);
            lstObj.Add(null);
            lstObj.Add(null);
            List<Guid> _temp = new List<Guid>();
            List<Guid> _profileIDs = new List<Guid>();

            if (model.ProfileIDs != null)
            {
                var lst = model.ProfileIDs.Split(',');
                foreach (var item in lst)
                {
                    Guid _Id = new Guid(item);
                    _temp.Add(_Id);
                }

                //_temp = lst.Select(int.Parse).ToList();

                if (model.OrgStructureID != null)
                {
                    lstProfileIDs = Actionservices.GetData<Hre_ProfileIdEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(m => m.ID).ToList();
                    _profileIDs = lstProfileIDs.Where(m => !_temp.Contains(m)).ToList();
                    lstProfileIDs.AddRange(_profileIDs);
                }
                else
                {
                    lstProfileIDs = _temp;
                }
            }
            else
            {
                lstProfileIDs = Actionservices.GetData<Hre_ProfileIdEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(m => m.ID).ToList();
            }
            #endregion

            var result = service.GetReportEmpDetail(lstLine, lstLocker, lstMarker, lstProfileIDs, dateStart, dateEnd, isIncludeQuitEmp, model.CodeEmp, UserLogin);
            var rs = result.Translate<Lau_ReportEmpDetailModel>();

            #region xử lý xuất báo cáo

            if (model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(model.ExportID, rs);
                return Json(fullPath);
            }

            #endregion

            var dataSourceResult = result.ToDataSourceResult(request);
            return Json(rs.ToDataSourceResult(request));
        }
예제 #19
0
        /// <summary>
        /// [Hieu.Van] Tồng hợp dữ liệu ăn
        /// </summary>
        /// <param name="request"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        //[HttpPost]
        public ActionResult GetLaundryRecordSummary([DataSourceRequest] DataSourceRequest request, Lau_LaundryRecordSearchModel model)
        {
            Lau_LaundryRecordServices LauService = new Lau_LaundryRecordServices();
            var baseService = new BaseService();
            var Actionservices = new ActionService(UserLogin);

            #region xử lý dateStart - dateEnd
            DateTime dateStart = DateTime.Now;
            DateTime dateEnd = DateTime.Now;
            if (model.DateFrom != null)
            {
                dateStart = model.DateFrom.Value;
            }
            if (model.DateTo != null)
            {
                dateEnd = model.DateTo.Value;
            }
            #endregion

            #region xử lý lấy lstProfileIds theo OrgStructureID
            List<Hre_ProfileEntity> lstProfileIDs = new List<Hre_ProfileEntity>();
            string status = string.Empty;
            List<object> lstObj = new List<object>();
            lstObj.Add(model.OrgStructureID);
            lstObj.Add(null);
            lstObj.Add(null);
            List<Hre_ProfileEntity> _temp = new List<Hre_ProfileEntity>();
            Hre_ProfileEntity t = new Hre_ProfileEntity();
            List<Hre_ProfileEntity> _profileIDs = new List<Hre_ProfileEntity>();
            var baseServices = new ActionService(UserLogin);
            if (model.ProfileIDs != null)
            {
                var lst = model.ProfileIDs.Split(',');
                foreach (var item in lst)
                {
                    t = new Hre_ProfileEntity();
                    Guid _Id = new Guid(item);
                    t.ID = _Id;
                    _temp.Add(t);
                }



                if (model.OrgStructureID != null)
                {

                    lstProfileIDs = Actionservices.GetData<Hre_ProfileEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).ToList();
                    _profileIDs = lstProfileIDs.Where(m => !_temp.Contains(m)).ToList();
                    lstProfileIDs.AddRange(_profileIDs);
                }
                else
                {
                    lstProfileIDs = _temp;
                }
            }
            else
            {
                lstProfileIDs = Actionservices.GetData<Hre_ProfileEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).ToList();
            }
            #endregion

            // Hàm xử lý tổng hợp
            var result = LauService.GetLaundryRecordSummary(model.LineID, model.LockerID, model.MarkerID, dateStart, dateEnd, lstProfileIDs, UserLogin).ToList().Translate<Lau_LaundryRecordModel>();
            if (result != null)
            {
                var submit = ConstantDisplay.HRM_Enum_Submit.TranslateString();
                var auto = ConstantDisplay.HRM_Enum_Auto.TranslateString();
                result.Where(s => s.Status == LaundryRecordStatus.E_SUBMIT.ToString()).Select(s => s.Status = submit).ToList();
                result.Where(s => s.Type == LaundryRecordType.E_AUTO.ToString()).Select(s => s.Type = auto).ToList();
            }
            #region xử lý xuất áo cáo
            if (model.IsExport)
            {
                var fullPath = ExportService.Export(result, model.ValueFields.Split(','));
                return Json(fullPath);
            }

            if (model.selectedIDs != null)
            {
                var strSelect = model.selectedIDs.Split(',');
                List<Guid> lstSelect = new List<Guid>();
                foreach (var item in strSelect)
                {
                    lstSelect.Add(new Guid(item));
                }
                var resultSelect = result.Where(m => lstSelect.Contains(m.ID)).ToList();
                var fullPath = ExportService.Export(resultSelect, model.ValueFields.Split(','));
                return Json(fullPath);
            }
            #endregion

            request.Page = 1;
            var dataSourceResult = result.ToDataSourceResult(request);
            //dataSourceResult.Total = result.Count() <= 0 ? 0 : result.FirstOrDefault().TotalRow;
            return Json(result.ToDataSourceResult(request));
        }
예제 #20
0
 /// <summary>
 /// [Tam.Le] - 8.4.2014 - Lấy dữ liệu Locker theo Line Id
 /// </summary>
 /// <param name="request"></param>
 /// <param name="model"></param>
 /// <returns></returns>
 public JsonResult GetLockerCascading(int lineId)
 {
     var baseServices = new ActionService(UserLogin);
     var result = new List<Lau_LockerModel>();
     string status = string.Empty;
     if (lineId > 0)
     {
         var baseService = new ActionService(UserLogin);
         var service = new Lau_LockerServices();
         result = baseServices.GetData<Lau_LockerModel>(lineId, ConstantSql.hrm_lau_sp_get_LockerByLineId, ref status);
     }
     return Json(result, JsonRequestBehavior.AllowGet);
 }
예제 #21
0
        /// <summary>
        /// [Hieu.Van]
        /// 3.5.3	Báo cáo Số lượng quần áo giặt
        /// </summary>
        /// <param name="request"></param>
        /// <param name="lauLineModel"></param>
        /// <returns></returns>
        //[HttpPost]
        public ActionResult GetReportSummaryClothing([DataSourceRequest] DataSourceRequest request, Lau_ReportSearchModel model)
        {
            Lau_ReportServices service     = new Lau_ReportServices();
            BaseService        baseService = new BaseService();
            var         baseServices       = new ActionService(UserLogin);
            bool        isIncludeQuitEmp   = model.isIncludeQuitEmp ? true : false;
            List <Guid> lstShift           = new List <Guid>();

            if (model.ShiftID != null)
            {
                var lst = model.ShiftID.Split(',');
                foreach (var item in lst)
                {
                    Guid _Id = new Guid(item);
                    lstShift.Add(_Id);
                }
            }

            #region xử lý dateStart - dateEnd
            DateTime dateStart = DateTime.Now;
            DateTime dateEnd   = DateTime.Now;
            if (model.DateFrom != null)
            {
                dateStart = model.DateFrom.Value;
            }
            if (model.DateTo != null)
            {
                dateEnd = model.DateTo.Value;
            }
            #endregion

            #region xử lý line - locker - marker

            List <Guid?> lstLine   = new List <Guid?>();
            List <Guid?> lstLocker = new List <Guid?>();
            List <Guid?> lstMarker = new List <Guid?>();

            if (model.LineID != null)
            {
                foreach (var line in model.LineID.Split(','))
                {
                    lstLine.Add(new Guid(line));
                }
            }
            if (model.LockerID != null)
            {
                foreach (var locker in model.LockerID.Split(','))
                {
                    lstLocker.Add(new Guid(locker));
                }
            }
            if (model.MarkerID != null)
            {
                foreach (var marker in model.MarkerID.Split(','))
                {
                    lstMarker.Add(new Guid(marker));
                }
            }

            #endregion

            #region xử lý lấy lstProfileIds theo OrgStructureID
            List <Guid>   lstProfileIDs = new List <Guid>();
            string        status        = string.Empty;
            List <object> lstObj        = new List <object>();
            lstObj.Add(model.OrgStructureID);
            lstObj.Add(null);
            lstObj.Add(null);
            List <Guid> _temp       = new List <Guid>();
            List <Guid> _profileIDs = new List <Guid>();

            if (model.ProfileIDs != null)
            {
                var lst = model.ProfileIDs.Split(',');
                foreach (var item in lst)
                {
                    Guid _Id = new Guid(item);
                    _temp.Add(_Id);
                }

                //_temp = lst.Select(int.Parse).ToList();

                if (model.OrgStructureID != null)
                {
                    lstProfileIDs = baseServices.GetData <Hre_ProfileIdEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(m => m.ID).ToList();
                    _profileIDs   = lstProfileIDs.Where(m => !_temp.Contains(m)).ToList();
                    lstProfileIDs.AddRange(_profileIDs);
                }
                else
                {
                    lstProfileIDs = _temp;
                }
            }
            else
            {
                lstProfileIDs = baseServices.GetData <Hre_ProfileIdEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(m => m.ID).ToList();
            }
            #endregion

            //Hàm xừ lý báo cáo
            var result = service
                         .GetReportSummaryClothing(lstLine, lstLocker, lstMarker, lstProfileIDs, dateStart, dateEnd, lstShift, isIncludeQuitEmp, UserLogin);

            var rs = result.Translate <Lau_ReportSummaryClothingModel>();

            #region xử lý xuất báo cáo

            if (model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(model.ExportID, rs);
                return(Json(fullPath));
            }

            #endregion

            var dataSourceResult = rs.ToDataSourceResult(request);
            return(Json(rs.ToDataSourceResult(request)));
        }
예제 #22
0
        public Hre_RelativesModel Post([Bind]Hre_RelativesModel model)
        {
            #region Validate
            string status = string.Empty;
            if (model.YearOfBirth != string.Empty && model.YearOfBirth.Length >= 10)
            {
                string[] ArrayYearOfBirth = model.YearOfBirth.Split('/').ToArray();
                ArrayYearOfBirth[2] = ArrayYearOfBirth[2].Substring(0, 4);
                if (ArrayYearOfBirth[0].Length < 2)
                {
                    ArrayYearOfBirth[0] = "0" + ArrayYearOfBirth[0];
                }
                if (ArrayYearOfBirth[1].Length < 2)
                {
                    ArrayYearOfBirth[1] = "0" + ArrayYearOfBirth[1];
                }
                string _tmp = ArrayYearOfBirth[1];
                ArrayYearOfBirth[1] = ArrayYearOfBirth[0];
                ArrayYearOfBirth[0] = _tmp;
                model.YearOfBirth = string.Join("/", ArrayYearOfBirth);

                //#region Kiểm tra tổi con nhỏ mà lớn hơn 18 tuổi thì không cho lưu

                //try
                //{
                //    DateTime bday = new DateTime(int.Parse(ArrayYearOfBirth[2]), int.Parse(ArrayYearOfBirth[1]), int.Parse(ArrayYearOfBirth[0]));
                //    DateTime today = DateTime.Today;
                //    int age = today.Year - int.Parse(ArrayYearOfBirth.LastOrDefault());
                //    if (bday > today.AddYears(-age))
                //    {
                //        age--;
                //    }
                //    if (age >= 18)
                //    {
                //        model.ActionStatus = "Con Nhỏ Không Thể Lớn Hơn 18 tuổi !";
                //        return model;
                //    }
                //}
                //catch
                //{

                //}
                //#endregion
            }
                
            var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Hre_RelativesModel>(model, "Hre_Relatives", ref status);
            if (!checkValidate)
            {
                model.ActionStatus = status;
                return model;
            }
            #endregion
            ActionService service = new ActionService(UserLogin);

            #region thêm hoặc update người phụ thuộc từ người thân
            if (model.CheckAddDependant.HasValue && model.CheckAddDependant.Value==false)
            {
                Hre_DependantServices Services1 = new Hre_DependantServices();
                Services1.AddOrUpdateDependant(model.Copy<Hre_RelativesEntity>());
            }
            #endregion

            #region Son.Vo - 20150120 - gán cột EmpCodeRelativesName = mã nv + tên người thân
            var entityprofilebyRelative = service.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(model.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, ref status).FirstOrDefault();
            string codeEmpByRelatives = entityprofilebyRelative != null ? entityprofilebyRelative.CodeEmp : string.Empty;
            model.EmpCodeRelativesName = codeEmpByRelatives + model.RelativeName; 
            #endregion

            var entity = service.GetData<Hre_RelativesEntity>(model.IDNo, ConstantSql.hrm_hr_sp_get_RelativesByIdNo, ref status);
   
             service.UpdateOrCreate<Hre_RelativesEntity, Hre_RelativesModel>(model);
            
            if (entity != null && entity.Count > 0)
            {
                model.ActionStatus += ",Số CMND đã tồn tại trong hệ thống";
            }
            return model;
        }
예제 #23
0
        public Sal_UnusualAllowanceModel Post([Bind]Sal_UnusualAllowanceModel model)
        {
            
            #region Validate
            string message = string.Empty;
            string status = string.Empty;
            ActionService service = new ActionService(UserLogin);
            var checkValidate=true;
            checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_UnusualAllowanceModel>(model, "Sal_UnusualAllowanceinfoNew", "Sal_UnusualAllowance", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return model;
            }
            if(model != null && model.UnusualEDTypeID !=null)
            {
                var entity = service.GetByIdUseStore<Cat_UnusualAllowanceCfgEntity>(model.UnusualEDTypeID.Value, ConstantSql.hrm_cat_sp_get_UnusualAllowanceCfgId, ref status);
                if (entity != null && entity.Code != null)
                {
                    if (entity.Code.Replace(" ", "") == "DEATHOFEMPLOYEE" || entity.Code.Replace(" ", "") == "HOSPITALOFEMPLOYEEMORETHANONEMONTH")
                    {
                        checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_UnusualAllowanceModel>(model, "Sal_UnusualAllowanceinfoNew2", "Sal_UnusualAllowance", ref message);

                    }
                    else
                    {
                        checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_UnusualAllowanceModel>(model, "Sal_UnusualAllowanceinfoNew1", "Sal_UnusualAllowance", ref message);
                    }
                    if (!checkValidate)
                    {
                        model.ActionStatus = message;
                        return model;
                    }
                    if (entity.Code.Replace(" ", "") == "BIRTHOFACHILD" || entity.Code.Replace(" ", "") == "DEATHOFEMPLOYEECHILD" || entity.Code.Replace(" ", "") == "DEATHOFEMPLOYEESPOUSE" || entity.Code.Replace(" ", "") == "FUNERALOFPARENT")
                    {
                        checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_UnusualAllowanceModel>(model, "Sal_UnusualAllowanceinfo1And2", "Sal_UnusualAllowance", ref message);
                        if(checkValidate == false)
                        {
                            checkValidate = true;
                            //lay thong tin cua quan he
                            var objRelativesModel = service.GetData<Hre_RelativesModel>(Common.DotNetToOracle(model.RelativeID.ToString()), ConstantSql.hrm_hr_sp_get_RelativesById, ref status).FirstOrDefault();
                            var checkValidateRelatives = true;
                            if (objRelativesModel != null)
                            {
                                //lay all nguoi than cua nv do
                                Hre_RelativesServices hreServiveRelative = new Hre_RelativesServices();
                                var lstRelativeByProfileId = hreServiveRelative.GetRelativeByProfileId(model.ProfileID).ToList();
                                if (lstRelativeByProfileId.Count>0)
                                {
                                    //if (model.ID == Guid.Empty)
                                    //    objRelativesModel.ID = Guid.Empty;
                                    var lstDuplicateRelativeByProfileID=lstRelativeByProfileId.
                                        Where(s=>s.ProfileID==objRelativesModel.ProfileID && s.RelativeName==objRelativesModel.RelativeName && s.YearOfBirth==objRelativesModel.YearOfBirth).ToList();
                                    if(lstDuplicateRelativeByProfileID.Count>0)
                                        checkValidateRelatives=false;
                                }
                              //  checkValidateRelatives = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Hre_RelativesModel>(objRelativesModel, "Hre_Relativesinfo1And2", "Hre_Relatives", ref message);
                            }
                            if (checkValidateRelatives == false)
                            {
                                model.ActionStatus = message;
                                return model;
                            }
                        }
                    }
                    else if (entity.Code.Replace(" ", "")=="HOSPITALOFEMPLOYEEMORETHANONEMONTH")
                    {
                        Sal_ReportService salService = new Sal_ReportService();
                        int _daysInMonth = System.DateTime.DaysInMonth(model.DateOccur.Value.Year, model.DateOccur.Value.Month);
                        DateTime _datestart = new DateTime(model.DateOccur.Value.Year, model.DateOccur.Value.Month, 1);
                        DateTime _dateend = new DateTime(model.DateOccur.Value.Year, model.DateOccur.Value.Month, _daysInMonth);
                        //List<object> paraUnusualAllowance = new List<object>();
                        //paraUnusualAllowance.AddRange(new object[7]);
                        //paraUnusualAllowance[2] = model.UnusualEDTypeID;
                        //paraUnusualAllowance[3] = _datestart;
                        //paraUnusualAllowance[4] = _dateend;
                        //paraUnusualAllowance[5] = 1;
                        //paraUnusualAllowance[6] = int.MaxValue;
                        Sal_UnusualAllowanceServices salServiceUnusualAllowance = new Sal_UnusualAllowanceServices();
                        //var lstUnusualAllowance = salServiceUnusualAllowance.GetData<Sal_UnusualAllowanceEntity>(paraUnusualAllowance, ConstantSql.hrm_sal_sp_get_UnusualAllowanceFilialWedding, ref status);
                        var lstUnusualAllowance = salServiceUnusualAllowance.GetUnusualAllowanceByUnusualEDTypeIDAndDateOccur(model.ProfileID,model.UnusualEDTypeID, _datestart, _dateend);
                        if (lstUnusualAllowance != null)
                        {
                            //lstUnusualAllowance = lstUnusualAllowance.Where(s => s.ProfileID == model.ProfileID).ToList();
                            if ((lstUnusualAllowance.Count > 0 && model.ID == Guid.Empty) || (lstUnusualAllowance.Count > 1 && model.ID != Guid.Empty))
                            {
                                checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_UnusualAllowanceModel>(model, "Sal_UnusualAllowanceinfo3", "Sal_UnusualAllowance", ref message);
                                if (!checkValidate)
                                {
                                    model.ActionStatus = message;
                                    return model;
                                }
                            }
                        }
                    }
                    else if (entity.Code.Replace(" ", "") == "MARRIAGEOFEMPLOYEE" || entity.Code.Replace(" ", "") == "DEATHOFEMPLOYEE")
                    {
                        checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_UnusualAllowanceModel>(model, "Sal_UnusualAllowanceinfo5And6And7", "Sal_UnusualAllowance", ref message);
                    }
                }
             
            }
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return model;
            }
            #endregion
        
            return service.UpdateOrCreate<Sal_UnusualAllowanceEntity, Sal_UnusualAllowanceModel>(model);
        }
예제 #24
0
        public Hre_HDTJobModel Post([Bind]Hre_HDTJobModel model)
        {
            bool warning = false;
            string status = string.Empty;
            #region Validate
            string message = string.Empty;
            var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Hre_HDTJobModel>(model, "Hre_HDTJob", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return model;
            }
            #endregion
            ActionService service = new ActionService(UserLogin);
            #region Kiểm tra quyền duyệt trong quá khi khi tạo HDT trong quá khứ

            if (model.DateFrom < DateTime.Now.Date)
            {
                List<object> lstobjUA = new List<object>();
                lstobjUA.Add(Common.DotNetToOracle(model.UserLoginID));
                lstobjUA.Add(ApproveType.E_HDTJOB_PAST.ToString());
                lstobjUA.Add(1);
                lstobjUA.Add(Int32.MaxValue - 1);
                var checkPermission = service.GetData<Sys_UserApproveEntity>(lstobjUA, ConstantSql.hrm_sys_sp_get_UserApprove, ref status);
                if (checkPermission == null || checkPermission.Count == 0)
                {
                    model.ActionStatus = ConstantDisplay.HRM_NotHavePermissionToCreatePastHDT.TranslateString();
                    return model;
                }
            }

            #endregion
            var baseService = new BaseService();
            var result = baseService.GetData<Hre_HDTJobEntity>(Common.DotNetToOracle(model.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_HDTJobsByProfileId, UserLogin, ref status).ToList();
            string ActionStatus = null;

            if (result.Count > 0)
            {
                foreach (var item in result)
                {
                    #region Validate theo task 0050045
                    if (((model.ID != item.ID) && (item.DateFrom != null && item.DateTo != null && item.DateFrom <= model.DateFrom && model.DateFrom <= item.DateTo)
                                    || (model.DateFrom <= item.DateFrom && item.DateFrom <= model.DateTo && model.DateFrom != item.DateFrom)) && (item.StatusOut != HDTJobStatus.E_APPROVE.ToString()))
                    {
                        ActionStatus = ConstantDisplay.HRM_ProfileNotOutOfOldHDT.TranslateString();
                    }
                    if (((model.ID != item.ID) && (item.DateFrom != null && item.DateTo != null && item.DateFrom <= model.DateFrom && model.DateFrom <= item.DateTo)
                                   || (model.DateFrom <= item.DateFrom && item.DateFrom <= model.DateTo && model.DateFrom != item.DateFrom)) && (item.StatusOut == HDTJobStatus.E_APPROVE.ToString()))
                    {
                        ActionStatus = ConstantDisplay.HRM_DuplidateTimeHDT.TranslateString();
                    } 
                    #endregion

                    #region Validate theo task 0050038
                    if (item.StatusOut != HDTJobStatus.E_APPROVE.ToString())
                    {
                        ActionStatus = ConstantDisplay.HRM_StatusOldNotApproved.TranslateString();
                    } 
                    #endregion
                }

            }
            if (ActionStatus != null)
            {
                model.ActionStatus = ActionStatus;
                return model;
            }

            var HDT = service.UpdateOrCreate<Hre_HDTJobEntity, Hre_HDTJobModel>(model);
            return HDT;
        }
예제 #25
0
        /// <summary>
        /// [Hieu.Van] Tồng hợp dữ liệu ăn
        /// </summary>
        /// <param name="request"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        //[HttpPost]
        public ActionResult GetLaundryRecordSummary([DataSourceRequest] DataSourceRequest request, Lau_LaundryRecordSearchModel model)
        {
            Lau_LaundryRecordServices LauService = new Lau_LaundryRecordServices();
            var baseService    = new BaseService();
            var Actionservices = new ActionService(UserLogin);

            #region xử lý dateStart - dateEnd
            DateTime dateStart = DateTime.Now;
            DateTime dateEnd   = DateTime.Now;
            if (model.DateFrom != null)
            {
                dateStart = model.DateFrom.Value;
            }
            if (model.DateTo != null)
            {
                dateEnd = model.DateTo.Value;
            }
            #endregion

            #region xử lý lấy lstProfileIds theo OrgStructureID
            List <Hre_ProfileEntity> lstProfileIDs = new List <Hre_ProfileEntity>();
            string        status = string.Empty;
            List <object> lstObj = new List <object>();
            lstObj.Add(model.OrgStructureID);
            lstObj.Add(null);
            lstObj.Add(null);
            List <Hre_ProfileEntity> _temp       = new List <Hre_ProfileEntity>();
            Hre_ProfileEntity        t           = new Hre_ProfileEntity();
            List <Hre_ProfileEntity> _profileIDs = new List <Hre_ProfileEntity>();
            var baseServices = new ActionService(UserLogin);
            if (model.ProfileIDs != null)
            {
                var lst = model.ProfileIDs.Split(',');
                foreach (var item in lst)
                {
                    t = new Hre_ProfileEntity();
                    Guid _Id = new Guid(item);
                    t.ID = _Id;
                    _temp.Add(t);
                }



                if (model.OrgStructureID != null)
                {
                    lstProfileIDs = Actionservices.GetData <Hre_ProfileEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).ToList();
                    _profileIDs   = lstProfileIDs.Where(m => !_temp.Contains(m)).ToList();
                    lstProfileIDs.AddRange(_profileIDs);
                }
                else
                {
                    lstProfileIDs = _temp;
                }
            }
            else
            {
                lstProfileIDs = Actionservices.GetData <Hre_ProfileEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).ToList();
            }
            #endregion

            // Hàm xử lý tổng hợp
            var result = LauService.GetLaundryRecordSummary(model.LineID, model.LockerID, model.MarkerID, dateStart, dateEnd, lstProfileIDs, UserLogin).ToList().Translate <Lau_LaundryRecordModel>();
            if (result != null)
            {
                var submit = ConstantDisplay.HRM_Enum_Submit.TranslateString();
                var auto   = ConstantDisplay.HRM_Enum_Auto.TranslateString();
                result.Where(s => s.Status == LaundryRecordStatus.E_SUBMIT.ToString()).Select(s => s.Status = submit).ToList();
                result.Where(s => s.Type == LaundryRecordType.E_AUTO.ToString()).Select(s => s.Type         = auto).ToList();
            }
            #region xử lý xuất áo cáo
            if (model.IsExport)
            {
                var fullPath = ExportService.Export(result, model.ValueFields.Split(','));
                return(Json(fullPath));
            }

            if (model.selectedIDs != null)
            {
                var         strSelect = model.selectedIDs.Split(',');
                List <Guid> lstSelect = new List <Guid>();
                foreach (var item in strSelect)
                {
                    lstSelect.Add(new Guid(item));
                }
                var resultSelect = result.Where(m => lstSelect.Contains(m.ID)).ToList();
                var fullPath     = ExportService.Export(resultSelect, model.ValueFields.Split(','));
                return(Json(fullPath));
            }
            #endregion

            request.Page = 1;
            var dataSourceResult = result.ToDataSourceResult(request);
            //dataSourceResult.Total = result.Count() <= 0 ? 0 : result.FirstOrDefault().TotalRow;
            return(Json(result.ToDataSourceResult(request)));
        }
예제 #26
0
        public ActionResult ComputeSumryMealRecord(Guid CutoffdurationID, string OrgStructureID)
        {
            BaseService baseservices = new BaseService();
            var Actionservices = new ActionService(UserLogin);
            string status = string.Empty;
            List<object> listModel = new List<object>();
            listModel.AddRange(new object[18]);
            listModel[2] = OrgStructureID;
            listModel[16] = 1;
            listModel[17] = Int32.MaxValue - 1;
            List<Hre_ProfileEntity> ListProfile = Actionservices.GetData<Hre_ProfileEntity>(listModel, ConstantSql.hrm_hr_sp_get_Profile, ref status);

            Can_ReportServices CanteenServices = new Can_ReportServices();
            bool result = CanteenServices.SaveSumryMealRecord(CutoffdurationID, ListProfile.Select(m => m.ID).ToList());
            return Json(result, JsonRequestBehavior.AllowGet);
        }
예제 #27
0
        public ActionResult GetMealRecordMissingList([DataSourceRequest] DataSourceRequest request, Can_MealRecordMissingSearchModel model)
        {
            var service = new Can_MealRecordMissingServices();
            var hrService = new Hre_ProfileServices();
            DateTime DateFrom = SqlDateTime.MinValue.Value;
            DateTime DateTo = SqlDateTime.MaxValue.Value;
            if (model.DateFrom != null)
            {
                DateFrom = model.DateFrom.Value;
            }
            if (model.DateTo != null)
            {
                DateTo = model.DateTo.Value;
            }
            //string strOrgIDs = Common.ListToString(model.OrgStructureID);
            #region xử lý lấy lstProfileIds theo OrgStructureID
            List<Guid> lstProfileIDs = new List<Guid>();
            string status = string.Empty;
            List<object> lstObj = new List<object>();

            //lstObj.Add(strOrgIDs); 
            lstObj.Add(model.OrgStructureID);
            lstObj.Add(null);
            lstObj.Add(null);
            List<Guid> _temp = new List<Guid>();
            List<Guid> _profileIDs = new List<Guid>();
            var baseService = new ActionService(UserLogin);
            if (model.ProfileIDSearch != null)
            {
                var lst = model.ProfileIDSearch.Split(',');
                _temp = lst.Select(Guid.Parse).ToList();

                if (model.OrgStructureID != null)
                {
                    lstProfileIDs = baseService.GetData<Hre_ProfileIdEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(m => m.ID).ToList();
                    _profileIDs = lstProfileIDs.Where(m => !_temp.Contains(m)).ToList();
                    lstProfileIDs.AddRange(_profileIDs);
                }
                else
                {
                    lstProfileIDs = _temp;
                }
            }
            else
            {
                lstProfileIDs = baseService.GetData<Hre_ProfileIdEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(m => m.ID).ToList();
            }
            #endregion
            // var result = service.GetAllUseEntity<Can_MealRecordMissingEntity>(ref status);

            service.ComputeMealRecordMissing(lstProfileIDs,
                DateFrom,
                DateTo,
                model.TamScanReasonMissID,
                model.Status,
                model.MealAllowanceTypeSettingID);
            return Json(true);
        }
예제 #28
0
        /// <summary>
        /// [Hieu.Van] Tồng hợp dữ liệu ăn
        /// </summary>
        /// <param name="request"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        //[HttpPost]
        public ActionResult GetMealRecordSummary([DataSourceRequest] DataSourceRequest request, Can_MealRecordSummaryModel model)
        {

            Can_MealRecordServices CanService = new Can_MealRecordServices();
            var baseService = new BaseService();
            var Actionservices = new ActionService(UserLogin);
            DateTime dateStart = DateTime.Now;
            DateTime dateEnd = DateTime.Now;
            List<int?> OrgIds = new List<int?>();
            if (model.DateFrom != null)
            {
                dateStart = model.DateFrom.Value;
            }
            if (model.DateTo != null)
            {
                dateEnd = model.DateTo.Value;
            }

            #region xử lý lấy lstProfileIds theo OrgStructureID
            List<Hre_ProfileEntity> lstProfileIDs = new List<Hre_ProfileEntity>();
            string status = string.Empty;
            List<object> lstObj = new List<object>();
            lstObj.Add(model.OrgStructureIDs);
            lstObj.Add(null);
            lstObj.Add(null);
            List<Hre_ProfileEntity> _temp = new List<Hre_ProfileEntity>();
            Hre_ProfileEntity t = new Hre_ProfileEntity();
            List<Hre_ProfileEntity> _profileIDs = new List<Hre_ProfileEntity>();

            if (model.ProfileIDs != null)
            {
                var lst = model.ProfileIDs.Split(',');
                foreach (var item in lst)
                {
                    t = new Hre_ProfileEntity();
                    Guid _Id = new Guid(item);
                    t.ID = _Id;
                    _temp.Add(t);
                }

                if (model.OrgStructureIDs != null)
                {
                    lstProfileIDs = Actionservices.GetData<Hre_ProfileEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).ToList();
                    _profileIDs = lstProfileIDs.Where(m => !_temp.Contains(m)).ToList();
                    lstProfileIDs.AddRange(_profileIDs);
                }
                else
                {
                    lstProfileIDs = _temp;
                }
            }
            else
            {
                lstProfileIDs = Actionservices.GetData<Hre_ProfileEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).ToList();
            }
            #endregion

            var result = CanService.GetMealRecordSummary(model.LineID, model.CateringID, model.CanteenID, dateStart, dateEnd, lstProfileIDs,UserLogin).ToList().Translate<Can_MealRecordModel>();

            if (model.IsExport)
            {
                var fullPath = ExportService.Export(result, model.ValueFields.Split(','));
                return Json(fullPath);
            }

            if (model.selectedIDs != null)
            {
                var strSelect = model.selectedIDs.Split(',');
                List<Guid> lstSelect = new List<Guid>();
                foreach (var item in strSelect)
                {
                    lstSelect.Add(Guid.Parse(item));
                }
                var resultSelect = result.Where(m => lstSelect.Contains(m.ID)).ToList();
                var fullPath = ExportService.Export(resultSelect, model.ValueFields.Split(','));
                return Json(fullPath);
            }

            //request.Page = 1;
            var dataSourceResult = result.ToDataSourceResult(request);
            //dataSourceResult.Total = result.Count() <= 0 ? 0 : result.FirstOrDefault().TotalRow;
            return Json(result.ToDataSourceResult(request));
        }
예제 #29
0
        public ActionResult GetPurchaseRequestItemByPurchaseRequestID([DataSourceRequest] DataSourceRequest request, Guid PurchaseRequestID)
        {

            string status = string.Empty;
            var actionService = new ActionService(UserLogin);
            var objs = new List<object>();
            objs.Add(PurchaseRequestID);
            var result = actionService.GetData<Fin_PurchaseRequestItemModel>(objs, ConstantSql.hrm_cat_sp_get_PRItemByPRID, ref status);
            return Json(result.ToDataSourceResult(request));
        }
예제 #30
0
        public ActionResult GetReportAdjustmentMealAllowancePayment([DataSourceRequest] DataSourceRequest request, Can_ReportAdjustmentMealAllowancePaymentModel Model)
        {
            var service = new Can_ReportServices();
            var hrService = new Hre_ProfileServices();
            var Actionservices = new ActionService(UserLogin);
            ListQueryModel lstModel = new ListQueryModel
            {
                PageIndex = request.Page,
                PageSize = request.PageSize,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request)
            };
            DateTime From = SqlDateTime.MinValue.Value;
            DateTime To = SqlDateTime.MaxValue.Value;
            if (Model.DateFrom != null)
            {
                From = Model.DateFrom.Value;
            }
            if (Model.DateTo != null)
            {
                To = Model.DateTo.Value;
            }
            List<Guid?> OrgIds = new List<Guid?>();
            if (Model.OrgStructureID != null && Model.OrgStructureID.Count() > 0)
            {
                OrgIds = Model.OrgStructureID;
            }
            string strOrgIDs = Common.ListToString(OrgIds);
            string profileName = string.Empty;
            string codeEmp = string.Empty;
            if (Model.ProfileName != string.Empty)
            {
                profileName = Model.ProfileName;
            }

            if (Model.CodeEmp != string.Empty)
            {
                codeEmp = Model.CodeEmp;
            }
            List<Guid> lstProfileIDs = new List<Guid>();
            List<Object> Lstsearch = new List<object>();
            Lstsearch.Add(strOrgIDs);
            Lstsearch.Add(profileName);
            Lstsearch.Add(codeEmp);
            if (Model.OrgStructureID != null)
            {
                string status = string.Empty;
                lstProfileIDs = Actionservices.GetData<Hre_ProfileIdEntity>(Lstsearch, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(s => s.ID).ToList();
            }
            var result = service.ReportAdjustmentMealAllowancePayment(From, To, lstProfileIDs);
            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, result);
                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
예제 #31
0
 public ActionResult GetAppendixContractByContractList([DataSourceRequest] DataSourceRequest request, Guid? ContractID)
 {
     if (ContractID != null)
     {
         string status = string.Empty;
         var actionService = new ActionService(UserLogin);
         var objs = new List<object>();
         objs.Add(ContractID);
         var result = actionService.GetData<Hre_AppendixContractEntity>(objs, ConstantSql.hrm_cat_sp_get_AppendixContractByContractID, ref status);
         return Json(result.ToDataSourceResult(request));
     }
     return null;
 }
예제 #32
0
        public ActionResult GetReportMultiSlideCard([DataSourceRequest] DataSourceRequest request, Can_ReportMultiSlideCardSearchModel Model)
        {
            var service = new Can_ReportServices();
            var hrService = new Hre_ProfileServices();
            var Actionservices = new ActionService(UserLogin);
            ListQueryModel lstModel = new ListQueryModel
            {
                PageIndex = request.Page,
                PageSize = request.PageSize,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request)
            };
            DateTime From = SqlDateTime.MinValue.Value;
            DateTime To = SqlDateTime.MaxValue.Value;
            if (Model.DateFrom != null)
            {
                From = Model.DateFrom.Value;
            }
            if (Model.DateTo != null)
            {
                To = Model.DateTo.Value;
            }
            List<Guid?> OrgIds = new List<Guid?>();
            if (Model.OrgStructureID != null && Model.OrgStructureID.Count() > 0)
            {
                OrgIds = Model.OrgStructureID;
            }
            string strOrgIDs = Common.ListToString(OrgIds);
            string status = string.Empty;
            string profilename = null;
            string codeemp = null;
            List<object> objectsearch = new List<object>();
            objectsearch.Add(strOrgIDs);
            objectsearch.Add(profilename);
            objectsearch.Add(codeemp);
            List<Guid> lstProfileIDs = Actionservices.GetData<Hre_ProfileIdEntity>(objectsearch, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(s => s.ID).ToList();
            var result = service.ReportMultiSlideCard(Model.CateringID, Model.CanteenID, Model.LineID, Model.WorkPlaceID, From, To, lstProfileIDs, Model.IsIncludeQuitEmp);
            var rs = result.Translate<Can_ReportMultiSlideCardModel>();

            #region xử lý xuất báo cáo

            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, rs);
                return Json(fullPath);
            }
            #endregion
            request.Page = 1;
            var dataSourceResult = result.ToDataSourceResult(request);
            return Json(rs.ToDataSourceResult(request));
        }
예제 #33
0
        public Hre_ContractModel Put([Bind] Hre_ContractModel model)
        {
            var    ContractServices = new Hre_ContractServices();
            string status           = string.Empty;
            string id = string.Empty;

            foreach (var item in model.selecteIds)
            {
                id += Common.DotNetToOracle(item.ToString()) + ",";
            }
            id = id.Substring(0, id.Length - 1);
            string type           = model.Status;
            var    service        = new BaseService();
            var    actionServices = new ActionService(UserLogin);

            if (model.ID == Guid.Empty)
            {
                model.DateExtend = model.DateEnd;
            }

            var objContract = new List <object>();

            objContract.AddRange(new object[2]);
            objContract[0] = 1;
            objContract[1] = int.MaxValue - 1;
            var lstContracts = actionServices.GetData <Hre_ContractEntity>(objContract, ConstantSql.hrm_hr_sp_get_ContractData, ref status).ToList();

            if (!string.IsNullOrEmpty(id))
            {
                try
                {
                    var idItem = id.Split(',');
                    for (int i = 0; i < idItem.Count(); i++)
                    {
                        var idInt = idItem[i];
                        if (idInt != null)
                        {
                            var entity = lstContracts.Where(s => s.ID != null && Common.DotNetToOracle(s.ID.ToString()) == idInt).FirstOrDefault();
                            var lstContractByProfileID = lstContracts.Where(s => s.ProfileID == entity.ProfileID && s.Status == EnumDropDown.Status.E_APPROVED.ToString()).ToList();
                            var listIdContract         = string.Empty;
                            if (lstContractByProfileID.Count > 0)
                            {
                                listIdContract = string.Join(",", lstContractByProfileID.Select(d => d.ContractTypeID));
                            }

                            entity        = ContractServices.SetNewCodeContract(entity, listIdContract, UserLogin);
                            entity.Status = type;
                            if (!string.IsNullOrEmpty(entity.ContractNo))
                            {
                                // Theo task 0049504 - chỉ edit lại cột TimesContract nếu hd loại có thời hạn
                                if (entity.ContractTypeID != null)
                                {
                                    var contracttypeBycontract = actionServices.GetData <Cat_ContractTypeEntity>(Common.DotNetToOracle(entity.ContractTypeID.ToString()), ConstantSql.hrm_cat_sp_get_ContractTypeById, ref status).FirstOrDefault();
                                    if (contracttypeBycontract != null && contracttypeBycontract.Type == HRM.Infrastructure.Utilities.EnumDropDown.TypeContract.E_DURATION.ToString())
                                    {
                                        try
                                        {
                                            string times = entity.ContractNo.Substring(entity.ContractNo.Length - 1, 1);
                                            int    Year  = int.Parse(times);
                                            entity.TimesContract = Year;
                                        }
                                        catch
                                        {
                                        }
                                    }
                                }
                            }
                            status = ContractServices.Edit(entity);
                            model.SetPropertyValue(Constant.ActionStatus, status);
                        }
                    }
                }
                catch (Exception ex)
                {
                    model.SetPropertyValue(Constant.ActionStatus, NotificationType.Error.ToString() + "," + ex.Message);
                }
            }

            return(model);
        }