Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!int.TryParse(this.Page.Request.QueryString["ProductId"], out this.productId))
     {
         base.GotoResourceNotFound();
     }
     else
     {
         int.TryParse(base.Request.QueryString["categoryId"], out this.categoryId);
         if (!this.Page.IsPostBack)
         {
             ProductInfo product = SubSiteProducthelper.GetProduct(this.productId);
             if (product == null)
             {
                 base.GotoResourceNotFound();
             }
             else
             {
                 if (!string.IsNullOrEmpty(base.Request.QueryString["categoryId"]))
                 {
                     this.litCategoryName.Text           = SubsiteCatalogHelper.GetFullCategory(this.categoryId);
                     this.ViewState["ProductCategoryId"] = this.categoryId;
                     this.lnkEditCategory.NavigateUrl    = "SelectMyCategory.aspx?categoryId=" + this.categoryId.ToString(CultureInfo.InvariantCulture);
                 }
                 else
                 {
                     this.litCategoryName.Text           = SubsiteCatalogHelper.GetFullCategory(product.CategoryId);
                     this.ViewState["ProductCategoryId"] = product.CategoryId;
                     this.lnkEditCategory.NavigateUrl    = "SelectMyCategory.aspx?categoryId=" + product.CategoryId.ToString(CultureInfo.InvariantCulture);
                 }
                 this.lnkEditCategory.NavigateUrl = this.lnkEditCategory.NavigateUrl + "&productId=" + product.ProductId.ToString(CultureInfo.InvariantCulture);
                 IList <int> productTags = new List <int>();
                 productTags = SubSiteProducthelper.GetProductTags(this.productId);
                 this.litralProductTag.SelectedValue = productTags;
                 if (productTags.Count > 0)
                 {
                     foreach (int num in productTags)
                     {
                         this.txtProductTag.Text = this.txtProductTag.Text + num.ToString() + ",";
                     }
                     this.txtProductTag.Text = this.txtProductTag.Text.Substring(0, this.txtProductTag.Text.Length - 1);
                 }
                 this.dropProductTypes.Enabled = false;
                 this.dropProductTypes.DataBind();
                 this.dropProductTypes.SelectedValue = product.TypeId;
                 this.dropProductLines.Enabled       = false;
                 this.dropProductLines.DataBind();
                 this.dropProductLines.SelectedValue = new int?(product.LineId);
                 this.dropBrandCategories.Enabled    = false;
                 this.dropBrandCategories.DataBind();
                 this.dropBrandCategories.SelectedValue = product.BrandId;
                 this.LoadProudct(product);
             }
         }
     }
 }
Exemplo n.º 2
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (!int.TryParse(this.Page.Request.QueryString["ProductId"], out this.productId))
     {
         base.GotoResourceNotFound();
         return;
     }
     int.TryParse(base.Request.QueryString["categoryId"], out this.categoryId);
     if (!this.Page.IsPostBack)
     {
         ProductInfo product = SubSiteProducthelper.GetProduct(this.productId);
         if (product == null)
         {
             base.GotoResourceNotFound();
             return;
         }
         if (!string.IsNullOrEmpty(base.Request.QueryString["categoryId"]))
         {
             this.litCategoryName.Text           = SubsiteCatalogHelper.GetFullCategory(this.categoryId);
             this.ViewState["ProductCategoryId"] = this.categoryId;
             this.lnkEditCategory.NavigateUrl    = "SelectMyCategory.aspx?categoryId=" + this.categoryId.ToString(System.Globalization.CultureInfo.InvariantCulture);
         }
         else
         {
             this.litCategoryName.Text           = SubsiteCatalogHelper.GetFullCategory(product.CategoryId);
             this.ViewState["ProductCategoryId"] = product.CategoryId;
             this.lnkEditCategory.NavigateUrl    = "SelectMyCategory.aspx?categoryId=" + product.CategoryId.ToString(System.Globalization.CultureInfo.InvariantCulture);
         }
         System.Web.UI.WebControls.HyperLink expr_148 = this.lnkEditCategory;
         expr_148.NavigateUrl = expr_148.NavigateUrl + "&productId=" + product.ProductId.ToString(System.Globalization.CultureInfo.InvariantCulture);
         System.Collections.Generic.IList <int> list = new System.Collections.Generic.List <int>();
         list = SubSiteProducthelper.GetProductTags(this.productId);
         this.litralProductTag.SelectedValue = list;
         if (list.Count > 0)
         {
             foreach (int current in list)
             {
                 TrimTextBox expr_1B4 = this.txtProductTag;
                 expr_1B4.Text = expr_1B4.Text + current.ToString() + ",";
             }
             this.txtProductTag.Text = this.txtProductTag.Text.Substring(0, this.txtProductTag.Text.Length - 1);
         }
         this.dropProductTypes.Enabled = false;
         this.dropProductTypes.DataBind();
         this.dropProductTypes.SelectedValue = product.TypeId;
         this.dropProductLines.Enabled       = false;
         this.dropProductLines.DataBind();
         this.dropProductLines.SelectedValue = new int?(product.LineId);
         this.dropBrandCategories.Enabled    = false;
         this.dropBrandCategories.DataBind();
         this.dropBrandCategories.SelectedValue = product.BrandId;
         this.LoadProudct(product);
     }
 }