public ActionResult ModifyTempRuleOfOrder() { Response resp = new Response(); #region CWTariff cwtarff = new CWTariff(); int mainID = 0; string mID = Request.Form["MID"]; if (!string.IsNullOrEmpty(mID)) { TempChargingRule rule = cwtarff.FindTempChgRule(Convert.ToInt32(mID)); if (rule != null) { string preID = Request.Form["PreID"]; string tType = Request.Form["TType"]; rule.TempChgType = (EnmTempChargeType)Convert.ToInt16(tType); rule.PreChgID = Convert.ToInt32(preID); cwtarff.UpdateTempChgRule(rule); mainID = rule.ID; } } string orderID = Request.Form["OrderID"]; if (!string.IsNullOrEmpty(orderID)) { string freetime = Request.Form["FreeTime"]; string fee = Request.Form["OrderFee"]; if (orderID == "0") { //添加新的 if (mainID != 0) { OrderChargeDetail odetail = new OrderChargeDetail() { TempChgID = mainID, OrderFreeTime = freetime, Fee = Convert.ToSingle(fee) }; resp = cwtarff.AddOrderDetail(odetail); } } else { OrderChargeDetail order = cwtarff.FindOrderDetail(Convert.ToInt32(orderID)); if (order != null) { order.OrderFreeTime = freetime; order.Fee = Convert.ToSingle(fee); cwtarff.UpdateOrderDetail(order); } } } resp.Message = "修改数据成功"; #endregion return(Json(resp)); }
public ActionResult ModifyTempRuleOfHour() { Response resp = new Response(); CWTariff cwtarff = new CWTariff(); int mainID = 0; string mID = Request.Form["MID"]; if (!string.IsNullOrEmpty(mID)) { TempChargingRule rule = cwtarff.FindTempChgRule(Convert.ToInt32(mID)); if (rule != null) { string preID = Request.Form["PreID"]; string tType = Request.Form["TType"]; rule.TempChgType = (EnmTempChargeType)Convert.ToInt16(tType); rule.PreChgID = Convert.ToInt32(preID); cwtarff.UpdateTempChgRule(rule); mainID = rule.ID; } } string hourID = Request.Form["hourID"]; if (!string.IsNullOrEmpty(hourID)) { string strided = Request.Form["StrideDay"]; string cyclet = Request.Form["CycleTime"]; string topfee = Request.Form["StrideTopFee"]; if (hourID == "0") { //新增 HourChargeDetail hour = new HourChargeDetail { StrideDay = (EnmStrideDay)Convert.ToInt16(strided), CycleTime = (EnmCycleTime)Convert.ToInt16(cyclet), CycleTopFee = Convert.ToSingle(topfee), TempChgID = mainID }; resp = cwtarff.AddHourChgDetail(hour); } else { //修改 HourChargeDetail detail = cwtarff.FindHourChgDetail(Convert.ToInt32(hourID)); if (detail != null) { detail.StrideDay = (EnmStrideDay)Convert.ToInt16(strided); detail.CycleTime = (EnmCycleTime)Convert.ToInt16(cyclet); detail.CycleTopFee = Convert.ToSingle(topfee); resp = cwtarff.UpdateHourChgDetail(detail); } } } resp.Message = "修改数据成功"; return(Json(resp)); }
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)); }