Beispiel #1
0
        /// <summary>
        /// Save the Inflation index rate
        /// </summary>
        /// <param name="model">The InflationIndexRate model</param>
        public ActionResult InflationIndexRateSave(MODEL.InflationIndexRate model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    //Get user id
                    int?userId = Session.GetUserId();

                    InflationIndexRateService inflationIndexRateService = new InflationIndexRateService();
                    //InflationIndexRateVO inflationIndexRateVO = new InflationIndexRateVO(model, userId);

                    InflationIndexRateVO inflationIndexRateVO = model.Transpose(userId);

                    inflationIndexRateService.SaveInflationIndexRate(inflationIndexRateVO);
                    return(new HttpStatusCodeResult(200));
                }
                else
                {
                    foreach (var item in ModelState)
                    {
                        if (item.Key == "chargingUpliftDate" && item.Value.Errors.Count > 0)
                        {
                            return(new HttpStatusCodeAndErrorResult(500, Constants.INVALID_DATE));
                        }
                    }
                    throw new ApplicationException(String.Format(Constants.CANNOT_SAVE, Constants.INDEXRATE));
                }
            }
            catch (Exception e)
            {
                return(new HttpStatusCodeAndErrorResult(500, e.Message));
            }
        }
Beispiel #2
0
 /// <summary>
 ///Create new Inflation index rate
 /// </summary>
 /// <returns>The inflation index rate details view</returns>
 // GET: /Administration/InflationIndexRateCreate
 public ActionResult InflationIndexRateCreate(int inflationIndexId, string inflationIndexName)
 {
     try
     {
         MODEL.InflationIndexRate inflationIndexRate = new MODEL.InflationIndexRate();
         inflationIndexRate.InflationIndexId = inflationIndexId;
         inflationIndexRate.IndexName        = inflationIndexName;
         return(PartialView("InflationIndexRateDetails", inflationIndexRate));
     }
     catch (Exception e)
     {
         return(new HttpStatusCodeAndErrorResult(500, e.Message));
     }
 }
Beispiel #3
0
        /// <summary>
        /// Get Details of inflation index rate by Id
        /// </summary>
        /// <param name="id">Index Rate Id</param>
        /// <returns>The inflation index rate details view</returns>
        public ActionResult InflationIndexRateEdit(int id)
        {
            MODEL.InflationIndexRate inflationIndexRate = null;
            try
            {
                InflationIndexRateService inflationIndexRateService = new InflationIndexRateService();

                //Get inflation index rate
                InflationIndexRateVO inflationIndexRateVO = inflationIndexRateService.GetInflationIndexRateById(id);
                if (inflationIndexRateVO == null)
                {
                    ModelState.AddModelError("", String.Format(Constants.ITEM_NOT_FOUND, Constants.INDEXRATE));
                }
                else
                {
                    inflationIndexRate = new InflationIndexRate(inflationIndexRateVO);
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("", e.Message);
            }
            return(PartialView("InflationIndexRateDetails", inflationIndexRate));
        }