public ActionResult Edit(int id = 0) { try { var certGrade = _unitOfWork.PaidDataRepository.GetByID(id); if (certGrade == null) { return(HttpNotFound()); } var model = new PaidDataModel { Entity = certGrade, OrgLookUp = LookUps.OrganisationById(certGrade.OrgID ?? 0), CobLookUp = LookUps.ClassOfBusiness(), TypeOfLossLookUp = LookUps.TypeOfLoss(), OrgId = certGrade.OrgID ?? 0 }; return(View(model)); } catch (Exception ex) { // Log with Elmah Elmah.ErrorSignal.FromCurrentContext().Raise(ex); TempData["message"] = Settings.Default.GenericExceptionMessage; return(RedirectToAction("Index", "Home", new { area = "Admin" })); } }
public ActionResult SearchModel() { try { var orgId = LookUps.GetOrgId(User.Identity.Name); if (orgId == 0) { orgId = Settings.Default.DefaultOrgId; } var model = new SearchModel() { OrgId = orgId, // ModelData = _unitOfWork.PaidDataRepository.GetResultReport(orgId) OrgLookUp = LookUps.OrganisationById(orgId), CobLookUp = LookUps.ClassOfBusiness(), TypeOfLossLookUp = LookUps.TypeOfLoss(), }; // ModelData = _unitOfWork.PaidDataRepository.ExecWithStoreProcedure( // "rModelViewByOrg @orgId", //new SqlParameter("orgId", SqlDbType.Int) { Value = orgId }) return(View(model)); } catch (Exception ex) { // Log with Elmah ErrorSignal.FromCurrentContext().Raise(ex); TempData["message"] = Settings.Default.GenericExceptionMessage; return(RedirectToAction("Index", "Home", new { area = "Admin" })); } }
public ActionResult Edit(OutstandingDataModel model) { try { if (ModelState.IsValid) { var certGrade = model.Entity; certGrade.ModifiedBy = User.Identity.Name; certGrade.ModifiedDate = DateTime.Now; certGrade.LossYear = certGrade.DateOfLoss.GetValueOrDefault().Year; _unitOfWork.OutstandingDataRepository.Update(certGrade); _unitOfWork.Save(); TempData["message"] = "<b>" + certGrade.ClaimNo + "</b> was successfully updated"; return(RedirectToAction("Index", new { orgId = model.Entity.ID })); } model.OrgLookUp = LookUps.OrganisationById(model.Entity.OrgID ?? 0); model.CobLookUp = LookUps.ClassOfBusiness(); model.TypeOfLossLookUp = LookUps.TypeOfLoss(); return(View(model)); } catch (Exception ex) { // Log with Elmah Elmah.ErrorSignal.FromCurrentContext().Raise(ex); TempData["message"] = Settings.Default.GenericExceptionMessage; return(RedirectToAction("Index", "Home", new { area = "Admin" })); } }
public ActionResult Create(EarnedPremiumModel model) { try { if (TypeNameExist(model.Entity.OrgID ?? 0, model.Entity.PremiumYear ?? 0)) { ModelState.AddModelError("", "Earned Premium Already Exist"); } if (ModelState.IsValid) { var certGrade = model.Entity; certGrade.ModifiedBy = User.Identity.Name; certGrade.ModifiedDate = DateTime.Now; certGrade.CreatedBy = User.Identity.Name; certGrade.CreatedDate = DateTime.Now; _unitOfWork.EarnedPremiumRepository.Insert(certGrade); _unitOfWork.Save(); TempData["message"] = "<b>" + certGrade.PremiumYear + "</b> was successfully created"; return(RedirectToAction("Index", new { orgId = model.Entity.OrgID })); } model.OrgLookUp = LookUps.OrganisationById(model.Entity.OrgID ?? 0); model.CobLookUp = LookUps.ClassOfBusiness(); return(View(model)); } catch (Exception ex) { // Log with Elmah Elmah.ErrorSignal.FromCurrentContext().Raise(ex); TempData["message"] = Settings.Default.GenericExceptionMessage; return(RedirectToAction("Index", "Home", new { area = "Admin" })); } }
public ActionResult Create(int orgId) { var model = new OrgClassOfBusinessModel(); model.OrgId = orgId; model.CobLookUp = LookUps.ClassOfBusiness(); model.SelectedCob = unitOfWork.OrgClassOfBusinessRepository.Get(filter: x => x.OrgID == orgId).Select(x => x.BusinessClass).ToArray(); return(View(model)); }
public ActionResult Create(int orgId) { var model = new EarnedPremiumModel { Entity = new EarnedPremium(), OrgLookUp = LookUps.OrganisationById(orgId), CobLookUp = LookUps.ClassOfBusiness(), OrgId = orgId }; return(View(model)); }
public ActionResult Create(int orgId) { var model = new PaidDataModel { Entity = new PaidData(), OrgLookUp = LookUps.OrganisationById(orgId), CobLookUp = LookUps.ClassOfBusiness(), TypeOfLossLookUp = LookUps.TypeOfLoss(), OrgId = orgId }; return(View(model)); }
public ActionResult Create(TypeOfLossThresholdModel model) { try { if (model.Entity.MaxValue <= model.Entity.MinValue) { ModelState.AddModelError("", "Please Make Sure Maximum Value is Higher than the Minimum Value"); } if (ThresholdExist(model.Entity.OrgID ?? 0, model.Entity.ClassOfBusiness ?? 0, model.Entity.TypeOfLoss ?? 0, model.Entity.ID)) { ModelState.AddModelError("", "Threshold Already Exist"); } if (ValuesConflict(model.Entity.OrgID ?? 0, model.Entity.ClassOfBusiness ?? 0, model.Entity.MinValue ?? 0, model.Entity.MaxValue ?? 0, model.Entity.ID)) { ModelState.AddModelError("", "Minimum and Maximum Values Conflict with existing setup for the selected Class of Business"); } if (ModelState.IsValid) { var certGrade = model.Entity; certGrade.ModifiedBy = User.Identity.Name; certGrade.ModifiedDate = DateTime.Now; certGrade.CreatedBy = User.Identity.Name; certGrade.CreatedDate = DateTime.Now; _unitOfWork.TypeOfLossThresholdRepository.Insert(certGrade); _unitOfWork.Save(); TempData["message"] = "Type of Loss Threshold was successfully created"; return(RedirectToAction("Index", new { orgid = model.Entity.OrgID })); } model.OrgId = model.Entity.OrgID ?? 0; model.OrgLookUp = LookUps.OrganisationById(model.Entity.OrgID ?? 0); model.CobLookUp = LookUps.ClassOfBusiness(); model.TypeOfLossLookUp = LookUps.TypeOfLoss(); return(View(model)); } catch (Exception ex) { // Log with Elmah Elmah.ErrorSignal.FromCurrentContext().Raise(ex); TempData["message"] = Settings.Default.GenericExceptionMessage; return(RedirectToAction("Index", "Home", new { area = "Admin" })); } }
public ActionResult Create(PaidDataModel model) { try { if (ClaimExist(model.Entity.OrgID ?? 0, model.Entity.ClaimNo, model.Entity.ID)) { ModelState.AddModelError("", "Claim Number Already Exist"); } if (ModelState.IsValid) { var certGrade = model.Entity; certGrade.ModifiedBy = User.Identity.Name; certGrade.ModifiedDate = DateTime.Now; certGrade.CreatedBy = User.Identity.Name; certGrade.CreatedDate = DateTime.Now; //calcualte dev period certGrade.LossYear = certGrade.DateOfLoss.GetValueOrDefault().Year; certGrade.PaidYear = certGrade.DateOfPayment.GetValueOrDefault().Year; certGrade.DevPeriod = certGrade.PaidYear - certGrade.LossYear; _unitOfWork.PaidDataRepository.Insert(certGrade); _unitOfWork.Save(); TempData["message"] = "<b>" + certGrade.ClaimNo + "</b> was successfully created"; return(RedirectToAction("Index", new { orgid = model.Entity.OrgID })); } model.OrgLookUp = LookUps.OrganisationById(model.Entity.OrgID ?? 0); model.CobLookUp = LookUps.ClassOfBusiness(); model.TypeOfLossLookUp = LookUps.TypeOfLoss(); return(View(model)); } catch (Exception ex) { // Log with Elmah Elmah.ErrorSignal.FromCurrentContext().Raise(ex); TempData["message"] = Settings.Default.GenericExceptionMessage; return(RedirectToAction("Index", "Home", new { area = "Admin" })); } }
public ActionResult SearchModel(SearchModel model) { try { if (model.EndYear <= model.StartYear) { ModelState.AddModelError("", "Please Make End Date is Higher than Start Date"); } if (ModelState.IsValid) { // _unitOfWork.PaidDataRepository.UpdateHierarchy("rModelCummulativeSetUp @orgId, @startYear, @endYear,@cob,@losstype", // new SqlParameter("orgId", SqlDbType.Int) { Value = model.OrgId }, // new SqlParameter("startYear", SqlDbType.Int) { Value = model.StartYear }, // new SqlParameter("endYear", SqlDbType.Int) { Value = model.EndYear }, // new SqlParameter("cob", SqlDbType.Int) { Value = model.ClassOfBusiness }, // new SqlParameter("losstype", SqlDbType.Int) { Value = model.LossType }); _unitOfWork.PaidDataRepository.UpdateHierarchy("GeneralSetUp @orgId, @startYear, @endYear,@cob,@losstype", new SqlParameter("orgId", SqlDbType.Int) { Value = model.OrgId }, new SqlParameter("startYear", SqlDbType.Int) { Value = model.StartYear }, new SqlParameter("endYear", SqlDbType.Int) { Value = model.EndYear }, new SqlParameter("cob", SqlDbType.Int) { Value = model.ClassOfBusiness }, new SqlParameter("losstype", SqlDbType.Int) { Value = model.LossType }); return(RedirectToAction("Index", new { orgid = model.OrgId, startYear = model.StartYear, endYear = model.EndYear, cob = model.ClassOfBusiness, losstype = model.LossType })); } // ModelData = _unitOfWork.PaidDataRepository.ExecWithStoreProcedure( // "rModelViewByOrg @orgId", //new SqlParameter("orgId", SqlDbType.Int) { Value = orgId }) model.OrgLookUp = LookUps.OrganisationById(model.OrgId); model.CobLookUp = LookUps.ClassOfBusiness(); model.TypeOfLossLookUp = LookUps.TypeOfLoss(); return(View(model)); } catch (Exception ex) { // Log with Elmah ErrorSignal.FromCurrentContext().Raise(ex); TempData["message"] = Settings.Default.GenericExceptionMessage; return(RedirectToAction("Index", "Home", new { area = "Admin" })); } }