Beispiel #1
0
        public void ProductBinding()
        {
            DataTable objTableData = ProductProvider.GetProduct(m_ProductId);

            if (objTableData.Rows.Count > 0)
            {
                lblError.Text            = "Cập nhật sản phẩm";
                this.txtProductName.Text = txtProductNameOld.Text = objTableData.Rows[0]["ProductName"].ToString();
                this.txtCode.Text        = txtProductNameOld.Text = objTableData.Rows[0]["Code"].ToString();
                string strImageAdd1 = objTableData.Rows[0]["ImageAdd1"].ToString();
                string strImageAdd2 = objTableData.Rows[0]["ImageAdd2"].ToString();
                string strImageAdd3 = objTableData.Rows[0]["ImageAdd3"].ToString();
                urlSmallImageImgAdd1.Url = strImageAdd1;
                urlSmallImageImgAdd2.Url = strImageAdd2;
                urlSmallImageImgAdd3.Url = strImageAdd3;
                txtImageAdd1Old.Text     = strImageAdd1;
                txtImageAdd2Old.Text     = strImageAdd2;
                txtImageAdd3Old.Text     = strImageAdd3;
                string strSmallImage = objTableData.Rows[0]["Smallimage"].ToString();
                txtSmallimageOld.Text = strSmallImage;
                urlSmallImage.Url     = strSmallImage;
                string strLargeimage = objTableData.Rows[0]["Largeimage"].ToString();
                txtLargeimageOld.Text  = strLargeimage;
                urlLargeImage.Url      = strLargeimage;
                txtCreatedDateOld.Text = objTableData.Rows[0]["CreatedDate"].ToString();

                //this.imgImageFile.Src = string.Format("/Portals/{0}/{1}", this.PortalId, m_strOldImagePath);
                //spImageFile.InnerHtml = m_strOldImagePath;
                if (strImageAdd1.Contains("Portals"))
                {
                    this.imgAdd1.Src = strImageAdd1;
                }
                else
                {
                    this.imgAdd1.Src = string.Format("/Portals/{0}/{1}", this.PortalId, strImageAdd1);
                }
                if (strImageAdd2.Contains("Portals"))
                {
                    this.imgAdd2.Src = strImageAdd2;
                }
                else
                {
                    this.imgAdd2.Src = string.Format("/Portals/{0}/{1}", this.PortalId, strImageAdd2);
                }
                if (strImageAdd3.Contains("Portals"))
                {
                    this.imgAdd3.Src = strImageAdd3;
                }
                else
                {
                    this.imgAdd3.Src = string.Format("/Portals/{0}/{1}", this.PortalId, strImageAdd3);
                }
                this.spImgAdd1.InnerHtml = strImageAdd1;
                this.spImgAdd2.InnerHtml = strImageAdd2;
                this.spImgAdd3.InnerHtml = strImageAdd3;
                if (strSmallImage.Contains("Portals"))
                {
                    this.imgSmallImage.Src = strSmallImage;
                }
                else
                {
                    this.imgSmallImage.Src = string.Format("/Portals/{0}/{1}", this.PortalId, strSmallImage);
                }
                this.spSmallImage.InnerHtml = strSmallImage;
                if (strLargeimage.Contains("Portals"))
                {
                    this.imgLargeimage.Src = strLargeimage;
                }
                else
                {
                    this.imgLargeimage.Src = string.Format("/Portals/{0}/{1}", this.PortalId, strLargeimage);
                }
                spLargeimage.InnerHtml = strLargeimage;

                txtLead.Text = objTableData.Rows[0]["Lead"].ToString();

                txtSummary.Text       = objTableData.Rows[0]["Summary"].ToString();
                txtWeight.Text        = objTableData.Rows[0]["Weight"].ToString();
                txtPrice.Text         = objTableData.Rows[0]["Price"].ToString();
                txtPriceOld.Text      = objTableData.Rows[0]["PriceOld"].ToString();
                txtStatusProduct.Text = objTableData.Rows[0]["StatusProduct"].ToString();
                txtaddInfo1.Text      = objTableData.Rows[0]["AddInfo1"].ToString();
                txtaddInfo2.Text      = objTableData.Rows[0]["AddInfo2"].ToString();
                txtaddInfo3.Text      = objTableData.Rows[0]["AddInfo3"].ToString();

                txtaddInfo4.Text = objTableData.Rows[0]["AddInfo4"].ToString();
                txtaddInfo5.Text = objTableData.Rows[0]["AddInfo5"].ToString();
                txtaddInfo6.Text = objTableData.Rows[0]["AddInfo6"].ToString();

                txtaddRichInfo1.Text = objTableData.Rows[0]["AddRichInfo1"].ToString();
                txtaddRichInfo2.Text = objTableData.Rows[0]["AddRichInfo2"].ToString();
                txtaddRichInfo3.Text = objTableData.Rows[0]["AddRichInfo3"].ToString();

                txtOrder.Text             = objTableData.Rows[0]["Order"].ToString();
                this.txtProducedDate.Text = DateTime.Parse(objTableData.Rows[0]["ProducedDate"].ToString()).ToString("dd/MM/yyyy");
                this.txtDisplayDate.Text  = DateTime.Parse(objTableData.Rows[0]["DisplayDate"].ToString()).ToString("dd/MM/yyyy");
                txtExpiredDate.Text       = DateTime.Parse(objTableData.Rows[0]["ExpiredDate"].ToString()).ToString("dd/MM/yyyy");

                if (objTableData.Rows[0]["IsHot"].ToString() == "False")
                {
                    this.chkIsHot.Checked = false;
                }
                else
                {
                    this.chkIsHot.Checked = true;
                }
                this.txtHotPeriod.Text = objTableData.Rows[0]["HotPeriod"].ToString();
                //Bind Dynamic Form
                string strExtendedSettings = objTableData.Rows[0]["ExtendedSettings"].ToString();
                dtValue = new DataTable();
                dtValue = XMLProvider.XmlString2DataTable(strExtendedSettings);
                try
                {
                    if (dtValue != null && dtValue.Rows.Count > 0)
                    {
                        BindingDynamicForm(dtValue);
                    }
                }
                catch (Exception ex)
                {
                    lblError.Text         = ex.Message;
                    this.lblError.Visible = true;
                }
            }
        }