public JsonResult Save(string rankId) { try { if (!IsSavePermission(rankId)) { return(Error("您没有操作权限,请联系系统管理员!")); } string fRankName = GetFormValue("fRankName"); string fMaxPoints = GetFormValue("fMaxPoints"); string fDiscount = GetFormValue("fDiscount"); string fRemark = GetFormValue("fRemark"); string fState = GetFormValue("fState"); int maxPoints = fMaxPoints.ToInt(); int discount = fDiscount.ToInt(); int showPrice = discount; bool state = fState.ToBool(); if (maxPoints <= 0) { return(Error("升级积分必须大于0")); } if (discount <= 0 || discount > 100) { return(Error("优惠拆扣必须是1-100之间")); } bool result = false; if (string.IsNullOrEmpty(rankId)) { result = RankService.SaveRankPro(SystemID, CompanyID, fRankName, maxPoints, discount, showPrice, fRemark, state); var entity = RankService.GetRankByMaxPointsPro(SystemID, CompanyID, maxPoints); TableOperationManager.Add(entity, result); } else { var entity = RankService.GetRankPro(SystemID, CompanyID, rankId); result = RankService.UpdateRankPro(SystemID, CompanyID, rankId, fRankName, maxPoints, discount, showPrice, fRemark, state); string newEntityJson = GetNewEntityJson(entity, fRankName, maxPoints, discount, showPrice, fRemark, state); TableOperationManager.Update(entity, newEntityJson, result); } if (result) { return(Success("ok")); } else { return(Error("fail")); } } catch (Exception ex) { return(Error(ex.Message)); } }