Beispiel #1
0
        private void loadIntoForm()
        {
            loadBrands();

            CategoryBL categoryBL = new CategoryBL();

            cmbCategory.DataSource     = categoryBL.GetCategories();
            cmbCategory.DataTextField  = "name";
            cmbCategory.DataValueField = "categoryID";
            cmbCategory.DataBind();

            VatBL vatBL = new VatBL();

            cmbVat.DataSource     = vatBL.GetVats();
            cmbVat.DataValueField = "vatID";
            cmbVat.DataTextField  = "vatValue";
            cmbVat.DataBind();
            cmbVat.SelectedIndex = 3;

            loadSupplier();

            PromotionBL promotionBL = new PromotionBL();

            cmbPromotions.DataSource     = promotionBL.GetPromotions(true, null, null);
            cmbPromotions.DataTextField  = "name";
            cmbPromotions.DataValueField = "promotionID";
            cmbPromotions.DataBind();
        }
Beispiel #2
0
        private void loadPromotions()
        {
            PromotionBL promotionBL = new PromotionBL();

            dgvPromotions.DataSource = promotionBL.GetPromotions(false, null, null);
            dgvPromotions.DataBind();
        }
        private void savePromotion()
        {
            try
            {
                Promotion promotion = new Promotion();
                promotion.Name            = txtName.Text;
                promotion.Value           = double.Parse(txtValue.Text);
                promotion.ImageUrl        = txtImageUrl.Text;
                promotion.ShowOnFirstPage = chkShowOnFirstPage.Checked;
                promotion.DateFrom        = DateTime.Parse(txtDateFrom.Text).ToUniversalTime();
                promotion.DateTo          = DateTime.Parse(txtDateTo.Text).ToUniversalTime();
                if (lblPromotionID.Value != string.Empty)
                {
                    promotion.PromotionID = int.Parse(lblPromotionID.Value);
                }
                promotion.Url        = txtUrl.Text;
                promotion.ShowOnMenu = chkShowOnMenu.Checked;

                PromotionBL promotionBL = new PromotionBL();
                promotionBL.SavePromotion(promotion);
            }
            catch (BLException ex)
            {
                setStatus(ex.Message, System.Drawing.Color.Red, true);
            }
        }
Beispiel #4
0
        private void loadPromotion(string url)
        {
            Promotion promotion = new PromotionBL().GetPromotion(url);

            rptProducts.DataSource = new ProductBL().GetProductsForPromotion(promotion.PromotionID);
            rptProducts.DataBind();
            lblPromotionName.Text = promotion.Name;
        }
Beispiel #5
0
 protected void cmbPromotions_SelectedIndexChanged(object sender, EventArgs e)
 {
     //double value = cmbPromotions.SelectedItem;
     //txtPromotionPrice.Text = ((Promotion)cmbPromotions.SelectedItem).Value.ToString();
     if (cmbPromotions.SelectedIndex > 0)
     {
         double value = new PromotionBL().GetPromotion(int.Parse(cmbPromotions.SelectedValue)).Value;
         txtPromotionPrice.Text = ((int)(double.Parse(txtWebPrice.Text) / ((value / 100) + 1)) / 100 * 100 - 10).ToString();
     }
 }
Beispiel #6
0
        protected void dgvPromotions_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                PromotionBL promotionBL = new PromotionBL();
                int         status      = promotionBL.DeletePromotion(int.Parse(dgvPromotions.DataKeys[e.RowIndex].Values[0].ToString()));

                Response.Redirect("~/" + ConfigurationManager.AppSettings["webshopAdminUrl"] + "/promotions.aspx");
            }
            catch (BLException ex)
            {
                setStatus(ex.Message, System.Drawing.Color.Red, true);
            }
        }
Beispiel #7
0
        protected void dgvPromotions_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                PromotionBL promotionBL = new PromotionBL();
                int         status      = promotionBL.DeletePromotion(int.Parse(dgvPromotions.DataKeys[e.RowIndex].Values[0].ToString()));

                Response.Redirect("/administrator/promotions.aspx");
            }
            catch (BLException ex)
            {
                setStatus(ex.Message, System.Drawing.Color.Red, true);
            }
        }
