/// <summary> /// Returns a list of inflation index for the selection criteria. /// </summary> /// <param name="param">The data table search criteria</param> /// <returns>List of inflation index</returns> public ActionResult InflationIndexList(MODEL.jQueryDataTableParamModel param) { try { List <MODEL.InflationIndex> inflationIndexList = new List <MODEL.InflationIndex>(); InflationIndexService inflationIndexService = new InflationIndexService(); List <InflationIndexVO> inflationIndexVOlist = inflationIndexService.GetInflationIndexList(); foreach (InflationIndexVO inflationIndexVO in inflationIndexVOlist) { inflationIndexList.Add(new MODEL.InflationIndex(inflationIndexVO)); } //get the field on with sorting needs to happen and set the //ordering function/delegate accordingly. int sortColumnIndex = Convert.ToInt32(Request["iSortCol_0"]); var orderingFunction = GetInflationIndexOrderingFunction(sortColumnIndex); var result = GetFilteredObjectsOrderByAscending(param, inflationIndexList, orderingFunction); return(result); } catch (Exception e) { return(new HttpStatusCodeAndErrorResult(500, e.Message)); } }
/// <summary> /// Save inflation index details /// </summary> /// <param name="model">model Object</param> public ActionResult InflationIndexSave(MODEL.InflationIndex model) { try { bool ismodelValid = ModelState.IsValid; if (!ismodelValid) { ismodelValid = IsModelValidForMultilineTextbox("Description", model.Description, 30); } if (ismodelValid) { //Get user id int?userId = Session.GetUserId(); InflationIndexService inflationIndexService = new InflationIndexService(); //InflationIndexVO inflationIndexVO = new InflationIndexVO(model, userId); InflationIndexVO inflationIndexVO = model.Transpose(userId); inflationIndexService.SaveInflationIndex(inflationIndexVO); return(new HttpStatusCodeResult(200)); } else { throw new ApplicationException(String.Format(Constants.CANNOT_SAVE, Constants.INDEX)); } } catch (Exception e) { return(new HttpStatusCodeAndErrorResult(500, e.Message)); } }
/// <summary> /// Delete inflation index and associated index rate(s) /// </summary> /// <param name="Ids">Ids of inflation index to be deleted</param> public ActionResult RecalculationDelete(List <int> Ids) { try { //Get user id int?userId = Session.GetUserId(); InflationIndexService inflationIndexService = new InflationIndexService(); inflationIndexService.DeleteRecalculation(Ids, userId); return(new HttpStatusCodeResult(200)); } catch (Exception e) { return(new HttpStatusCodeAndErrorResult(500, e.Message)); } }
/// <summary> /// Edit inflation index /// </summary> /// <param name="id">Inflation Index Id</param> /// <returns>The Inflation Index Details view</returns> public ActionResult InflationIndexEdit(int id) { MODEL.InflationIndex inflationIndex = null; try { InflationIndexService inflationIndexService = new InflationIndexService(); //Get index details InflationIndexVO inflationIndexVO = inflationIndexService.GetInflationIndexById(id); if (inflationIndexVO == null) { ModelState.AddModelError("", String.Format(Constants.ITEM_NOT_FOUND, Constants.INDEX)); } else { inflationIndex = new MODEL.InflationIndex(inflationIndexVO); } } catch (Exception e) { ModelState.AddModelError("", e.Message); } return(PartialView("InflationIndexDetails", inflationIndex)); }