public ActionResult Update_Server(DbServiceReference.PriceType info) { //检查用户是否有权限,否则抛出MyDenyAccessException异常 base.CheckAuthorized(AuthorizeKey.UpdateKey); CommonResult result = new CommonResult(); try { //调用后台服务获取集中器信息 DbServiceReference.ServiceDbClient DbServer = new DbServiceReference.ServiceDbClient(); var flag = DbServer.PriceType_Upd(info); if (flag == "0") { result.Success = true; } else { result.ErrorMessage = flag; } } catch (Exception ex) { LogTextHelper.Error(ex);//错误记录 result.ErrorMessage = ex.Message; } return(ToJsonContent(result)); }
public ActionResult Insert_Server(DbServiceReference.PriceType info) { //检查用户是否有权限,否则抛出MyDenyAccessException异常 base.CheckAuthorized(AuthorizeKey.InsertKey); CommonResult result = new CommonResult(); try { var endcode = Session["EndCode"] ?? "0"; //调用后台服务获取集中器信息 DbServiceReference.ServiceDbClient DbServer = new DbServiceReference.ServiceDbClient(); var flag = DbServer.PriceType_Ins(endcode.ToString().ToInt32(), info); if (flag == "0") { result.Success = true; } else { result.ErrorMessage = flag; } } catch (Exception ex) { LogTextHelper.Error(ex);//错误记录 } return(ToJsonContent(result)); }