public HttpStatusCode Delete(int Id) { ClaimsPrincipal p = RequestContext.Principal as ClaimsPrincipal; ProductDA.DeleteProduct(Id, p.Claims); return(HttpStatusCode.OK); }
public IHttpActionResult postProduct([FromBody] ProductDA product) { ProductBA pm = new ProductBA(); ProductDA data = pm.addProduct(product); return(Ok("Product was created successfully")); }
public PartialViewResult EditProduct(int ID) { Product p = ProductDA.GetSingle(ID); p.Images = ImageDA.GetCustomQuery($"Select * from Image Where ProductID={ID}"); return(PartialView("~/Views/ManageSystem/Partials/EditPartial.cshtml", p)); }
public ActionResult DeleteImage(int ID, int ProductID) { DataAccess.ImageDA.Delete(ID); Product p = ProductDA.GetSingle(ProductID); p.Images = ImageDA.GetCustomQuery($"Select * from Image Where ProductID={ID}"); return(PartialView("~/Views/ManageSystem/Partials/EditPartial.cshtml", p)); }
public HttpResponseMessage Put(Product pr) { ClaimsPrincipal p = RequestContext.Principal as ClaimsPrincipal; ProductDA.UpdateProduct(pr, p.Claims); return(new HttpResponseMessage(HttpStatusCode.OK)); }
public TicketBL() { dataAccess = new TicketDA(); productDA = new ProductDA(); naturalClientDA = new NaturalClientDA(); legalClientDA = new LegalClientDA(); discountDA = new DiscountDA(); }
/// <summary> /// 分页查询商品 /// </summary> /// <param name="queryFilter"></param> /// <returns></returns> public static QueryResult <ProductQueryInfo> QueryProduct(ProductQueryFilter queryFilter) { if (queryFilter == null || string.IsNullOrEmpty(queryFilter.VendorSysNo)) { throw new BusinessException("商家编号不能为空"); } return(ProductDA.QueryProduct(queryFilter)); }
public ActionResult UpdateMainImageUrL(int ID, string ImageURL) { Product p = ProductDA.GetSingle(ID); p.MainImageURL = ImageURL; ProductDA.Update(ID, p); p.Images = ImageDA.GetCustomQuery($"Select * from Image Where ProductID={ID}"); return(PartialView("~/Views/ManageSystem/Partials/EditPartial.cshtml", p)); }
public void AddProductBL(string ProductName) { ProductBO objProductBO = new ProductBO(); objProductBO.ProductName = ProductName; ProductDA objProductDA = new ProductDA(); objProductDA.AddProductDA(objProductBO); }
public void DeleteProductBL(string ProductName) { SellDA objSellDA = new SellDA(); ProductDA objProductDA = new ProductDA(); TypeDA objTypeDA = new TypeDA(); int ProductID = objSellDA.GetProductID(ProductName); objProductDA.DeleteProductBL(ProductName); objTypeDA.DeleteTypeBL(ProductID); }
public HttpResponseMessage Post(Product pr) { ClaimsPrincipal p = RequestContext.Principal as ClaimsPrincipal; int id = ProductDA.InsertProduct(pr, p.Claims); HttpResponseMessage message = new HttpResponseMessage(HttpStatusCode.OK); message.Content = new StringContent(id.ToString()); return(message); }
public ProductDA addProduct(ProductDA pd) { using (appstoreEntities db = new appstoreEntities()) { var rec = ProductDA.Convert(pd); db.Products.Add(rec); db.SaveChanges(); return(new ProductDA(rec)); } }
/// <summary> /// 获取单个商品库存调整单信息 /// </summary> /// <param name="adjustSysNo"></param> /// <returns></returns> public static ProductStockAdjustInfo GetProductStockAdjustmentInfo(int adjustSysNo) { var entity = ProductDA.GetProductStockAdjustmentInfo(adjustSysNo); if (null == entity) { throw new BusinessException(string.Format("找不到编号为{0}的商品库存调整单信息!")); } return(entity); }
public IHttpActionResult Put(string id, [FromBody] ProductDA product) { ProductBA pm = new ProductBA(); ProductDA data = pm.changeProduct(id, product); if (data.Id == null) { return(BadRequest("Product wasn't changed")); } return(Ok(data)); }
public static decimal Product_Insert(Product_Info _obj) { try { return(ProductDA.Product_Insert(_obj)); } catch (Exception ex) { Common.log.Error(ex.ToString()); return(-1); } }
/// <summary> /// 修改分仓库存 /// </summary> /// <param name="entityList"></param> public void Modify(List <ProductEntity> entityList) { try { ProductDA.ModifyQty(entityList); } catch (Exception ex) { ExceptionHelper.HandleException(ex); throw ex; } }
public static int Product_Update(Product_Info _obj) { try { return(ProductDA.Product_Update(_obj)); } catch (Exception ex) { Common.log.Error(ex.ToString()); return(-1); } }
public static int Product_Delete(decimal _productId) { try { return(ProductDA.Product_Delete(_productId)); } catch (Exception ex) { Common.log.Error(ex.ToString()); return(-1); } }
public HttpResponseMessage Delete(int id) { try { ClaimsPrincipal p = RequestContext.Principal as ClaimsPrincipal; ProductDA.DeleteProduct(id, p.Claims); return(new HttpResponseMessage(HttpStatusCode.OK)); } catch { return(new HttpResponseMessage(HttpStatusCode.InternalServerError)); } }
public static List <Product_Info> Product_GetAll() { var p_List = new List <Product_Info>(); try { p_List = CBO <Product_Info> .FillCollectionFromDataSet(ProductDA.Product_Getall()); } catch (Exception ex) { Common.log.Error(ex.ToString()); } return(p_List); }
public static Product_Info Product_GetByID(decimal _productId) { var p_object = new Product_Info(); try { p_object = (Product_Info)CBO.FillObjectFromDataSet(ProductDA.Product_GetById(_productId), typeof(Product_Info)); } catch (Exception ex) { Common.log.Error(ex.ToString()); } return(p_object); }
/// <summary> /// 更新商品库存调整单状态 /// </summary> /// <param name="newStatus"></param> /// <returns></returns> public static int UpdateProductStockAdjustmentStatus(ProductStockAdjustStatus newStatus, int adjustSysNo, int currentUserSysNo) { var currentAdjustInfo = GetProductStockAdjustmentInfo(adjustSysNo); if (null == currentAdjustInfo) { throw new BusinessException(string.Format("找不到编号为{0}的商品库存调整单据!")); } switch (newStatus) { case ProductStockAdjustStatus.Abandon: case ProductStockAdjustStatus.WaitingAudit: if (currentAdjustInfo.Status != ProductStockAdjustStatus.Origin) { throw new BusinessException(string.Format("操作失败:编号为{0}的商品库存调整单据当前状态不为\"初始态\"!", adjustSysNo)); } break; case ProductStockAdjustStatus.AuditFaild: case ProductStockAdjustStatus.AuditPass: if (currentAdjustInfo.Status != ProductStockAdjustStatus.WaitingAudit) { throw new BusinessException(string.Format("操作失败:编号为{0}的商品库存调整单据当前状态不为\"待审核\"!", adjustSysNo)); } break; default: break; } using (TransactionScope ts = new TransactionScope()) { var result = ProductDA.UpdateProductStockAdjustmentStatus(newStatus, adjustSysNo, currentUserSysNo); if (newStatus == ProductStockAdjustStatus.AuditPass || newStatus == ProductStockAdjustStatus.AuditFaild) { ProductDA.UpdateProductStockAdjustmentAuditDate(adjustSysNo, currentUserSysNo); if (newStatus == ProductStockAdjustStatus.AuditPass) { //审核库存调整单通过,调整商品相关库存(可用库存): foreach (var item in currentAdjustInfo.AdjustItemList) { ProductPurchaseDA.UpdateStockInfoForAdjust(currentAdjustInfo.StockSysNo.Value, item.ProductSysNo.Value, item.AdjustQty.Value); } } } ts.Complete(); return(result); } }
public HttpResponseMessage Put(Products product) { ClaimsPrincipal p = RequestContext.Principal as ClaimsPrincipal; if (product.ID == 0) { ProductDA.SaveProduct(product, p.Claims); return(new HttpResponseMessage(HttpStatusCode.OK)); } else { ProductDA.EditProduct(product, p.Claims); return(new HttpResponseMessage(HttpStatusCode.OK)); } }
public List <Product> Gets() { List <Product> oProducts = new List <Product>(); Conn.Open(); SqlDataReader oReader = null; oReader = ProductDA.Gets(Conn); if (oReader.Read()) { oProducts = CreateObjects(oReader); } Conn.Close(); return(oProducts); }
public IHttpActionResult Get(int id) { ProductBA pm = new ProductBA(); ProductDA data = pm.findProduct(id); if (data.Id == null) { //return BadRequest("Product wasn't found"); IHttpActionResult response; response = ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Product with id: " + id + " does't exist")); return(response); } return(Ok(data)); }
public Product Get(int nID, int nUserID) { Connection.Open(); Command.CommandText = ProductDA.Get(nID, nUserID); SqlDataReader reader = Command.ExecuteReader(); Product _oProduct = new Product(); if (reader.HasRows) { _oProduct = MakeObject(reader); } reader.Close(); Connection.Close(); return(_oProduct); }
public List <Product> GetsProductByTypeAndCategory(string nProductName, int nProductTypeID, int nCategory, int nUserID) { Connection.Open(); Command.CommandText = ProductDA.GetsProductByTypeAndCategory(nProductName, nProductTypeID, nCategory, nUserID); SqlDataReader reader = Command.ExecuteReader(); Product _oProduct = new Product(); List <Product> _oProducts = new List <Product>(); if (reader.HasRows) { _oProducts = MakeObjects(reader); } reader.Close(); Connection.Close(); return(_oProducts); }
public string Delete(Product oProduct, int nUserID) { string sReturnMessage = ""; Connection.Open(); Command.CommandText = ProductDA.IUD(oProduct, EnumDBOperation.Delete, nUserID); try { Command.ExecuteNonQuery(); } catch (Exception e) { sReturnMessage = e.Message.Split('~')[0]; } Connection.Close(); return(sReturnMessage); }
public List <Product> Gets(int nBUID, int nProduct) { Connection.Open(); Command.CommandText = ProductDA.Gets(nBUID, nProduct); SqlDataReader reader = Command.ExecuteReader(); Product _oProduct = new Product(); List <Product> _oProducts = new List <Product>(); if (reader.HasRows) { _oProducts = MakeObjects(reader); } reader.Close(); Connection.Close(); return(_oProducts); }
public ProductDA changeProduct(string id, ProductDA product) { using (appstoreEntities db = new appstoreEntities()) { if (id == product.Id.ToString()) { var result = db.Products.SingleOrDefault(p => p.Id == product.Id); if (result != null) { var rec = ProductDA.Update(result, product); db.SaveChanges(); return(new ProductDA(rec)); } } return(new ProductDA { }); } }