private bool SetValid(string barcode, FormType formType, string hospitalId, string vendorId, string userId, bool valid, out GoodsBarModel model, out string errorCode) { model = null; if (!this.SetValid(barcode, formType, hospitalId, vendorId, userId, valid, out errorCode)) { return(false); } var entity = this.GetByBarcode(barcode); var product = new ProductService().Get(entity.ProductId); if (product == null) { throw new Exception(string.Format("The product({0}) does not exist", entity.ProductId)); } model = new GoodsBarModel { Id = entity.Id, FormNo = entity.OrderFormNo, ProductName = product.Name, Barcode = entity.Barcode, IsValid = entity.FutureValid }; return(true); }
public bool SetValid(string barcode, string formId, FormType formType, string hospitalId, bool valid, string userId, out GoodsBarModel model, out string errorCode) { model = null; if (formType == FormType.Return) { var returnForm = ReturnFormRepository.Get(formId); if (!GoodsStateRepository.CanValidate(barcode, formType, hospitalId, returnForm.VendorId, out errorCode)) { return(false); } } else { if (!GoodsStateRepository.CanValidate(barcode, formType, hospitalId, out errorCode)) { return(false); } } if (!GoodsStateRepository.SetValid(barcode, formId, formType, valid, userId)) { errorCode = GoodsStateValidateCodes.BarcodeNotExist; return(false); } var entity = this.GetByBarcode(barcode); var product = new ProductService().Get(entity.ProductId); if (product == null) { throw new Exception(string.Format("The product({0}) does not exist", entity.ProductId)); } model = new GoodsBarModel { Id = entity.Id, FormNo = entity.OrderFormNo, ProductName = product.Name, Barcode = entity.Barcode, IsValid = entity.FutureValid }; return(true); }
public bool Validate(string barcode, FormType formType, string hospitalId, string userId, out GoodsBarModel model, out string errorCode) { return(this.SetValid(barcode, formType, hospitalId, userId, true, out model, out errorCode)); }
public bool Cancel(string barcode, FormType formType, string hospitalId, string vendorId, string userId, out GoodsBarModel model, out string errorCode) { return(this.SetValid(barcode, formType, hospitalId, vendorId, userId, false, out model, out errorCode)); }