Пример #1
0
        public ActionResult AnalyzeInsuranceValidate([DataSourceRequest] DataSourceRequest request, Ins_ProfileInsuranceMonthlySearchModel model)
        {
            #region Validate
            string message = string.Empty;
            var codeEmp = Request[Ins_ProfileInsuranceMonthlyModel.FieldNames.CodeEmp] != null ? Request[Ins_ProfileInsuranceMonthlyModel.FieldNames.CodeEmp].ToString() : string.Empty;

            if (model.OrgStructureID == null && string.IsNullOrEmpty(codeEmp))
            {
                var ls = new object[] { "error", ConstantDisplay.OrgNEmpCodeNotAllowNull.TranslateString() };
                return Json(ls);
            }
            else
            {
                var checkValidate = ValidatorService.OnValidateData<Ins_ProfileInsuranceMonthlySearchModel>(model, "AnalyzeInsurance", ref message);
                if (!checkValidate)
                {
                    var ls = new object[] { "error", message };
                    return Json(ls);
                }
            }

            #endregion
            return Json(message);
        }
Пример #2
0
        public ActionResult AnalyzeInsurance([DataSourceRequest] DataSourceRequest request, Ins_ProfileInsuranceMonthlySearchModel model)
        {
            var messageReturn = "Success";

            var insService = new InsuranceServices();
            var dateCheck = DateTime.Now;
            string orgs = null;
            var periodInsurance = string.Empty;
            var codeEmp = string.Empty;
            if (model != null)
            {
                if (model.MonthYear.HasValue)
                {
                    dateCheck = model.MonthYear.Value;
               }
                orgs = model.OrgStructureID;
                periodInsurance = Request["PeriodInsurance"] != null ? Request["PeriodInsurance"].ToString() : string.Empty;
                codeEmp = Request[Ins_ProfileInsuranceMonthlyModel.FieldNames.CodeEmp] != null ? Request[Ins_ProfileInsuranceMonthlyModel.FieldNames.CodeEmp].ToString() : string.Empty;
            }
            try
            {
                if (_isProcessing == false)
                {
                    _isProcessing = true;
                    insService.AnalyzeAndSaveInsuranceByMonth(orgs, dateCheck, periodInsurance, codeEmp, model.SocialInsPlaceIDs,UserLogin);
                }
                else
                {
                    messageReturn = "IsProcessing";
                }
            }
            catch (Exception)
            {
                _isProcessing = false;
            }
            _isProcessing = false;

            return Json(messageReturn);
        }
Пример #3
0
        public ActionResult AnalyzeInsuranceList([DataSourceRequest] DataSourceRequest request, Ins_ProfileInsuranceMonthlySearchModel model)
        {
            string status = string.Empty;
            var socialInsPlaceIDs = model.SocialInsPlaceIDs;
            var hrService = new Hre_ProfileServices();
            var services = new ActionService(UserLogin);
            List<object> listObj = new List<object>();
            listObj.AddRange(new object[5]);
            listObj[0] = model.OrgStructureID;
            listObj[1] = model.MonthYear;
            listObj[3] = 1;
            listObj[4] = Int32.MaxValue - 1;
            var result = services.GetData<Ins_ProfileInsuranceMonthlyModel>(listObj, ConstantSql.hrm_ins_sp_get_ProfileInsMonthly, ref status);
            result = result.Where(m => (m.IsSocialInsurance.HasValue && m.IsSocialInsurance.Value)).ToList();

            socialInsPlaceIDs=socialInsPlaceIDs.Where(m=>m != Guid.Empty).ToList();
            if (socialInsPlaceIDs.Any())
            {
                result = result.Where(m => socialInsPlaceIDs.Contains(m.SocialInsPlaceID ?? Guid.Empty)).ToList();    
            }           
            
            foreach (var item in result)
            {
                if (item.IsSocialInsurance.HasValue && !item.IsSocialInsurance.Value)
                {
                    item.SalaryInsurance = null;
                    item.SalaryHealthInsurance = null;
                }
                if (item.IsUnEmpInsurance.HasValue && !item.IsUnEmpInsurance.Value)
                {
                    item.SalaryUnEmpInsurance = null;
                }
            }

            //GetListData<Ins_ProfileInsuranceMonthlyModel, Ins_ProfileInsuranceMonthlyEntity, Ins_ProfileInsuranceMonthlySearchModel>(model, ConstantSql.hrm_ins_sp_get_ProfileInsMonthly, ref status);
            if (result.Any())
            {
                var codeEmp = Request[Ins_ProfileInsuranceMonthlyModel.FieldNames.CodeEmp] != null ? Request[Ins_ProfileInsuranceMonthlyModel.FieldNames.CodeEmp].ToString() : string.Empty;
                if (!string.IsNullOrEmpty(codeEmp))
                {
                    result = result.Where(p => p.CodeEmp == codeEmp).ToList();
                }
            }
            return Json(result.ToDataSourceResult(request));
        }
Пример #4
0
 public ActionResult ExportAnalyzeInsuranceList([DataSourceRequest] DataSourceRequest request, Ins_ProfileInsuranceMonthlySearchModel model)
 {
     return ExportAllAndReturn<Ins_ProfileInsuranceMonthlyModel, Ins_ProfileInsuranceMonthlyEntity, Ins_ProfileInsuranceMonthlySearchModel>(request, model, ConstantSql.hrm_ins_sp_get_ProfileInsMonthly);
 }