예제 #1
0
 public JsonResult GetProfileInfo(Guid profileId)
 {
     var service = new Hre_ProfileServices();
     string status = string.Empty;
     var profileInfo = service.GetProfileInfo(profileId, UserLogin);
     return Json(profileInfo, JsonRequestBehavior.AllowGet);
 }
예제 #2
0
        /// <summary> BC Đủ Điều Kiện Tham Gia Bảo Hiểm Theo Tháng </summary>
        /// <param name="request"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult ReportJoinInsuranceMonthly([DataSourceRequest] DataSourceRequest request, Ins_ReportJoinInsuranceMonthlyModel model)
        {
            var services = new Ins_InsuranceReportServices();
            List<HeaderInfo> listHeaderInfo = null;
            var result = services.ReportJoinInsuranceMonthly(model.OrgStructureID, model.MonthYear.Value, model.CodeEmp, model.SocialInsPlaceIDs,UserLogin);
            var lstModel = new List<Ins_ReportJoinInsuranceMonthlyModel>();
            if (result != null)
            {
                lstModel = result.Translate<Ins_ReportJoinInsuranceMonthlyModel>();
                lstModel = lstModel.OrderBy(p => p.STT).ToList();
            }
            var isDataTable = false;
            object obj = new Ins_ReportJoinInsuranceMonthlyModel();

            #region Header Info
            var codeEmp = string.Empty;
            if (model != null && model.UserID != Guid.Empty)
            {
                Hre_ProfileServices profileService = new Hre_ProfileServices();
                var profile = profileService.GetProfileInfo(model.UserID,UserLogin);
                if (profile != null && !string.IsNullOrEmpty(profile.CodeEmp))
                {
                    codeEmp = profile.CodeEmp;
                }
            }
            HeaderInfo headerInfoMonthYear = new HeaderInfo() { Name = "MonthYear", Value = model.MonthYear };
            HeaderInfo headerInfoCurrentDate = new HeaderInfo() { Name = "CurrentDate", Value = DateTime.Now };
            HeaderInfo headerInfoCodeEmp = new HeaderInfo() { Name = "CodeEmp", Value = codeEmp };
            listHeaderInfo = new List<HeaderInfo>() { headerInfoMonthYear, headerInfoCurrentDate, headerInfoCodeEmp };
            #endregion

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

                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            if (model.ExportId != Guid.Empty)
            {
                var fullPath = ExportService.Export(model.ExportId, lstModel, listHeaderInfo, model.ExportType);
                return Json(fullPath.ToString().Replace("Success,", "").ToString());
            }
            return Json(lstModel.ToDataSourceResult(request));
        }