Exemplo n.º 1
0
        public ActionResult ExportIns_ReportInsuranceTrackingMonthly([DataSourceRequest] DataSourceRequest request, Ins_ReportInsuranceTrackingMonthlySearchModel model)
        {

            var services = new Ins_InsuranceReportServices();
            var result = services.Ins_ReportInsuranceTrackingMonthlyLoadData(model.OrgStructureID, model.MonthYearFrom, model.MonthYearTo, model.IsProfileQuit, model.CodeEmp, model.WorkPlaceIDs,UserLogin);
            var lstModel = new List<Ins_ReportInsuranceTrackingMonthlySearchModel>();
            if (result != null)
            {
                lstModel = result.Translate<Ins_ReportInsuranceTrackingMonthlySearchModel>();
                //  return Json(lstModel, JsonRequestBehavior.AllowGet);
            }
            var isDataTable = false;
            object obj = new Ins_ReportInsuranceTrackingMonthlySearchModel();

            if (model.IsCreateTemplateForDynamicGrid)
            {
                obj = result;
                isDataTable = true;
            }
            if (model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Ins_ReportInsuranceTrackingMonthly",
                    OutPutPath = path,
                    DownloadPath = "Templates",
                    IsDataTable = isDataTable

                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            if (model.ExportId.HasValue && model.ExportId.Value != Guid.Empty)
            {
                var fullPath = ExportService.Export(model.ExportId.Value, result, null, ExportFileType.Excel);
                return Json(fullPath);
            }
            return Json(lstModel.ToDataSourceResult(request));
        }
Exemplo n.º 2
0
 public ActionResult Ins_ReportInsuranceTrackingMonthlyValidate([DataSourceRequest] DataSourceRequest request, Ins_ReportInsuranceTrackingMonthlySearchModel model)
 {
     #region Validate
     string message = string.Empty;
     var checkValidate = ValidatorService.OnValidateData<Ins_ReportInsuranceTrackingMonthlySearchModel>(model, "Ins_ReportInsuranceTrackingMonthly", ref message);
     if (!checkValidate)
     {
         var ls = new object[] { "error", message };
         return Json(ls);
     }
     #endregion
     return Json(message);
 }
Exemplo n.º 3
0
        public JsonResult GetIns_ReportInsuranceTrackingMonthly([DataSourceRequest] DataSourceRequest request, Ins_ReportInsuranceTrackingMonthlySearchModel model)
        {
            try
            {
                if (!string.IsNullOrEmpty(model.StrSocialInsPlaceIDs))
                {
                    var socialInsPlaceIDs = model.StrSocialInsPlaceIDs.Split(',');
                    List<Guid> socailInsPlaceIDsTemp = new List<Guid>();
                    if (socialInsPlaceIDs.Length > 0)
                    {
                        foreach (var item in socialInsPlaceIDs)
                        {
                            Guid gTemp = new Guid();
                            gTemp = Guid.Empty;
                            Guid.TryParse(item, out gTemp);
                            if (gTemp != Guid.Empty)
                            {
                                socailInsPlaceIDsTemp.Add(gTemp);
                            }
                        }
                        if (socailInsPlaceIDsTemp.Any())
                        {
                            model.SocialInsPlaceIDs = socailInsPlaceIDsTemp;
                        }
                    }
                }


                var service = new Ins_InsuranceReportServices();
                var result = service.Ins_ReportInsuranceTrackingMonthlyLoadData(model.OrgStructureID, model.MonthYearFrom, model.MonthYearTo, model.IsProfileQuit, model.CodeEmp, model.SocialInsPlaceIDs,UserLogin);
                return Json(result.ToDataSourceResult(request));
            }
            catch
            {
                return Json(null);
            }
        }