/// <summary>
    /// Populates the colors.
    /// </summary>
    /// <param name="productID">The product ID.</param>
    /// <param name="gridView">The grid view.</param>
    /// <param name="repeaterItemIndex">Index of the repeater item.</param>
    private void populateColors(int productID)
    {
        var ctx           = new DAL.DBML.MoscotDataClassesDataContext();
        var productColors = (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
                             where pa.ClassId == 1 && pa.ProductId == productID
                             select new
        {
            //CombinationID = pac.CombinationId,
            Color = pa.AttributeValue
        }).Distinct();

        ColorDropDownList.Items.Clear();
        ColorDropDownList.Items.Add(new ListItem()
        {
            Text  = "Color",
            Value = ""
        });

        ColorDropDownList.DataSource     = productColors;
        ColorDropDownList.DataTextField  = "Color";
        ColorDropDownList.DataValueField = "Color";
        ColorDropDownList.DataBind();
    }
Beispiel #2
0
        public void ColoresDropDownList()
        {
            Colores color = new Colores();

            ColorDropDownList.DataSource     = color.Listado("*", "1=1", "");
            ColorDropDownList.DataTextField  = "Descripcion";
            ColorDropDownList.DataValueField = "ColorId";
            ColorDropDownList.DataBind();
            ColorDropDownList.Items.Insert(0, "Elige Color");
        }
        public void ObtenerDropDownList()
        {
            Marcas marca = new Marcas();

            MarcaDropDownList.DataSource     = marca.Listado(" * ", " 1=1 ", " ");
            MarcaDropDownList.DataTextField  = "Descripcion";
            MarcaDropDownList.DataValueField = "MarcaId";
            MarcaDropDownList.DataBind();
            MarcaDropDownList.Items.Insert(0, "Seleccionar--");

            Modelos modelo = new Modelos();

            ModeloDropDownList.DataSource     = modelo.Listado(" * ", " 1=1 ", " ");
            ModeloDropDownList.DataTextField  = "Descripcion";
            ModeloDropDownList.DataValueField = "ModeloId";
            ModeloDropDownList.DataBind();
            ModeloDropDownList.Items.Insert(0, "Seleccionar--");

            Motores motor = new Motores();

            MotorDropDownList.DataSource     = motor.Listado(" * ", " 1=1 ", " ");
            MotorDropDownList.DataTextField  = "Descripcion";
            MotorDropDownList.DataValueField = "MotorId";
            MotorDropDownList.DataBind();
            MotorDropDownList.Items.Insert(0, "Seleccionar--");

            Colores color = new Colores();

            ColorDropDownList.DataSource     = color.Listado(" * ", " 1=1 ", " ");
            ColorDropDownList.DataTextField  = "Descripcion";
            ColorDropDownList.DataValueField = "ColorId";
            ColorDropDownList.DataBind();
            ColorDropDownList.Items.Insert(0, "Seleccionar--");

            TipoVehiculos tipo = new TipoVehiculos();

            TipoDropDownList.DataSource     = tipo.Listado(" * ", " 1=1 ", " ");
            TipoDropDownList.DataTextField  = "Descripcion";
            TipoDropDownList.DataValueField = "TipoVehiculoId";
            TipoDropDownList.DataBind();
            TipoDropDownList.Items.Insert(0, "Seleccionar--");
        }
    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);
    }