public ActionResult ExportNoHaveSocial([DataSourceRequest] DataSourceRequest request, Ins_ReportNotHaveSocialModel model) { var services = new Ins_InsuranceRecordServices(); var result = services.GetReportNotHaveSocial(model.DateFrom, model.DateTo, model.OrgStructureID,UserLogin); var lstModel = new List<Ins_ReportNotHaveSocialModel>(); if (result != null) { lstModel = result.Translate<Ins_ReportNotHaveSocialModel>(); // return Json(lstModel, JsonRequestBehavior.AllowGet); } var isDataTable = false; object obj = new Ins_ReportNotHaveSocialModel(); 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_ReportNotHaveSocialModel", OutPutPath = path, DownloadPath = "Templates", IsDataTable = isDataTable }; var str = exportService.CreateTemplate(cfgExport); return Json(str); } if (model.ExportId != Guid.Empty) { var fullPath = ExportService.Export(model.ExportId, lstModel, null, model.ExportType); return Json(fullPath); } return Json(lstModel.ToDataSourceResult(request)); }
public Ins_InsuranceRecordModel Post([Bind]Ins_InsuranceRecordModel model) { var hrService = new Hre_ProfileServices(); var baseService = new BaseService(); var InsuranceRecordService = new Ins_InsuranceRecordServices(); List<Ins_InsuranceRecordEntity> ilInsuranceRecord = new List<Ins_InsuranceRecordEntity>(); string status = string.Empty; #region Validate string message = string.Empty; var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Ins_InsuranceRecordModel>(model, "Ins_InsuranceRecord", ref message); if (!checkValidate) { model.ActionStatus = message; return model; } #endregion if (model.ID == Guid.Empty) { 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; } if (!string.IsNullOrEmpty(model.OrgStructureIDs)) { List<Guid> listGuid = new List<Guid>(); if (model.ProfileIds != null) { var listStr = model.ProfileIds.Split(','); if (listStr[0] != "") { foreach (var item in listStr) { listGuid.Add(Guid.Parse(item)); } } } List<object> listObj = new List<object>(); listObj.Add(model.OrgStructureIDs); listObj.Add(string.Empty); listObj.Add(string.Empty); var lstProfile = baseService.GetData<Hre_ProfileEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure,UserLogin, ref status).Select(x => x.ID); if (listGuid.Count > 0) { lstProfile = lstProfile.Where(s => !listGuid.Contains(s)).ToList(); } if (lstProfile.Count() > 0) { foreach (var objProfile in lstProfile) { var modelSave = model.CopyData<Ins_InsuranceRecordModel>(); modelSave.ProfileID = objProfile; ilInsuranceRecord.Add(modelSave.CopyData<Ins_InsuranceRecordEntity>()); } model.ActionStatus =InsuranceRecordService.Add(ilInsuranceRecord); } return model; } if (!string.IsNullOrEmpty(model.ProfileIds)) { List<Guid> ilprofileID = new List<Guid>(); var listprofile = model.ProfileIds.Split(','); foreach (var x in listprofile) { try { ilprofileID.Add(Guid.Parse(x)); } catch { } } foreach (var item in ilprofileID) { var modelSave = model.CopyData<Ins_InsuranceRecordModel>(); modelSave.ProfileID = item; ilInsuranceRecord.Add(modelSave.CopyData<Ins_InsuranceRecordEntity>()); } model.ActionStatus=InsuranceRecordService.Add(ilInsuranceRecord); } } else { ActionService service = new ActionService(UserLogin); return service.UpdateOrCreate<Ins_InsuranceRecordEntity, Ins_InsuranceRecordModel>(model); } return model; }
public ActionResult GetReportNotHaveSocial([DataSourceRequest] DataSourceRequest request, Ins_ReportNotHaveSocialModel model) { var services = new Ins_InsuranceRecordServices(); var result = services.GetReportNotHaveSocial(model.DateFrom, model.DateTo, model.OrgStructureID,UserLogin); var lstModel = new List<Ins_ReportNotHaveSocialModel>(); if (result != null) { lstModel = result.Translate<Ins_ReportNotHaveSocialModel>(); return Json(lstModel.ToDataSourceResult(request)); } return Json(lstModel.ToDataSourceResult(request)); }