Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["typeId"] != null && Request.QueryString["typeId"] != "")
         {
             int proTypeId = Convert.ToInt32(Request.QueryString["typeId"]);
             List <Model.ProductType> list = ProductTypeBll.GetProductType(proTypeId);
             if (list.Count > 0)
             {
                 lblType.Text        = list[0].TypeName;
                 hftypeId.Value      = proTypeId.ToString();
                 hlnkPro.NavigateUrl = "Product.aspx?typeId=" + hftypeId.Value;
                 txtTimer.Value      = DateTime.Now.ToString("yyyy-MM-dd");
             }
         }
         else if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
         {
             int proId = Convert.ToInt32(Request.QueryString["id"]);
             hfId.Value = proId.ToString();
             List <Model.Product> list = ProductBll.GetProductbyId(proId);
             if (list.Count > 0)
             {
                 txtTitle.Text    = list[0].Title;
                 txtTimer.Value   = list[0].CreateTime;
                 txtImg.Text      = list[0].ImgUrl;
                 txtBigImg.Text   = list[0].BigImgUrl;
                 fck_intro.Value  = list[0].Intro;
                 fck_detail.Value = list[0].Details;
                 chkIndex.Checked = Convert.ToBoolean(list[0].IndexShow);
                 chkShow.Checked  = Convert.ToBoolean(list[0].IsShow);
                 List <ProductType> list_proType = ProductTypeBll.GetProductType(list[0].ProTypeId);
                 if (list_proType.Count > 0)
                 {
                     lblType.Text = list_proType[0].TypeName;
                 }
                 else
                 {
                     lblType.Text = "";
                 }
                 hlnkPro.NavigateUrl = "Product.aspx?typeId=" + list[0].ProTypeId;
             }
         }
     }
 }