コード例 #1
0
ファイル: category.aspx.cs プロジェクト: yoorke/WebShopAdmin
        private void loadAttributes()
        {
            AttributeBL attributeBL = new AttributeBL();

            dgvAttributes.DataSource = attributeBL.GetAttributesForCategory(int.Parse(lblCategoryID.Value));
            dgvAttributes.DataBind();
        }
コード例 #2
0
ファイル: attribute.aspx.cs プロジェクト: yoorke/WebShopAdmin
        private void loadValues()
        {
            AttributeBL attributeBL = new AttributeBL();

            dgvAttributeValues.DataSource = attributeBL.GetAttributeValues(int.Parse(lblAttributeID.Value));
            dgvAttributeValues.DataBind();
        }
コード例 #3
0
        private void loadAttributes()
        {
            AttributeBL attributeBL = new AttributeBL();

            dgvAttributes.DataSource = (cmbCategory.SelectedIndex > 0) ? attributeBL.GetAttributesForCategory(int.Parse(cmbCategory.SelectedValue)) : attributeBL.GetAllAttributes();
            dgvAttributes.DataBind();
        }
コード例 #4
0
        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();
            }
        }
コード例 #5
0
ファイル: attribute.aspx.cs プロジェクト: yoorke/WebShopAdmin
        protected void dgvAttributeValues_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            AttributeBL attributeBL = new AttributeBL();

            attributeBL.DeleteAttributeValue(int.Parse(dgvAttributeValues.DataKeys[e.RowIndex].Values[0].ToString()));

            loadValues();
        }
コード例 #6
0
ファイル: category.aspx.cs プロジェクト: yoorke/WebShopAdmin
        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();
        }
コード例 #7
0
ファイル: category.aspx.cs プロジェクト: yoorke/WebShopAdmin
        protected void chkIsDescription_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox    checkBox = (CheckBox)sender;
            GridViewRow row      = (GridViewRow)checkBox.NamingContainer;

            AttributeBL attributeBL = new AttributeBL();

            attributeBL.SetIsDescription(int.Parse(lblCategoryID.Value), int.Parse(((Label)row.FindControl("lblAttributeID")).Text), bool.Parse(((CheckBox)row.FindControl("chkIsDescription")).Checked.ToString()));
        }
コード例 #8
0
        public void setValues()
        {
            AttributeBL attributeBL = new AttributeBL();

            cmbAttribute.DataSource     = attributeBL.GetAttributeValues(_attributeID);
            cmbAttribute.DataValueField = "attributeValueID";
            cmbAttribute.DataTextField  = "value";
            cmbAttribute.DataBind();
            cmbAttribute.SelectedValue = cmbAttribute.Items.FindByText("NP").Value;
            lblAttributeID.Value       = _attributeID.ToString();
        }
コード例 #9
0
ファイル: attribute.aspx.cs プロジェクト: yoorke/WebShopAdmin
        private void loadAttribute(int attributeID)
        {
            AttributeBL attributeBL = new AttributeBL();

            eshopBE.Attribute attribute = attributeBL.GetAttribute(attributeID);

            txtName.Text             = attribute.Name;
            lblAttributeID.Value     = attribute.AttributeID.ToString();
            Page.Title               = attribute.Name + " | Admin panel";
            chkIsDescription.Checked = attribute.IsDescription;

            loadValues();
        }
コード例 #10
0
ファイル: attribute.aspx.cs プロジェクト: yoorke/WebShopAdmin
        protected void btnAddValue_Click(object sender, EventArgs e)
        {
            AttributeValue attributeValue = new AttributeValue();

            attributeValue.Value       = txtValue.Text;
            attributeValue.AttributeID = int.Parse(lblAttributeID.Value);

            AttributeBL attributeBL = new AttributeBL();

            attributeBL.SaveAttributeValue(attributeValue, false);

            loadValues();
        }
