public JsonResult GetDerateConfigData(string parkingId) { try { List <ParkDerateConfig> result = ParkDerateConfigServices.QueryByParkingId(parkingId); return(Json(MyResult.Success(string.Empty, result.OrderBy(p => p.ConsumeStartAmount)))); } catch (MyException ex) { return(Json(MyResult.Error(ex.Message))); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "获取车场优免配置失败"); return(Json(MyResult.Error("获取车场优免配置失败"))); } }
public JsonResult SaveDerateConfig(ParkDerateConfig model) { try { if (model.ConsumeStartAmount < 0 || model.ConsumeEndAmount < 0) { throw new MyException("消费开始金额或结束金额格式不正确"); } if (model.ConsumeStartAmount >= model.ConsumeEndAmount) { throw new MyException("消费开始金额不能大于消费结束金额"); } if (model.DerateValue < 0) { throw new MyException("消费减免值格式不正确"); } if (!string.IsNullOrWhiteSpace(model.RecordID)) { bool result = ParkDerateConfigServices.Update(model); if (!result) { throw new MyException("修改车场优免配置失败"); } } else { bool result = ParkDerateConfigServices.Add(model); if (!result) { throw new MyException("添加车场优免配置失败"); } } return(Json(MyResult.Success())); } catch (MyException ex) { return(Json(MyResult.Error(ex.Message))); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "保存车场优免配置失败"); return(Json(MyResult.Error("保存车场优免配置失败"))); } }
public JsonResult DeleteDerateConfig(string recordId) { try { bool result = ParkDerateConfigServices.Delete(recordId); if (!result) { throw new MyException("删除车场优免配置失败"); } return(Json(MyResult.Success())); } catch (MyException ex) { return(Json(MyResult.Error(ex.Message))); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "删除车场优免配置失败"); return(Json(MyResult.Error("删除车场优免配置失败"))); } }