Пример #1
0
        private void BindDefaultData()
        {
            List <DTO.Manufacturer> manus   = CommonBUS.GetAllManufacturer();
            List <DTO.Origin>       origins = CommonBUS.GetAllOrigin();

            ckCategory.DataSource = new Product_BUS().GetAllCategory();
            ckCategory.DataBind();
            txtNhaSX.DataSource = manus;
            txtNhaSX.DataBind();
            txtXuatXu.DataSource = origins;
            txtXuatXu.DataBind();
        }
Пример #2
0
        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);
        }
        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() : "";
            }
        }