コード例 #11
0
ファイル: category.aspx.cs プロジェクト: yoorke/WebShopAdmin
        private void loadIntoForm()
        {
            CategoryBL categoryBl = new CategoryBL();

            cmbParent.DataSource     = categoryBl.GetNestedCategoriesDataTable(true, true);
            cmbParent.DataTextField  = "name";
            cmbParent.DataValueField = "categoryID";
            cmbParent.DataBind();

            AttributeBL attributeBL = new AttributeBL();

            cmbAttribute.DataSource     = attributeBL.GetAllAttributes();
            cmbAttribute.DataTextField  = "name";
            cmbAttribute.DataValueField = "attributeID";
            cmbAttribute.DataBind();

            cmbCriterion.Items.Add("Novi");
            cmbCriterion.Items.Add("Ceni");
            cmbCriterion.Items.Add("Slučajni");

            txtPricePercent.Text    = "0,00";
            txtWebPricePercent.Text = "0,00";

            cmbSlider.DataSource     = new SliderBL().GetSliders(true);
            cmbSlider.DataTextField  = "name";
            cmbSlider.DataValueField = "sliderID";
            cmbSlider.DataBind();

            cmbCategoryBanner.DataSource     = new CategoryBannerBL().GetCategoryBanners(true);
            cmbCategoryBanner.DataValueField = "categoryBannerID";
            cmbCategoryBanner.DataTextField  = "name";
            cmbCategoryBanner.DataBind();

            cmbExtraMenu.DataSource     = new CategoryExtraMenuBL().GetCategoryExtraMenus(true);
            cmbExtraMenu.DataTextField  = "name";
            cmbExtraMenu.DataValueField = "categoryExtraMenuID";
            cmbExtraMenu.DataBind();

            cmbBrand.DataSource     = new BrandBL().GetBrands(true);
            cmbBrand.DataTextField  = "name";
            cmbBrand.DataValueField = "brandID";
            cmbBrand.DataBind();

            chkUpdateProductsFromExternalApplication.Visible = bool.Parse(ConfigurationManager.AppSettings["updateProductsFromExternalApplication"]);
            chkExportProducts.Visible = bool.Parse(ConfigurationManager.AppSettings["exportProducts"]);

            cmbCategoryBrand.DataSource     = new BrandBL().GetBrands(false);
            cmbCategoryBrand.DataTextField  = "name";
            cmbCategoryBrand.DataValueField = "brandID";
            cmbCategoryBrand.DataBind();
        }
コード例 #12
0
ファイル: category.aspx.cs プロジェクト: yoorke/WebShopAdmin
        protected void btnSavePositions_Click(object sender, EventArgs e)
        {
            int         categoryID  = int.Parse(lblCategoryID.Value);
            AttributeBL attributeBL = new AttributeBL();

            for (int i = 0; i < dgvAttributes.Rows.Count; i++)
            {
                int attributeID = int.Parse(((Label)dgvAttributes.Rows[i].FindControl("lblAttributeID")).Text);
                int position    = 0;
                int.TryParse(((TextBox)dgvAttributes.Rows[i].FindControl("txtPosition")).Text, out position);

                attributeBL.SaveAttributePositionForCategory(attributeID, categoryID, position);
            }
        }
コード例 #13
0
ファイル: category.aspx.cs プロジェクト: yoorke/WebShopAdmin
        protected void dgvAttributes_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                AttributeBL attributeBL = new AttributeBL();
                int         status      = attributeBL.DeleteAttributeForCategory(int.Parse(lblCategoryID.Value), int.Parse(dgvAttributes.DataKeys[e.RowIndex].Values[0].ToString()));

                loadAttributes();
            }
            catch (BLException ex)
            {
                setStatus(ex.Message, System.Drawing.Color.Red, "danger");
            }
        }
コード例 #14
0
ファイル: category.aspx.cs プロジェクト: yoorke/WebShopAdmin
        protected void btnAddAttribute_Click(object sender, EventArgs e)
        {
            try
            {
                AttributeBL attributeBL = new AttributeBL();
                attributeBL.SaveAttributeForCategory(int.Parse(lblCategoryID.Value), int.Parse(cmbAttribute.SelectedValue));

                loadAttributes();
            }
            catch (BLException blException)
            {
                setStatus(blException.Message, System.Drawing.Color.Red, "danger");
            }
        }
コード例 #15
0
        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);
        }
