/// <summary>
    /// Populates the sizes.
    /// </summary>
    /// <param name="productID">The product ID.</param>
    /// <param name="color">The color.</param>
    /// <param name="gridView">The grid view.</param>
    /// <param name="repeaterItemIndex">Index of the repeater item.</param>
    private void populateSizes(int productID, string color)
    {
        DAL.DBML.MoscotDataClassesDataContext ctx = new DAL.DBML.MoscotDataClassesDataContext();
        var productSizes = from pacd in ctx.mss_ProductAttributeCombinationDetails
                           join pa in ctx.mss_ProductAttributes on pacd.AttributeId equals pa.AttributeId
                           join pac in ctx.mss_ProductAttributeCombinations on pacd.CombinationId equals pac.CombinationId
                           join pacd2 in ctx.mss_ProductAttributeCombinationDetails on pac.CombinationId equals pacd2.CombinationId
                           join pa2 in ctx.mss_ProductAttributes on pacd2.AttributeId equals pa2.AttributeId
                           join pac2 in ctx.mss_ProductAttributeCombinations on pacd2.CombinationId equals pac2.CombinationId
                           where pa.ClassId == 2 && pa.ProductId == productID &&
                           pa2.ClassId == 1 && pa2.AttributeValue == color
                           select new
        {
            CombinationID = pac.CombinationId,
            Size          = pa.AttributeValue
        };

        SizeDropDownList.Items.Clear();
        SizeDropDownList.Items.Add(new ListItem()
        {
            Text  = "Size",
            Value = "0"
        });

        SizeDropDownList.DataSource     = productSizes;
        SizeDropDownList.DataTextField  = "Size";
        SizeDropDownList.DataValueField = "CombinationID";
        SizeDropDownList.DataBind();
    }
Exemplo n.º 2
0
 public void Refresh()
 {
     txtCode.Text = "";
     txtQty.Text  = "";
     txtCost.Text = "";
     txtMrp.Text  = "";
     CategoriesDropDownList.ClearSelection();
     SizeDropDownList.ClearSelection();
     ItemsDropDownList.ClearSelection();
 }
Exemplo n.º 3
0
        public void GetSizeByCategories()
        {
            int Id = Convert.ToInt32(CategoriesDropDownList.SelectedValue);

            SizeDropDownList.DataSource     = _ItemRepository.GetSizeByCategories(Id);
            SizeDropDownList.DataTextField  = "Size";
            SizeDropDownList.DataValueField = "Id";
            SizeDropDownList.DataBind();

            SizeDropDownList.Items.Insert(0, new ListItem("Chose Size", "0"));
        }
Exemplo n.º 4
0
        protected void AddButton_Click(object sender, EventArgs e)
        {
            Items _Items = new Items();

            _Items.Code         = txtCode.Text;
            _Items.Name         = txtName.Text;
            _Items.ReorderLevel = 5;
            _Items.Size         = SizeDropDownList.SelectedItem.ToString();
            _Items.CategoriesId = Convert.ToInt32(CategoriesDropDownList.SelectedValue);

            if (CategoriesDropDownList.SelectedIndex > 0)
            {
                if (SizeDropDownList.SelectedIndex > 0)
                {
                    decimal AlreadyExistCaegory = _ItemRepository.AlreadyExistName(_Items);
                    if (AlreadyExistCaegory >= 1)
                    {
                        ShowMessage("This Item Already Here!!!...", MessageType.Warning);
                    }
                    else
                    {
                        int Savesuccess = _ItemRepository.Add(_Items);
                        if (Savesuccess > 0)
                        {
                            ShowMessage("Successfully Saved Item....", MessageType.Success);
                            LoadItem();
                            AutoCodeGenerate();
                            GetAllCategories();
                            txtName.Text = "";
                            CategoriesDropDownList.ClearSelection();
                            SizeDropDownList.ClearSelection();
                            //Response.Redirect(Request.Url.AbsoluteUri);
                        }
                        else
                        {
                            ShowMessage("Failed Saving Item", MessageType.Warning);
                        }
                    }
                }
                else
                {
                    ShowMessage("Select Size", MessageType.Warning);
                    SizeDropDownList.Focus();
                }
            }
            else
            {
                ShowMessage("At First Select Catgeory", MessageType.Warning);
                CategoriesDropDownList.Focus();
            }
        }
