コード例 #1
0
        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() : "";
            }
        }
コード例 #2
0
 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();
     }
 }