private void LoadProduct() { List <Product_DTO> loadProduct = Product_BUS.LoadProduct(); cmbProductName.DataSource = loadProduct; cmbProductName.ValueMember = "ProductID"; cmbProductName.DisplayMember = "ProductName"; cmbIDProductDetailStore.Text = cmbProductName.SelectedValue.ToString(); cmbUnit.DataSource = loadProduct; cmbUnit.ValueMember = "UnitID"; cmbUnit.DisplayMember = "UnitName"; cmbUnit.Text = cmbProductName.SelectedValue.ToString(); cmbProductCategory.DataSource = loadProduct; cmbProductCategory.ValueMember = "ProductCategoryID"; cmbProductCategory.DisplayMember = "ProductCategoryName"; cmbPQuatity.DataSource = loadProduct; cmbPQuatity.ValueMember = "Quantity"; cmbPQuatity.DisplayMember = "Quantity"; cmbPercent.DataSource = loadProduct; cmbPercent.ValueMember = "PercentRevenue"; cmbPercent.DisplayMember = "PercentRevenue"; cmbImportPrice.DataSource = loadProduct; cmbImportPrice.ValueMember = "ImportPrice"; cmbImportPrice.DisplayMember = "ImportPrice"; }
protected void btnSearch_Click(object sender, EventArgs e) { string content = txtSearch.Text.Trim(); List <DTO.Product> products = new Product_BUS().SearchProduct(content); BindData(products); }
private void BindData(List <DTO.Product> lst) { List <DTO.Manufacturer> lstManu = Product_BUS.GetAllManufacturer(); List <DTO.Origin> lstOrigin = Product_BUS.GetAllOrigin(); var obj = lst.Select((item, index) => { return(new { ProductID = item.ProductID, ProductName = item.ProductName, Price = item.Price.ToString("0,0", CultureInfo.CurrentCulture), Summary = HttpUtility.UrlDecode(item.Summary), ManufacturerName = Product_BUS.GetManufacturerName(item.ManufacturerID, lstManu), OriginName = Product_BUS.GetOriginName(item.OriginID, lstOrigin), Quantity = item.Quantity.ToString("0,0", CultureInfo.CurrentCulture), Image = "../../Img/images/" + (string.IsNullOrEmpty(item.Image) ? "noimg.png" : item.Image), LinkEdit = "ProductDetail.aspx?productID=" + item.ProductID, LinkSale = "ProductSale.aspx?productID=" + item.ProductID, LinkGift = "ProductGift.aspx?productID=" + item.ProductID, LinkDelete = "ProductDelete.aspx?productID=" + item.ProductID, FnDelete = "DeleteProduct('" + item.ProductID.ToString().Trim() + "', '" + item.ProductName.ToString() + "')", Rate = new Product_BUS().GetRateString(item.ProductID), Sale = !item.IsSale ? "Không có khuyến mại" : "Khuyến mại: Giảm " + item.AmountSale.ToString("0,0", CultureInfo.CurrentCulture) + " đ khi mua từ " + item.QuantitySale + " sp trở lên", CategoryInfo = GetCategoriesOfProduct(item.ProductID) }); }); DataList1.DataSource = obj; DataList1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["AccountName"] == null) { Response.Redirect("../Login/Login.aspx"); } if (!IsPostBack) { BindData(Product_BUS.getAllProduct()); txtSearch.Text = ""; } }
private string GetProductInfo() { List <Manufacturer> lstManu = CommonBUS.GetAllManufacturer(); List <Origin> lstOrigin = CommonBUS.GetAllOrigin(); string info = ""; info += "Tên sản phẩm: <b>" + product.ProductName + "</b><br>"; info += "<br>Nhà SX: <b>" + Product_BUS.GetManufacturerName(product.ManufacturerID, lstManu) + "</b><br>"; info += "<br>Xuất xứ: <b>" + Product_BUS.GetOriginName(product.OriginID, lstOrigin) + "</b><br>"; info += "<br>Giá bán: <b>" + product.Price.ToString("0,0", CultureInfo.CurrentCulture) + "đ</b><br>"; return(info); }
private string GetCategoriesOfProduct(Guid proID) { string res = "Không có"; List <Category> categories = new Product_BUS().GetCategoriesByProductID(proID); if (categories.Count != 0) { res = ""; foreach (Category item in categories) { res += "<br/> -" + item.CategoryName; } } return(res); }
protected void ckCategory_DataBinding(object sender, EventArgs e) { List <Category> cagories = new Product_BUS().GetCategoriesByProductID(Guid.Parse(Request.QueryString.Get("productID"))); foreach (ListItem item in ckCategory.Items) { foreach (Category category in cagories) { if (category.CategoryID.Equals(Guid.Parse(item.Value))) { item.Selected = true; } } } }
protected void Page_Load(object sender, EventArgs e) { List <DTO.Product> lst = Product_BUS.getAllProduct(); var source = lst.Select((item) => { return(new { Image = "../../../Admin/Img/images/" + (string.IsNullOrEmpty(item.Image) ? "noimg.png" : HttpUtility.UrlDecode(item.Image)), Summary = HttpUtility.UrlDecode(item.Summary), Price = item.Price.ToString() + "đ", ProductID = item.ProductID, ProductName = item.ProductName }); }); DataList1.DataSource = source; DataList1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["AccountName"] == null) { Response.Redirect("../Login/Login.aspx"); } if (!IsPostBack) { Product_BUS product_BUS = new Product_BUS(); proID = Guid.Parse(Request.QueryString.Get("productID")); List <DTO.Manufacturer> manus = CommonBUS.GetAllManufacturer(); List <DTO.Origin> origins = CommonBUS.GetAllOrigin(); List <DTO.Category> categories = product_BUS.GetAllCategory(); DTO.Product sp = Product_BUS.GetEntityByID <DTO.Product>(proID); txtProductName.Text = sp.ProductName.Trim(); txtProductCode.Text = sp.ProductCode.Trim(); txtQuantity.Text = sp.Quantity.ToString(); txtPrice.Text = sp.Price.ToString(); txtImgURL.Text = string.IsNullOrEmpty(HttpUtility.UrlDecode(sp.Image)) ? "" : "/Admin/Img/images/" + HttpUtility.UrlDecode(sp.Image); imgProduct.ImageUrl = "../../Img/images/" + (string.IsNullOrEmpty(HttpUtility.UrlDecode(sp.Image)) ? "noimg.png" : HttpUtility.UrlDecode(sp.Image)); txtNhaSX.DataSource = manus; txtNhaSX.SelectedValue = sp.ManufacturerID.ToString(); txtNhaSX.DataBind(); txtXuatXu.DataSource = origins; txtXuatXu.SelectedValue = sp.OriginID.ToString(); txtXuatXu.DataBind(); txtSummary.Text = string.IsNullOrEmpty(sp.Summary) ? "" : HttpUtility.UrlDecode(sp.Summary.Trim()); txtDetail.Text = string.IsNullOrEmpty(sp.Content) ? "" : HttpUtility.UrlDecode(sp.Content.Trim()); ckCategory.DataSource = categories; // ckCategory.DataBind(); radFreeShip.Checked = sp.Ship == 0; radQuantityShip.Checked = sp.Ship != 0; txtNumShip.Text = sp.Ship == 0 ? "" : sp.Ship.ToString(); chkSale.Checked = sp.IsSale; txtAmountSale.Text = sp.IsSale ? sp.AmountSale.ToString() : ""; txtQuantitySale.Text = sp.IsSale ? sp.QuantitySale.ToString() : ""; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["AccountName"] == null) { Response.Redirect("../Login/Login.aspx"); } proID = Guid.Parse(Request.QueryString.Get("productID")); product = Product_BUS.GetEntityByID <DTO.Product>(proID); if (!IsPostBack) { txtProductInfo.Text = GetProductInfo(); productImg.ImageUrl = "../../Img/images/" + (string.IsNullOrEmpty(product.Image) ? "noimg.png" : product.Image); //btnBack.Attributes.Add("onClick", "javascript:history.back(); return false;"); LoadGift(); //Load DropDownList tất cả sp List <DTO.Product> allProduct = Product_BUS.getAllProduct(); ddlAllProduct.DataSource = allProduct; ddlAllProduct.DataTextField = "ProductName"; ddlAllProduct.DataValueField = "ProductID"; ddlAllProduct.DataBind(); } }
private void LoadGift() { List <DTO.GiftAndQuantity> lst = Product_BUS.GetGiftByProductID(proID); var obj = lst.Select((item, index) => { return(new { ProductName = item.Gift.ProductName, Price = item.Gift.Price.ToString("0,0", CultureInfo.CurrentCulture), Quantity = item.Quantity + "", Image = "../../Img/images/" + item.Gift.Image, LinkDetail = "ProductDetail.aspx?productID=" + item.Gift.ProductID, LinkDelete = "", GiftInfo = "Tên sản phẩm: <b>" + item.Gift.ProductName + "</b>" + "<br/>Giá: <b>" + item.Gift.Price.ToString("0,0", CultureInfo.CurrentCulture) + "đ" + "<br/>Số lượng tặng: <b>" + item.Quantity + "</b>" + "<br/>", GiftID = item.GiftID }); }); lstGift.DataSource = obj; lstGift.DataBind(); }
public void LoadProductList() { List <Product_DTO> productList = Product_BUS.LoadProduct(); dtgvProductListOfStore.DataSource = productList; }
protected void btnLamMoi_Click(object sender, EventArgs e) { BindData(Product_BUS.getAllProduct()); txtSearch.Text = ""; }