Exemplo n.º 5
0
        protected void CategoriesDropDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                int Id = Convert.ToInt32(CategoriesDropDownList.SelectedValue);

                SizeDropDownList.DataSource     = _StocksInRepository.GetSizeByCategories(Id);
                SizeDropDownList.DataTextField  = "Size";
                SizeDropDownList.DataValueField = "Id";
                SizeDropDownList.DataBind();

                SizeDropDownList.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select Size", "0"));

                txtCode.Text = "";
            }
            catch
            {
            }
        }
    protected void UpdateButton_Click(object sender, EventArgs e)
    {
        if (ProductDropDownList.SelectedValue == "0")
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "clientScript", "alert('Please select product.')", true);
            ColorDropDownList.Focus();
            return;
        }
        if (ColorDropDownList.SelectedValue == "")
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "clientScript", "alert('Please select Color.')", true);
            ColorDropDownList.Focus();
            return;
        }
        if (SizeDropDownList.SelectedValue == "0")
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "clientScript", "alert('Please select Size.')", true);
            SizeDropDownList.Focus();
            return;
        }
        decimal productValue = 0m;

        if (!Decimal.TryParse(ProductCostTextBox.Text, out productValue))
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "clientScript", "alert('Please enter correct product cost.')", true);
            ProductCostTextBox.Focus();
            return;
        }


        int typeIndex = Convert.ToInt32(Request.QueryString["typeIndex"]);
        int editIndex = Convert.ToInt32(Request.QueryString["editIndex"]);
        var orderItem = GetSubOrders(typeIndex).ElementAt(editIndex);

        orderItem.ExchangeTypeID             = Convert.ToInt32(TypesDropDownList.SelectedValue);
        orderItem.ExchangeCombinationID      = Convert.ToInt32(SizeDropDownList.SelectedValue);
        orderItem.ExchangeLensID             = Convert.ToInt32(LensDropDownList.SelectedValue);
        orderItem.ExchangePrescriptionLensID = Convert.ToInt32(PrescriptionDropDownList.SelectedValue);
        orderItem.ExchangeProductValue       = productValue;

        string description = "";

        if (TypesDropDownList.SelectedValue != "" && TypesDropDownList.SelectedValue != "0")
        {
            description = description + TypesDropDownList.SelectedItem.Text;
        }
        if (ProductDropDownList.SelectedValue != "" && ProductDropDownList.SelectedValue != "0")
        {
            description = description + ", " + ProductDropDownList.SelectedItem.Text;
        }
        if (ColorDropDownList.SelectedValue != "" && ColorDropDownList.SelectedValue != "0")
        {
            description = description + " - " + ColorDropDownList.SelectedItem.Text;
        }
        if (SizeDropDownList.SelectedValue != "" && SizeDropDownList.SelectedValue != "0")
        {
            description = description + " - " + SizeDropDownList.SelectedItem.Text;
        }
        if (LensDropDownList.SelectedValue != "" && LensDropDownList.SelectedValue != "0")
        {
            description = description + "<br />Lens: " + LensDropDownList.SelectedItem.Text;
        }
        if (PrescriptionDropDownList.SelectedValue != "" && PrescriptionDropDownList.SelectedValue != "0")
        {
            description = description + "<br />RX: " + PrescriptionDropDownList.SelectedItem.Text;
            UpdatePrescription(ref PrescriptionPanel, ref orderItem);
            description = description + "<br />" + orderItem.ExchangePrescriptionLensSizes;
        }

        orderItem.ExchangeData = string.Format("{0}:{1};{2}:{3};{4}:{5};{6}:{7};{8}:{9};{10}:{11};{12}:{13}", TypesDropDownList.SelectedValue, TypesDropDownList.SelectedItem.Text, ProductDropDownList.SelectedValue, ProductDropDownList.SelectedItem.Text, ColorDropDownList.SelectedValue, ColorDropDownList.SelectedItem.Text, SizeDropDownList.SelectedValue, SizeDropDownList.SelectedItem.Text, LensDropDownList.SelectedValue, LensDropDownList.SelectedItem.Text, PrescriptionDropDownList.SelectedValue, PrescriptionDropDownList.SelectedItem.Text, ProductCostTextBox.Text, orderItem.ExchangePrescriptionLensSizes);
        orderItem.ExchangeProductDescription = "<br/><strong>Exchange with :</strong>" + description;

        NotificationLiteral.Text = "Updated.";
        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "clientScript", "hideExchangePopupControl();", true);
    }