Beispiel #8
0
 protected void btnAddToPromotion_Click(object sender, EventArgs e)
 {
     if (cmbPromotions.SelectedIndex > 0)
     {
         double value = new PromotionBL().GetPromotion(int.Parse(cmbPromotions.SelectedValue)).Value;
         for (int i = 0; i < dgvProducts.Rows.Count; i++)
         {
             if (((CheckBox)dgvProducts.Rows[i].FindControl("chkSelect")).Checked)
             {
                 new ProductBL().SetPromotionPrice(int.Parse(((Label)dgvProducts.Rows[i].FindControl("lblProductID")).Text), double.Parse(((Label)dgvProducts.Rows[i].FindControl("lblWebPrice")).Text), value, int.Parse(cmbPromotions.SelectedValue));
             }
         }
     }
 }
Beispiel #9
0
        private void loadIntoForm()
        {
            loadBrands();

            CategoryBL categoryBL = new CategoryBL();

            //cmbCategory.DataSource = categoryBL.GetCategories();
            cmbCategory.DataSource     = categoryBL.GetNestedCategoriesDataTable(true, true);
            cmbCategory.DataTextField  = "name";
            cmbCategory.DataValueField = "categoryID";
            cmbCategory.DataBind();

            VatBL vatBL = new VatBL();

            cmbVat.DataSource     = vatBL.GetVats();
            cmbVat.DataValueField = "vatID";
            cmbVat.DataTextField  = "vatValue";
            cmbVat.DataBind();
            cmbVat.SelectedIndex = 3;

            loadSupplier();

            PromotionBL promotionBL = new PromotionBL();

            cmbPromotions.DataSource     = promotionBL.GetPromotions(true, null, null);
            cmbPromotions.DataTextField  = "name";
            cmbPromotions.DataValueField = "promotionID";
            cmbPromotions.DataBind();

            cmbUnitOfMeasure.DataSource     = new UnitOfMeasureBL().GetUnitsOfMeasure(true);
            cmbUnitOfMeasure.DataTextField  = "FullName";
            cmbUnitOfMeasure.DataValueField = "unitOfMeasureID";
            cmbUnitOfMeasure.SelectedValue  = "2";
            cmbUnitOfMeasure.DataBind();

            cmbCategories.DataSource     = categoryBL.GetNestedCategoriesDataTable();
            cmbCategories.DataTextField  = "name";
            cmbCategories.DataValueField = "categoryID";
            cmbCategories.DataBind();

            if (!bool.Parse(ConfigurationManager.AppSettings["productInMultipleCategories"]))
            {
                divProductInMultipleCategories.Visible = false;
            }
            else
            {
                btnAddProductToCategory.Enabled = cmbCategory.SelectedIndex > 0 ? true : false;
            }
        }
Beispiel #10
0
        private void loadPromotions()
        {
            PromotionBL promotionBL = new PromotionBL();

            //ProductBL productBL = new ProductBL();

            rptPromotions.DataSource = promotionBL.GetPromotions(false, true, null);
            rptPromotions.DataBind();

            //productSlider.NumberOfProducts = 4;
            //ProductBL productBL = new ProductBL();
            //productSlider.Products = productBL.GetProductsForFirstPage(3, 8, "product.name");

            //productSlider1.NumberOfProducts = 4;
            //productSlider1.Products = productBL.GetProductsForFirstPage(3, 8, "product.name");
        }
        private void loadPromotion(int promotionID)
        {
            PromotionBL promotionBL = new PromotionBL();
            Promotion   promotion   = promotionBL.GetPromotion(promotionID);

            lblPromotionID.Value       = promotionID.ToString();
            txtName.Text               = promotion.Name;
            txtValue.Text              = promotion.Value.ToString();
            imgPromotion.ImageUrl      = "/images/" + promotion.ImageUrl;
            chkShowOnFirstPage.Checked = promotion.ShowOnFirstPage;
            txtImageUrl.Text           = promotion.ImageUrl;
            txtDateFrom.Text           = promotion.DateFrom.ToString();
            txtDateTo.Text             = promotion.DateTo.ToString();
            Page.Title             = promotion.Name;
            ViewState["pageTitle"] = promotion.Name;
            txtUrl.Text            = promotion.Url;
            chkShowOnMenu.Checked  = promotion.ShowOnMenu;
        }