Пример #1
0
        public ActionResult UpdateData(string GradeVal, string txtDescription, string txtLLev1, string txtLLev2, string txtLLev3, string txtHLev1, string txtHLev2, string txtHLev3, string txtRate1, string txtRate2, string txtRate3)
        {
            bool success = true;

            WebView.WebService._base myWebService;
            myWebService = new WebService._base();

            WebService._base.MileageRates newRates = new WebService._base.MileageRates();
            newRates.GRADE_DESC = txtDescription;
            newRates.KM_LLEV1   = txtLLev1;
            newRates.KM_LLEV2   = txtLLev2;
            newRates.KM_LLEV3   = txtLLev3;
            newRates.KM_HLEV1   = txtHLev1;
            newRates.KM_HLEV2   = txtHLev2;
            newRates.KM_HLEV3   = txtHLev3;
            newRates.KM_RATE1   = txtRate1;
            newRates.KM_RATE2   = txtRate2;
            newRates.KM_RATE3   = txtRate3;
            success             = myWebService.UpdateMRates(newRates, GradeVal);

            return(Json(new
            {
                Success = success
            }, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public ActionResult NewMileageRates(MileageRatesModel m)
        {
            bool success = true;

            WebView.WebService._base myWebService;
            myWebService = new WebService._base();

            bool selected = false;

            WebService._base.MileageRates newgrade = new WebService._base.MileageRates();
            newgrade.GRADE      = m.Grade;
            newgrade.GRADE_DESC = m.GradeDescription;
            newgrade.KM_LLEV1   = Convert.ToString(m.LowLev1);
            newgrade.KM_LLEV2   = Convert.ToString(m.LowLev2);
            newgrade.KM_LLEV3   = Convert.ToString(m.LowLev3);
            newgrade.KM_HLEV1   = Convert.ToString(m.HighLev1);
            newgrade.KM_HLEV2   = Convert.ToString(m.HighLev2);
            newgrade.KM_HLEV3   = Convert.ToString(m.HighLev3);
            newgrade.KM_RATE1   = Convert.ToString(m.Rate1);
            newgrade.KM_RATE2   = Convert.ToString(m.Rate2);
            newgrade.KM_RATE3   = Convert.ToString(m.Rate3);

            success  = myWebService.AddMRates(newgrade);
            selected = true;

            if (ModelState.IsValid && selected)
            {
                if (success == true)
                {
                    return(RedirectToAction("NewSave"));
                }
                else
                {
                    return(RedirectToAction("NewSaveFail")); // store to db failed.
                }
            }


            return(View(m));
        }