コード例 #1
0
        public ActionResult ModifyFixRule()
        {
            Response resp     = new Response();
            CWTariff cwtariff = new CWTariff();

            string ID = Request.Form["cID"];

            if (string.IsNullOrEmpty(ID))
            {
                resp.Message = "传输错误,ID为空!";
                return(Json(resp));
            }
            int             mID  = Convert.ToInt32(ID);
            FixChargingRule rule = cwtariff.FindFixCharge(mID);

            if (rule == null)
            {
                resp.Message = "找不到对应的记录,ID-" + ID;
                return(Json(resp));
            }
            string cardtype = Request.Form["ccard"];

            if (string.IsNullOrEmpty(cardtype))
            {
                resp.Message = "传输错误,卡类型为空!";
                return(Json(resp));
            }
            string cunit = Request.Form["cunit"];

            if (string.IsNullOrEmpty(cunit))
            {
                resp.Message = "传输错误,收费类型为空!";
                return(Json(resp));
            }
            string fee = Request.Form["cfee"];

            int ctype = Convert.ToInt32(cardtype);
            int unit  = Convert.ToInt32(cunit);

            FixChargingRule exstRule = cwtariff.FindFixCharge(f => f.ICType == (EnmICCardType)ctype && f.Unit == (EnmFeeUnit)unit);

            if (exstRule != null)
            {
                if (exstRule.ID != mID)
                {
                    resp.Message = "已存在该记录,不允许重复添加!";
                    return(Json(resp));
                }
            }

            rule.ICType = (EnmICCardType)ctype;
            rule.Unit   = (EnmFeeUnit)unit;
            rule.Fee    = Convert.ToSingle(fee);
            resp        = cwtariff.UpdateFixCharge(rule);
            return(Json(resp));
        }
コード例 #2
0
        public ActionResult AddFixRule()
        {
            Response resp     = new Response();
            CWTariff cwtariff = new CWTariff();

            string cardtype = Request.Form["ccard"];

            if (string.IsNullOrEmpty(cardtype))
            {
                resp.Message = "传输错误,卡类型为空!";
                return(Json(resp));
            }
            string cunit = Request.Form["cunit"];

            if (string.IsNullOrEmpty(cunit))
            {
                resp.Message = "传输错误,收费类型为空!";
                return(Json(resp));
            }
            string fee = Request.Form["cfee"];

            int ctype = Convert.ToInt32(cardtype);
            int unit  = Convert.ToInt32(cunit);

            FixChargingRule rule = cwtariff.FindFixCharge(f => f.ICType == (EnmICCardType)ctype && f.Unit == (EnmFeeUnit)unit);

            if (rule != null)
            {
                resp.Message = "已存在该记录,不允许重复添加!";
                return(Json(resp));
            }
            rule = new FixChargingRule {
                ICType = (EnmICCardType)ctype,
                Unit   = (EnmFeeUnit)unit,
                Fee    = Convert.ToSingle(fee)
            };
            resp = cwtariff.AddFixRule(rule);

            return(Json(resp));
        }
コード例 #3
0
        public ActionResult DeletePre(int ID)
        {
            CWTariff cwtariff = new CWTariff();
            //同时删除计费绑定的
            TempChargingRule temp = cwtariff.FindTempChgRule(tp => tp.PreChgID == ID);

            if (temp != null)
            {
                temp.PreChgID = 0;
                cwtariff.UpdateTempChgRule(temp);
            }
            FixChargingRule fix = cwtariff.FindFixCharge(fx => fx.PreChgID == ID);

            if (fix != null)
            {
                fix.PreChgID = 0;
                cwtariff.UpdateFixCharge(fix);
            }
            Response resp = cwtariff.DeletePreCharge(ID);

            return(Json(resp, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
 public Response UpdateFixCharge(FixChargingRule fix)
 {
     return(fixManager.Update(fix));
 }
コード例 #5
0
 public Response AddFixRule(FixChargingRule rule)
 {
     return(fixManager.Add(rule));
 }