public JsonNetResult CancelReturn(string barcode, string formId) { try { if (string.IsNullOrEmpty(barcode)) { throw new Exception("The goods barcode is empty."); } if (string.IsNullOrEmpty(formId)) { throw new Exception("The return form id is empty."); } var service = new GoodsStateService(); GoodsBarModel model; string errorCode; if (service.Cancel(barcode, formId, FormType.Return, this.UserContext.UserId, this.UserContext.CurrentHospital, out model, out errorCode)) { return(JsonNet(new ResponseResult(true, new { Name = model.ProductName }))); } else { return(JsonNet(new ResponseResult(false, GoodsStateValidateCodes.GetMessage(errorCode)))); } } catch (Exception e) { return(JsonNet(new ResponseResult(false, e))); } }
public JsonNetResult CancelInspection(string barcode) { try { var service = new GoodsStateService(); string errorCode; GoodsBarModel model; if (!service.Cancel(barcode, FormType.Inspection, this.UserContext.CurrentHospital, this.UserContext.UserId, out model, out errorCode)) { return(JsonNet(new ResponseResult(false, GoodsStateValidateCodes.GetMessage(errorCode)))); } return(JsonNet(new ResponseResult(true, model))); } catch (Exception e) { return(JsonNet(new ResponseResult(false, e))); } }