private void getUserProduct() { var dt = User_Product.RetrieveData(oCon); gvUserProduct.DataSource = dt; gvUserProduct.DataBind(); }
/// <summary> /// 收藏商品和点赞商品接口 /// </summary> /// <param name="pid"></param> /// <param name="userid"></param> /// <param name="isCollected"></param> /// <param name="isGood"></param> /// <returns></returns> public bool CollectionsOrGoods(int pid, int userid, bool isCollected, bool isGood, int status1, int status2) { using (ShopEntities db = new ShopEntities()) { var data = db.User_Product.SingleOrDefault(o => o.ProuctID == pid && o.UserID == userid); if (data != null) { if (status1 == 1) { data.isCollected = isCollected; } if (status2 == 1) { data.isGood = isGood; } return(db.SaveChanges() > 0); } else { User_Product up = new User_Product(); up.ProuctID = pid; up.UserID = userid; up.isCollected = isCollected; up.isGood = isGood; db.User_Product.Add(up); return(db.SaveChanges() > 0); } } }
public List <User_Product> GetListCartProduct(int[] productIds) { List <User_Product> products = new List <User_Product>(); foreach (int id in productIds) { User_Product product = GetProdctDetail(id); if (product != null) { products.Add(product); } } return(products); }
public User_Product GetProdctDetail(int productId) { try { User_Product product = productRepository.GetProductDetail(productId); product.Colors = productColorRepository.GetProductColor(product.ProductId); product.Sizes = productSizeRepository.GetProductSize(product.ProductId); product.Images = imageRepository.GetImageOfProduct(product.ProductId); return(product); } catch (Exception ex) { //ex.LogExceptionToFile(); throw new Exception(ex.Message); } }
protected void btnSaveUserProduct_Click(object sender, EventArgs e) { User_Product_Model mdlUserProduct = new User_Product_Model(); mdlUserProduct.idProduct = Convert.ToInt32(ddlProduct.SelectedValue); mdlUserProduct.idUser = Convert.ToInt32(ddlUsers.SelectedValue); if (Session["userProductMode"].ToString() == "Save") { User_Product.Save(oCon, mdlUserProduct); } else if (Session["userProductMode"].ToString() == "Update") { mdlUserProduct.idUser = Convert.ToInt32(Session["idUserProduct"].ToString()); User_Product.Update(oCon, mdlUserProduct); } getUserProduct(); clearUserProduct(); }
/// <summary> /// 修改账户接单权限 /// </summary> /// <returns></returns> public object QueryReceivePower(int pid, int userid, bool isReceiveOrder) { using (ShopEntities db = new ShopEntities()) { var data = db.User_Product.SingleOrDefault(o => o.ProuctID == pid && o.UserID == userid); if (data == null) { User_Product up = new User_Product(); up.ProuctID = pid; up.UserID = userid; up.IsReceiveOrder = isReceiveOrder; db.User_Product.Add(up); return(db.SaveChanges() > 0); } else { data.IsReceiveOrder = isReceiveOrder; return(db.SaveChanges() > 0); } } }
protected void btnDeleteUserProduct_Click(object sender, EventArgs e) { User_Product.Delete(oCon, Convert.ToInt32(Session["idUserProduct"].ToString())); getUserProduct(); clearUserProduct(); }