コード例 #16
0
        protected void btnSaveAttribute_Click(object sender, EventArgs e)
        {
            eshopBE.Attribute attribute = new eshopBE.Attribute();
            attribute.Name          = txtName.Text;
            attribute.IsDescription = chkIsDescription.Checked;
            if (lblAttributeID.Value != string.Empty)
            {
                attribute.AttributeID = int.Parse(lblAttributeID.Value);
            }

            AttributeBL attributeBL = new AttributeBL();

            attributeBL.SaveAttribute(attribute);

            Response.Redirect("/administrator/attributes.aspx");
        }
コード例 #17
0
ファイル: attribute.aspx.cs プロジェクト: yoorke/WebShopAdmin
        protected void btnSaveAttribute_Click(object sender, EventArgs e)
        {
            eshopBE.Attribute attribute = new eshopBE.Attribute();
            attribute.Name          = txtName.Text;
            attribute.IsDescription = chkIsDescription.Checked;
            if (lblAttributeID.Value != string.Empty)
            {
                attribute.AttributeID = int.Parse(lblAttributeID.Value);
            }

            AttributeBL attributeBL = new AttributeBL();

            attributeBL.SaveAttribute(attribute);

            Response.Redirect("/" + ConfigurationManager.AppSettings["webshopAdminUrl"] + "/attributes.aspx");
        }
コード例 #18
0
        protected void btnAddAttributeValue_Click(object sender, EventArgs e)
        {
            switch (lblType.Value)
            {
            case "attribute":
            {
                AttributeBL attributeBL = new AttributeBL();
                attributeBL.SaveAttributeValue(new AttributeValue(-1, txtAttributeValue.Text, int.Parse(lblAttributeID.Value), 0, string.Empty, 0), false);

                foreach (object control in pnlAttributes.Controls)
                {
                    if (control is customControls.AttributeControl)
                    {
                        if (((customControls.AttributeControl)control).ID == lblAttributeName.Value)
                        {
                            ((customControls.AttributeControl)control).setValues();
                        }
                    }
                }
                break;
            }

            case "supplier":
            {
                SupplierBL supplierBL = new SupplierBL();
                supplierBL.SaveSupplier(new Supplier(-1, txtAttributeValue.Text));
                loadSupplier();
                break;
            }

            case "brand":
            {
                BrandBL brandBL = new BrandBL();
                brandBL.SaveBrand(new Brand(-1, txtAttributeValue.Text));
                loadBrands();
                break;
            }
            }
            txtAttributeValue.Text = string.Empty;
        }
コード例 #19
0
        private void loadIntoForm()
        {
            CategoryBL categoryBl = new CategoryBL();

            cmbParent.DataSource     = categoryBl.GetCategories();
            cmbParent.DataTextField  = "name";
            cmbParent.DataValueField = "categoryID";
            cmbParent.DataBind();

            AttributeBL attributeBL = new AttributeBL();

            cmbAttribute.DataSource     = attributeBL.GetAllAttributes();
            cmbAttribute.DataTextField  = "name";
            cmbAttribute.DataValueField = "attributeID";
            cmbAttribute.DataBind();

            cmbCriterion.Items.Add("Novi");
            cmbCriterion.Items.Add("Ceni");
            cmbCriterion.Items.Add("Slučajni");

            txtPricePercent.Text    = "0,00";
            txtWebPricePercent.Text = "0,00";

            cmbCategoryBanner.DataSource     = new CategoryBannerBL().GetCategoryBanners(true);
            cmbCategoryBanner.DataValueField = "categoryBannerID";
            cmbCategoryBanner.DataTextField  = "name";
            cmbCategoryBanner.DataBind();

            cmbExtraMenu.DataSource     = new CategoryExtraMenuBL().GetCategoryExtraMenus(true);
            cmbExtraMenu.DataTextField  = "name";
            cmbExtraMenu.DataValueField = "categoryExtraMenuID";
            cmbExtraMenu.DataBind();

            cmbBrand.DataSource     = new BrandBL().GetBrands(true);
            cmbBrand.DataTextField  = "name";
            cmbBrand.DataValueField = "brandID";
            cmbBrand.DataBind();
        }