private void loadAttributes() { AttributeBL attributeBL = new AttributeBL(); dgvAttributes.DataSource = attributeBL.GetAttributesForCategory(int.Parse(lblCategoryID.Value)); dgvAttributes.DataBind(); }
private void loadAttributes() { AttributeBL attributeBL = new AttributeBL(); dgvAttributes.DataSource = (cmbCategory.SelectedIndex > 0) ? attributeBL.GetAttributesForCategory(int.Parse(cmbCategory.SelectedValue)) : attributeBL.GetAllAttributes(); dgvAttributes.DataBind(); }
private void loadCategory(int categoryID) { CategoryBL categoryBL = new CategoryBL(); Category category = categoryBL.GetCategory(categoryID); txtName.Text = category.Name; txtUrl.Text = category.Url; txtImageUrl.Text = category.ImageUrl; cmbParent.SelectedValue = cmbParent.Items.FindByValue(category.ParentCategoryID.ToString()).Value; txtSortOrder.Text = category.SortOrder.ToString(); lblCategoryID.Value = category.CategoryID.ToString(); txtPricePercent.Text = category.PricePercent.ToString(); txtWebPricePercent.Text = category.WebPricePercent.ToString(); chkShowOnFirstPage.Checked = category.ShowOnFirstPage; txtNumber.Text = category.NumberOfProducts.ToString(); txtSortOrderFirstPage.Text = category.firstPageSortOrder.ToString(); if (category.firstPageOrderBy != string.Empty && category.firstPageOrderBy != null) { cmbCriterion.SelectedValue = cmbCriterion.Items.FindByText(category.firstPageOrderBy).Value; } setFirstPageControls(category.ShowOnFirstPage); Page.Title = category.Name + " | Admin panel"; ViewState.Add("pageTitle", Page.Title); txtDescription.Text = category.Description; chkActive.Checked = category.Active; cmbCategoryBanner.SelectedValue = category.CategoryBannerID != null?category.CategoryBannerID.ToString() : "-1"; if (lblCategoryID.Value != string.Empty) { AttributeBL attributeBL = new AttributeBL(); dgvAttributes.DataSource = attributeBL.GetAttributesForCategory(categoryID); dgvAttributes.DataBind(); } }
private void loadCategory(int categoryID) { CategoryBL categoryBL = new CategoryBL(); Category category = categoryBL.GetCategory(categoryID); txtName.Text = category.Name; txtUrl.Text = category.Url; txtImageUrl.Text = category.ImageUrl; //cmbParent.SelectedValue = cmbParent.Items.FindByValue(category.ParentCategoryID.ToString()).Value; cmbParent.SelectedValue = category.ParentCategoryID.ToString(); txtSortOrder.Text = category.SortOrder.ToString(); lblCategoryID.Value = category.CategoryID.ToString(); txtPricePercent.Text = category.PricePercent.ToString(); txtWebPricePercent.Text = category.WebPricePercent.ToString(); chkShowOnFirstPage.Checked = category.ShowOnFirstPage; txtNumber.Text = category.NumberOfProducts.ToString(); txtSortOrderFirstPage.Text = category.firstPageSortOrder.ToString(); if (category.firstPageOrderBy != string.Empty && category.firstPageOrderBy != null) { cmbCriterion.SelectedValue = cmbCriterion.Items.FindByText(category.firstPageOrderBy).Value; } setFirstPageControls(category.ShowOnFirstPage); Page.Title = category.Name + " | Admin panel"; ViewState.Add("pageTitle", Page.Title); txtDescription.Text = category.Description; chkActive.Checked = category.Active; if (category.Slider != null) { cmbSlider.SelectedValue = category.Slider.SliderID.ToString(); } cmbCategoryBanner.SelectedValue = category.CategoryBannerID != 0 ? category.CategoryBannerID.ToString() : "-1"; chkUpdateProductsFromExternalApplication.Checked = category.UpdateProductsFromExternalApplication; chkExportProducts.Checked = category.ExportProducts; imgIcon.ImageUrl = category.ImageUrl != string.Empty ? ResolveUrl("~/images/" + category.ImageUrl) : ResolveUrl("~/images/no-image.jpg"); lblCategoryName.Text = category.Name; ViewState.Add("categoryName", category.Name); txtExternalID.Text = category.ExternalID.ToString(); txtExternalParentID.Text = category.ExternalParentID.ToString(); if (lblCategoryID.Value != string.Empty) { AttributeBL attributeBL = new AttributeBL(); dgvAttributes.DataSource = attributeBL.GetAttributesForCategory(categoryID); dgvAttributes.DataBind(); } chkShowInFooter.Checked = category.ShowInFooter; rdbImageTypeStandard.Checked = category.ImageUrlSource == 0; rdbImageTypeSprite.Checked = category.ImageUrlSource == 1; txtPositionX.Text = category.ImageUrlPositionX.ToString(); txtPositionY.Text = category.ImageUrlPositionY.ToString(); txtIcon.Text = category.Icon; chkShowProductsFromSubCategories.Checked = category.ShowProductsFromSubCategories; txtPriceFixedAmount.Text = string.Format("{0:N2}", category.PriceFixedAmount); loadCategoryBrandPrice(); }
private void createControls() { AttributeBL attributeBL = new AttributeBL(); List <eshopBE.Attribute> attributes = attributeBL.GetAttributesForCategory(int.Parse(cmbCategory.SelectedValue)); pnlAttributes.Controls.Add(new LiteralControl("<br />")); pnlAttributes.Controls.Clear(); int count = 1; if (attributes != null) { foreach (eshopBE.Attribute attribute in attributes) { pnlAttributes.Controls.Add(new LiteralControl("<div class='form-group'>")); pnlAttributes.Controls.Add(new LiteralControl("<label for='cmbAttribute" + (count++).ToString() + "'>")); Literal name = new Literal(); name.Text = attribute.Name + ": "; pnlAttributes.Controls.Add(name); name = new Literal(); name.Text = attribute.AttributeID.ToString(); name.Visible = false; pnlAttributes.Controls.Add(name); pnlAttributes.Controls.Add(new LiteralControl("</label>")); /*DropDownList dropDownAttribute = new DropDownList(); * dropDownAttribute.ID = "cmbAttribute" + (count++).ToString(); * dropDownAttribute.DataSource = attributeBL.GetAttributeValues(attribute.AttributeID); * dropDownAttribute.DataTextField = "value"; * dropDownAttribute.DataValueField = "attributeValueID"; * dropDownAttribute.DataBind(); * dropDownAttribute.EnableViewState = true; * * pnlAttributes.Controls.Add(dropDownAttribute);*/ //attribute user control //UserControl attributeControl = (UserControl)Page.LoadControl("customControls/AttributeControl.ascx"); Control ac = new Control(); ac = LoadControl("customControls/AttributeControl.ascx"); ac.ID = "cmbAttribute" + (count++).ToString(); ((customControls.AttributeControl)ac).AttributeID = attribute.AttributeID; pnlAttributes.Controls.Add(ac); pnlAttributes.Controls.Add(new LiteralControl("</div><!--form-group-->")); } } Session.Add("dropDownCount", count - 1); }