protected List <SpecificationAttributeOptionFilter> getAlreadyFilteredSpecs()
        {
            var result = new List <SpecificationAttributeOptionFilter>();

            string[] queryStringParams = getAlreadyFilteredSpecsQueryStringParams();
            foreach (string qsp in queryStringParams)
            {
                int id = 0;
                int.TryParse(Request.QueryString[qsp], out id);
                var sao = SpecificationAttributeManager.GetSpecificationAttributeOptionById(id);
                if (sao != null)
                {
                    var sa = sao.SpecificationAttribute;
                    if (sa != null)
                    {
                        result.Add(new SpecificationAttributeOptionFilter
                        {
                            SpecificationAttributeId   = sa.SpecificationAttributeId,
                            SpecificationAttributeName = sa.LocalizedName,
                            DisplayOrder = sa.DisplayOrder,
                            SpecificationAttributeOptionId   = sao.SpecificationAttributeOptionId,
                            SpecificationAttributeOptionName = sao.LocalizedName
                        });
                    }
                }
            }

            return(result);
        }
Example #2
0
        protected void OnSpecificationAttributeOptionsDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int saoId = (int)grdSpecificationAttributeOptions.DataKeys[e.RowIndex]["SpecificationAttributeOptionId"];
            SpecificationAttributeOption sao = SpecificationAttributeManager.GetSpecificationAttributeOptionById(saoId, 0);

            if (sao != null)
            {
                SpecificationAttributeManager.DeleteSpecificationAttributeOption(sao.SpecificationAttributeOptionId);
                BindData();
            }
        }
Example #3
0
        protected void rptrLanguageDivs2_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var txtLocalizedOptionName           = (TextBox)e.Item.FindControl("txtLocalizedOptionName");
                var lblLanguageId                    = (Label)e.Item.FindControl("lblLanguageId");
                var hfSpecificationAttributeOptionId = (HiddenField)e.Item.Parent.Parent.FindControl("hfSpecificationAttributeOptionId");

                int languageId = int.Parse(lblLanguageId.Text);
                int saoId      = Convert.ToInt32(hfSpecificationAttributeOptionId.Value);
                SpecificationAttributeOption sao = SpecificationAttributeManager.GetSpecificationAttributeOptionById(saoId, 0);
                if (sao != null)
                {
                    var content = SpecificationAttributeManager.GetSpecificationAttributeOptionLocalizedBySpecificationAttributeOptionIdAndLanguageId(saoId, languageId);
                    if (content != null)
                    {
                        txtLocalizedOptionName.Text = content.Name;
                    }
                }
            }
        }
        protected void gvProductSpecificationAttributes_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                ProductSpecificationAttribute productSpecificationAttribute = (ProductSpecificationAttribute)e.Row.DataItem;

                Button btnUpdate = e.Row.FindControl("btnUpdate") as Button;
                if (btnUpdate != null)
                {
                    btnUpdate.CommandArgument = e.Row.RowIndex.ToString();
                }

                SpecificationAttributeOption sao      = SpecificationAttributeManager.GetSpecificationAttributeOptionById(productSpecificationAttribute.SpecificationAttributeOptionId);
                SpecificationAttribute       sa       = SpecificationAttributeManager.GetSpecificationAttributeById(sao.SpecificationAttributeId);
                Literal lblSpecificationAttributeName = e.Row.FindControl("lblSpecificationAttributeName") as Literal;
                lblSpecificationAttributeName.Text = sa.Name;

                DropDownList ddlSpecificationAttributeOption = e.Row.FindControl("ddlSpecificationAttributeOption") as DropDownList;
                ddlSpecificationAttributeOption.Items.Clear();
                SpecificationAttributeOptionCollection saoCol = SpecificationAttributeManager.GetSpecificationAttributeOptionsBySpecificationAttribute(sao.SpecificationAttributeId);
                foreach (SpecificationAttributeOption sao1 in saoCol)
                {
                    ListItem item = new ListItem(sao1.Name, sao1.SpecificationAttributeOptionId.ToString());
                    ddlSpecificationAttributeOption.Items.Add(item);
                    if (productSpecificationAttribute.SpecificationAttributeOptionId == sao1.SpecificationAttributeOptionId)
                    {
                        item.Selected = true;
                    }
                }

                CheckBox chkAllowFiltering = e.Row.FindControl("chkAllowFiltering") as CheckBox;
                chkAllowFiltering.Checked = productSpecificationAttribute.AllowFiltering;

                CheckBox chkShowOnProductPage = e.Row.FindControl("chkShowOnProductPage") as CheckBox;
                chkShowOnProductPage.Checked = productSpecificationAttribute.ShowOnProductPage;
            }
        }
Example #5
0
        protected void OnSpecificationAttributeOptionsCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "UpdateOption")
            {
                int            index           = Convert.ToInt32(e.CommandArgument);
                GridViewRow    row             = grdSpecificationAttributeOptions.Rows[index];
                SimpleTextBox  txtName         = row.FindControl("txtOptionName") as SimpleTextBox;
                NumericTextBox txtDisplayOrder = row.FindControl("txtOptionDisplayOrder") as NumericTextBox;
                HiddenField    hfSpecificationAttributeOptionId = row.FindControl("hfSpecificationAttributeOptionId") as HiddenField;

                string name         = txtName.Text;
                int    displayOrder = txtDisplayOrder.Value;
                int    saoId        = int.Parse(hfSpecificationAttributeOptionId.Value);

                SpecificationAttributeOption sao = SpecificationAttributeManager.GetSpecificationAttributeOptionById(saoId, 0);
                if (sao != null)
                {
                    sao = SpecificationAttributeManager.UpdateSpecificationAttributeOptions(saoId, SpecificationAttributeId, name, displayOrder);
                    SaveLocalizableContent(sao);
                }

                BindData();
            }
        }