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)); }