Esempio n. 1
0
        protected void btnFilter_Click(object sender, EventArgs e)
        {
            //-----Selection filter
            if (String.CompareOrdinal(ddSelect.SelectedIndex.ToString(CultureInfo.InvariantCulture), "0") != 0)
            {
                if (String.CompareOrdinal(ddSelect.SelectedIndex.ToString(CultureInfo.InvariantCulture), "2") == 0)
                {
                    if (_selectionFilter != null)
                    {
                        _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues;
                    }
                    else
                    {
                        _selectionFilter = null;

                    }
                }
                _paging.Fields["ID"].Filter = _selectionFilter;
            }
            else
            {
                _paging.Fields["ID"].Filter = null;
            }

            //----Name filter
            _paging.Fields["PageName"].Filter = !string.IsNullOrEmpty(txtPageName.Text) ? new CompareFieldFilter { Expression = txtPageName.Text, ParamName = "@PageName" } : null;
            _paging.Fields["SortOrder"].Filter = !string.IsNullOrEmpty(txtSortOrder.Text) ? new CompareFieldFilter { Expression = txtSortOrder.Text, ParamName = "@SortOrder" } : null;
            _paging.Fields["Enabled"].Filter = (ddlEnabled.SelectedValue != "any")
                                                   ? new EqualFieldFilter { ParamName = "@Enabled", Value = ddlEnabled.SelectedValue } : null;

            pageNumberer.CurrentPageIndex = 1;
        }
        protected void btnFilter_Click(object sender, EventArgs e)
        {
            //-----Selection filter
            if (ddSelect.SelectedIndex != 0)
            {
                if (ddSelect.SelectedIndex == 2)
                {
                    if (_selectionFilter != null)
                    {
                        _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues;
                    }
                    else
                    {
                        _selectionFilter = null;
                        //New InSetFieldFilter()
                        //_SelectionFilter.IncludeValues = True
                    }
                }
                _paging.Fields["ID"].Filter = _selectionFilter;
            }
            else
            {
                _paging.Fields["ID"].Filter = null;
            }

            //----UserName filter

            if (!string.IsNullOrEmpty(txtUserName.Text))
            {
                var userfilter = new CompareFieldFilter
                    {
                        ParamName = "@PriceRange",
                        Expression = txtUserName.Text
                    };
                _paging.Fields["PriceRange"].Filter = userfilter;
            }
            else
            {
                _paging.Fields["PriceRange"].Filter = null;
            }

            //----Text filter

            if (!string.IsNullOrEmpty(txtText.Text))
            {
                var textFilter = new CompareFieldFilter
                    {
                        ParamName = "@PercentDiscount",
                        Expression = txtText.Text
                    };
                _paging.Fields["PercentDiscount"].Filter = textFilter;
            }
            else
            {
                _paging.Fields["PercentDiscount"].Filter = null;
            }

            pageNumberer.CurrentPageIndex = 1;
            _paging.CurrentPageIndex = 1;
        }
Esempio n. 3
0
        protected void btnFilter_Click(object sender, EventArgs e)
        {
            //-----Selection filter
            if (String.CompareOrdinal(ddSelect.SelectedIndex.ToString(CultureInfo.InvariantCulture), "0") != 0)
            {
                if (String.CompareOrdinal(ddSelect.SelectedIndex.ToString(CultureInfo.InvariantCulture), "2") == 0)
                {
                    if (_selectionFilter != null)
                    {
                        _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues;
                    }
                    else
                    {
                        _selectionFilter = null; //New InSetFieldFilter()
                        //_SelectionFilter.IncludeValues = True
                    }
                }
                _paging.Fields["ID"].Filter = _selectionFilter;
            }
            else
            {
                _paging.Fields["ID"].Filter = null;
            }

            //----Name filter
            _paging.Fields["FormatName"].Filter = !string.IsNullOrEmpty(txtName.Text) ? new CompareFieldFilter { Expression = txtName.Text, ParamName = "@Name" } : null;

            //----Enabled filter
            if (ddluseInFilter.SelectedIndex != 0)
            {
                var efilter = new EqualFieldFilter { ParamName = "@Enable" };
                if (ddluseInFilter.SelectedIndex == 1)
                {
                    efilter.Value = "1";
                }
                if (ddluseInFilter.SelectedIndex == 2)
                {
                    efilter.Value = "0";
                }
                _paging.Fields["Enable"].Filter = efilter;
            }
            else
            {
                _paging.Fields["Enable"].Filter = null;
            }

            //----sort filter
            _paging.Fields["SortOrder"].Filter = !string.IsNullOrEmpty(txtSortOrder.Text) ? new CompareFieldFilter { Expression = txtSortOrder.Text, ParamName = "@sort" } : null;
            _paging.Fields["FormatType"].Filter = ddlFormatType.SelectedValue != "0"
                                                      ? new EqualFieldFilter
                                                          {
                                                              ParamName = "@FormatType",
                                                              Value = ddlFormatType.SelectedValue
                                                          }
                                                      : null;
            pageNumberer.CurrentPageIndex = 1;
            _paging.CurrentPageIndex = 1;
        }
Esempio n. 4
0
        protected void btnFilter_Click(object sender, EventArgs e)
        {
            //-----Selection filter
            if (ddSelect.SelectedIndex != 0)
            {
                if (ddSelect.SelectedIndex == 2)
                {
                    if (_selectionFilter != null)
                    {
                        _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues;
                    }
                    else
                    {
                        _selectionFilter = null;
                    }
                }
                _paging.Fields["ID"].Filter = _selectionFilter;
            }
            else
            {
                _paging.Fields["ID"].Filter = null;
            }

            //----UserName filter

            _paging.Fields["StatusName"].Filter = !string.IsNullOrEmpty(txtStatusName.Text)
                                                      ? new CompareFieldFilter { ParamName = "@StatusName", Expression = txtStatusName.Text }
                                                      : null;

            //----CommandID filter

            _paging.Fields["CommandID"].Filter = ddlCommandIDFilter.SelectedValue != "any"
                                                     ? new EqualFieldFilter
                                                         {
                                                             ParamName = "@CommandID",
                                                             Value = ddlCommandIDFilter.SelectedValue
                                                         }
                                                     : null;
            _paging.Fields["IsDefault"].Filter = ddlIsDefaultFilter.SelectedValue != "any"
                                                     ? new EqualFieldFilter
                                                         {
                                                             ParamName = "@IsDefault",
                                                             Value = ddlIsDefaultFilter.SelectedValue
                                                         }
                                                     : null;
            _paging.Fields["IsCanceled"].Filter = ddlCanceledFilter.SelectedValue != "any"
                                                      ? new EqualFieldFilter
                                                          {
                                                              ParamName = "@IsDefault",
                                                              Value = ddlCanceledFilter.SelectedValue
                                                          }
                                                      : null;
            pageNumberer.CurrentPageIndex = 1;
            _paging.CurrentPageIndex = 1;
        }
Esempio n. 5
0
        protected void btnFilter_Click(object sender, EventArgs e)
        {
            //-----Selection filter
            if (string.Compare(ddSelect.SelectedIndex.ToString(), "0") != 0)
            {

                if (string.Compare(ddSelect.SelectedIndex.ToString(), "2") == 0)
                {
                    if (_selectionFilter != null)
                    {
                        _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues;
                    }
                    else
                    {
                        _selectionFilter = null; //New InSetFieldFilter()
                        //_SelectionFilter.IncludeValues = True
                    }
                }
                _paging.Fields["ID"].Filter = _selectionFilter;
            }
            else
            {
                _paging.Fields["ID"].Filter = null;
            }

            //----Name filter
            if (!string.IsNullOrEmpty(txtName.Text))
            {
                var nfilter = new CompareFieldFilter { Expression = txtName.Text, ParamName = "@Name" };
                _paging.Fields["CityName"].Filter = nfilter;
            }
            else
            {
                _paging.Fields["CityName"].Filter = null;
            }

            //---RegionSort filter
            if (!string.IsNullOrEmpty(txtRegSort.Text))
            {
                var nfilter = new CompareFieldFilter
                    {
                        Expression = txtRegSort.Text,
                        ParamName = "@CitySort"
                    };
                _paging.Fields["CitySort"].Filter = nfilter;
            }
            else
            {
                _paging.Fields["CitySort"].Filter = null;
            }

            pageNumberer.CurrentPageIndex = 1;
            _paging.CurrentPageIndex = 1;
        }
Esempio n. 6
0
        protected void btnFilter_Click(object sender, EventArgs e)
        {
            //-----Selection filter
            if (String.CompareOrdinal(ddSelect.SelectedIndex.ToString(CultureInfo.InvariantCulture), "0") != 0)
            {

                if (String.CompareOrdinal(ddSelect.SelectedIndex.ToString(CultureInfo.InvariantCulture), "2") == 0)
                {
                    if (_selectionFilter != null)
                    {
                        _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues;
                    }
                    else
                    {
                        _selectionFilter = null;
                    }
                }
                _paging.Fields["ID"].Filter = _selectionFilter;
            }
            else
            {
                _paging.Fields["ID"].Filter = null;
            }

            //----Name filter
            if (!string.IsNullOrEmpty(txtName.Text))
            {
                var nfilter = new CompareFieldFilter { Expression = txtName.Text, ParamName = "@Name" };
                _paging.Fields["Name"].Filter = nfilter;
            }
            else
            {
                _paging.Fields["Name"].Filter = null;
            }

            if (!string.IsNullOrEmpty(txtSortOrder.Text))
            {
                var nfilter = new CompareFieldFilter { Expression = txtSortOrder.Text.TryParseInt().ToString(), ParamName = "@Sort" };
                _paging.Fields["Sort"].Filter = nfilter;
            }
            else
            {
                _paging.Fields["Sort"].Filter = null;
            }

            pageNumberer.CurrentPageIndex = 1;
        }
Esempio n. 7
0
        protected void btnFilter_Click(object sender, EventArgs e)
        {
            //-----Selection filter
            if (String.CompareOrdinal(ddSelect.SelectedIndex.ToString(CultureInfo.InvariantCulture), "0") != 0)
            {
                if (String.CompareOrdinal(ddSelect.SelectedIndex.ToString(CultureInfo.InvariantCulture), "2") == 0)
                {
                    if (_selectionFilter != null)
                    {
                        _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues;
                    }
                    else
                    {
                        _selectionFilter = null; //New InSetFieldFilter()
                        //_SelectionFilter.IncludeValues = True
                    }
                }
                _paging.Fields["ID"].Filter = _selectionFilter;
            }
            else
            {
                _paging.Fields["ID"].Filter = null;
            }

            //----Name filter
            _paging.Fields["Name"].Filter = !string.IsNullOrEmpty(txtName.Text)
                                                ? new CompareFieldFilter { Expression = txtName.Text, ParamName = "@Name" }
                                                : null;

            _paging.Fields["UrlPath"].Filter = !string.IsNullOrEmpty(txtUrlPath.Text)
                                                   ? new CompareFieldFilter { Expression = txtName.Text, ParamName = "@UrlPath" }
                                                   : null;

            _paging.Fields["SortOrder"].Filter = !string.IsNullOrEmpty(txtSort.Text)
                                                     ? new EqualFieldFilter { Value = txtSort.Text, ParamName = "@Sort" }
                                                     : null;

            pageNumberer.CurrentPageIndex = 1;
            _paging.CurrentPageIndex = 1;
        }
Esempio n. 8
0
        protected void btnFilter_Click(object sender, EventArgs e)
        {
            //-----Selection filter
            if (ddSelect.SelectedIndex != 0)
            {
                if (ddSelect.SelectedIndex == 2)
                {
                    if (_selectionFilter != null)
                    {
                        _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues;
                    }
                    else
                    {
                        _selectionFilter = null;
                    }
                }
                _paging.Fields["ID"].Filter = _selectionFilter;
            }
            else
            {
                _paging.Fields["ID"].Filter = _selectionFilter;
            }

            //----Name filter
            if (!string.IsNullOrEmpty(txtGroupName.Text))
            {
                var nfilter = new CompareFieldFilter { Expression = txtGroupName.Text, ParamName = "@GroupName" };
                _paging.Fields["GroupName"].Filter = nfilter;
            }
            else
            {
                _paging.Fields["GroupName"].Filter = null;
            }

            pageNumberer.CurrentPageIndex = 1;
            pageNumberer.CurrentPageIndex = 1;
        }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_CustomerGroup_Header));

            if (!IsPostBack)
            {
                _paging = new SqlPaging { TableName = "[Customers].[CustomerGroup]", ItemsPerPage = 10 };

                var f = new Field { Name = "CustomerGroupId as ID", IsDistinct = true, Filter = _selectionFilter };
                _paging.AddField(f);

                f = new Field { Name = "GroupName", Sorting = SortDirection.Ascending };
                _paging.AddField(f);

                f = new Field { Name = "GroupDiscount" };
                _paging.AddField(f);

                grid.ChangeHeaderImageUrl("arrowGroupName", "images/arrowup.gif");

                _paging.ItemsPerPage = 10;

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;
            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                string strIds = Request.Form["SelectedIds"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    string[] arrids = strIds.Split(' ');

                    var ids = new string[arrids.Length ];
                    _selectionFilter = new InSetFieldFilter { IncludeValues = true };
                    for (int idx = 0; idx <= ids.Length - 1; idx++)
                    {
                        int t = int.Parse(arrids[idx]);
                        if (t != -1)
                        {
                            ids[idx] = t.ToString();
                        }
                        else
                        {
                            _selectionFilter.IncludeValues = false;
                            _inverseSelection = true;
                        }
                    }

                    _selectionFilter.Values = ids;
                    //_InverseSelection = If(ids(0) = -1, True, False)
                }
            }
        }
Esempio n. 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["theme"] == null)
            {
                Response.Redirect("Voting.aspx");
            }
            lblHead.Text = VoiceService.GetVotingName(ThemeId);
            SetMeta(string.Format("{0} - {1} - {2}", SettingsMain.ShopName, lblHead.Text, lblSubHead.Text));

            if (!IsPostBack)
            {
                _paging = new SqlPaging
                    {
                        TableName = "[Voice].[Answer]",
                        ItemsPerPage = 10
                    };

                _paging.AddFieldsRange(new List<Field>
                    {
                        new Field {Name = "AnswerID as ID", IsDistinct = true},
                        new Field {Name = "Name"},
                        new Field {Name = "CountVoice"},
                        new Field {Name = "Sort", Sorting = SortDirection.Ascending},
                        new Field {Name = "IsVisible"},
                        new Field {Name = "DateAdded"},
                        new Field {Name = "DateModify"},
                        new Field
                            {
                                Name = "FKIDTheme",
                                Filter = new EqualFieldFilter {ParamName = "@Theme", Value = ThemeId.ToString()}
                            }
                    });

                grid.ChangeHeaderImageUrl("arrowSort", "images/arrowup.gif");

                _paging.ItemsPerPage = 10;

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;
            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                string strIds = Request.Form["SelectedIds"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    string[] arrids = strIds.Split(' ');

                    _selectionFilter = new InSetFieldFilter();
                    if (arrids.Contains("-1"))
                    {
                        _selectionFilter.IncludeValues = false;
                        _inverseSelection = true;
                    }
                    else
                    {
                        _selectionFilter.IncludeValues = true;
                    }
                    _selectionFilter.Values = arrids.Where(id => id != "-1").ToArray();
                }
            }
        }
Esempio n. 11
0
        private void BuildFilter()
        {
            if (!string.IsNullOrEmpty(Request["pricefrom"]) || !string.IsNullOrEmpty(Request["priceto"]))
            {
                int pricefrom = Request["pricefrom"].TryParseInt(0);
                int priceto = Request["priceto"].TryParseInt(int.MaxValue);

                filterPrice.CurValMin = pricefrom;
                filterPrice.CurValMax = priceto;

                _paging.Fields["discountPrice"].Filter = new RangeFieldFilter
                    {
                        ParamName = "@priceRange",
                        From = pricefrom*CurrencyService.CurrentCurrency.Value,
                        To = priceto*CurrencyService.CurrentCurrency.Value
                    };

                _paging.Fields["Price"].Filter = new NotEqualFieldFilter {ParamName = "@price", Value = "0"};
            }
            else
            {
                filterPrice.CurValMin = 0;
                filterPrice.CurValMax = int.MaxValue;
            }

            if (!string.IsNullOrEmpty(Request["brand"]))
            {
                int id = 0;
                var brandIds = (from b in Request["brand"].Split(',') where int.TryParse(b, out id) select id).ToList();
                filterBrand.SelectedBrandIDs = brandIds;
                var isf = new InSetFieldFilter
                    {
                        IncludeValues = true,
                        ParamName = "@brands",
                        Values = brandIds.Select(brandid => brandid.ToString()).ToArray()
                    };
                _paging.Fields["BrandID"].Filter = isf;
                filterBrand.SelectedBrandIDs = brandIds;
            }
            else
            {
                filterBrand.SelectedBrandIDs = new List<int>();
            }
        }
Esempio n. 12
0
        protected void btnFilter_Click(object sender, EventArgs e)
        {
            //-----Selection filter
            if (String.CompareOrdinal(ddSelect.SelectedIndex.ToString(CultureInfo.InvariantCulture), "0") != 0)
            {

                if (String.CompareOrdinal(ddSelect.SelectedIndex.ToString(CultureInfo.InvariantCulture), "2") == 0)
                {
                    if (_selectionFilter != null)
                    {
                        _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues;
                    }
                    else
                    {
                        _selectionFilter = null;
                    }
                }
                _paging.Fields["ID"].Filter = _selectionFilter;
            }
            else
            {
                _paging.Fields["ID"].Filter = null;
            }

            //----Name filter
            if (!string.IsNullOrEmpty(txtName.Text))
            {
                var nfilter = new CompareFieldFilter { Expression = txtName.Text, ParamName = "@Name" };
                _paging.Fields["Name"].Filter = nfilter;
            }
            else
            {
                _paging.Fields["Name"].Filter = null;
            }
            //----RegNumber filter
            if (!string.IsNullOrEmpty(txtRegNumber.Text))
            {
                var nfilter = new CompareFieldFilter
                    {
                        Expression = txtRegNumber.Text,
                        ParamName = "@RegNumber"
                    };
                _paging.Fields["RegNumber"].Filter = nfilter;
            }
            else
            {
                _paging.Fields["RegNumber"].Filter = null;
            }

            //----Country filter
            if (ddlCountryFilter.SelectedIndex != 0)
            {
                var nfilter = new CompareFieldFilter
                    {
                        Expression = ddlCountryFilter.SelectedItem.Text,
                        ParamName = "@Country"
                    };
                _paging.Fields["CountryName"].Filter = nfilter;
            }
            else
            {
                _paging.Fields["CountryName"].Filter = null;
            }

            //----Enabled filter
            if (ddlEnabled.SelectedIndex != 0)
            {

                var efilter = new EqualFieldFilter { ParamName = "@Enabled" };
                if (ddlEnabled.SelectedIndex == 1)
                {
                    efilter.Value = "1";
                }
                if (ddlEnabled.SelectedIndex == 2)
                {
                    efilter.Value = "0";
                }
                _paging.Fields["Enabled"].Filter = efilter;
            }
            else
            {
                _paging.Fields["Enabled"].Filter = null;
            }

            pageNumberer.CurrentPageIndex = 1;
        }
Esempio n. 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_Coupons_Header));

            if (!IsPostBack)
            {
                _paging = new SqlPaging
                    {
                        TableName = "[Catalog].[Coupon]",
                        ItemsPerPage = 10
                    };

                _paging.AddFieldsRange(new List<Field>
                    {
                        new Field
                            {
                                Name = "CouponID as ID",
                                IsDistinct = true
                            },
                        new Field {Name = "Code"},
                        new Field {Name = "Type"},
                        new Field {Name = "Value"},
                        new Field {Name = "AddingDate", Sorting = SortDirection.Descending},
                        new Field {Name = "ExpirationDate"},
                        new Field {Name = "PossibleUses"},
                        new Field {Name = "ActualUses"},
                        new Field {Name = "Enabled"},
                        new Field {Name = "MinimalOrderPrice"},
                    });

                grid.ChangeHeaderImageUrl("arrowAddingDate", "images/arrowdown.gif");

                _paging.ItemsPerPage = 10;

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;
            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                string strIds = Request.Form["SelectedIds"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    string[] arrids = strIds.Split(' ');

                    _selectionFilter = new InSetFieldFilter();
                    if (arrids.Contains("-1"))
                    {
                        _selectionFilter.IncludeValues = false;
                        _inverseSelection = true;
                    }
                    else
                    {
                        _selectionFilter.IncludeValues = true;
                    }
                    _selectionFilter.Values = arrids.Where(id => id != "-1").ToArray();
                }
            }
        }
Esempio n. 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", AdvantShop.Configuration.SettingsMain.ShopName, Resource.Admin_MasterPageAdminCatalog_Catalog));
            if (string.IsNullOrEmpty(ModuleName))
            {
                Response.Redirect("ExportFeed.aspx?ModuleId=YandexMarket");
                return;
            }
            if (!string.IsNullOrEmpty(Request["CatId"]))
            {
                Int32.TryParse(Request["CatId"], out _catId);
            }
            Category cat = CategoryService.GetCategory(_catId);
            if (cat != null)
            {
                lblCategoryName.Text = cat.Name;
                sn.BuildNavigationAdmin(_catId);
            }
            if (!Page.IsPostBack)
            {
                var flag = ExportFeedService.CheakCategoryHierical(ModuleName, _catId);
                pnlCategorySet.Enabled = !flag;
                chbFull.Checked = ExportFeedService.CheakCategory(ModuleName, _catId);
                pnlData.Enabled = !chbFull.Checked && !flag;
            }
            PageSubheader.Visible = true;
            ModuleNameLiteral.Text = ModuleName;
            if (!IsPostBack)
            {
                var node2 = new TreeNode { Text = SelectCategory(0, ModuleName, Resource.Admin_m_Category_Root), Value = "0", Selected = true, NavigateUrl = ExportFeedNew + "?moduleid=" + ModuleName };

                tree2.Nodes.Add(node2);
                LoadChildCategories2(tree2.Nodes[0]);

                _paging = new SqlPaging
                    {
                        TableName = "[Catalog].[Product] left JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID]  AND [Offer].Main=1 INNER JOIN Catalog.ProductCategories on ProductCategories.ProductId = [Product].[ProductID] and ProductCategories.Main=1",
                        ItemsPerPage = 100
                    };

                var f = new Field { Name = "Product.ProductId as ID", IsDistinct = true };
                _paging.AddField(f);

                f = new Field { Name = "Product.ArtNo" };
                _paging.AddField(f);

                f = new Field { Name = "Name" };
                _paging.AddField(f);

                f = new Field { Name = "(Select count(*) from Settings.ExportFeedSelectedProducts where ModuleName=@ModuleName and ExportFeedSelectedProducts.ProductID=Product.ProductId) as Cheaked" };
                _paging.AddField(f);

                var pf = new EqualFieldFilter { Value = _catId.ToString(), ParamName = "@Parent" };
                f = new Field { Name = "CategoryId", Filter = pf };
                _paging.AddField(f);

                f = new Field { Name = "SortOrder", Sorting = SortDirection.Ascending };
                _paging.AddField(f);

                _paging.AddParam(new SqlParam { ParameterName = "@ModuleName", Value = ModuleName });

                _paging.ExtensionWhere = "and Offer.Price > 0 and (Offer.Amount > 0 or Product.AllowPreorder=1) and CategoryEnabled=1 and Enabled=1";
                grid.ChangeHeaderImageUrl("arrowName", "images/arrowup.gif");

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;

            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                string strIds = Request.Form["SelectedIds"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    string[] arrids = strIds.Split(' ');

                    var ids = new string[arrids.Length];
                    _selectionFilter = new InSetFieldFilter { IncludeValues = true };
                    for (int idx = 0; idx <= ids.Length - 1; idx++)
                    {
                        int t = int.Parse(arrids[idx]);
                        if (t != -1)
                        {
                            ids[idx] = t.ToString();
                        }
                        else
                        {
                            _selectionFilter.IncludeValues = false;
                            _inverseSelection = true;
                        }
                    }
                    _selectionFilter.Values = ids;
                }
            }
        }
Esempio n. 15
0
        protected void btnFilter_Click(object sender, EventArgs e)
        {
            if (ddSelect.SelectedIndex != 0)
            {
                if (ddSelect.SelectedIndex == 2)
                {
                    if (_selectionFilter != null)
                    {
                        _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues;
                    }
                    else
                    {
                        _selectionFilter = null;
                    }
                }
                _paging.Fields["ID"].Filter = _selectionFilter;
            }
            else
            {
                _paging.Fields["ID"].Filter = null;
            }

            //----Firstname filter
            if (!string.IsNullOrEmpty(txtSearchFirstName.Text))
            {
                var nfilter = new CompareFieldFilter { Expression = txtSearchFirstName.Text, ParamName = "@firstname" };
                _paging.Fields["Firstname"].Filter = nfilter;
            }
            else
            {
                _paging.Fields["Firstname"].Filter = null;
            }

            //----lastname filter
            if (!string.IsNullOrEmpty(txtSearchLastname.Text))
            {
                var nfilter = new CompareFieldFilter { Expression = txtSearchLastname.Text, ParamName = "@lastname" };
                _paging.Fields["Lastname"].Filter = nfilter;
            }
            else
            {
                _paging.Fields["Lastname"].Filter = null;
            }

            //----email filter
            if (!string.IsNullOrEmpty(txtSearchEmail.Text))
            {
                var nfilter = new CompareFieldFilter { Expression = txtSearchEmail.Text, ParamName = "@email" };
                _paging.Fields["Email"].Filter = nfilter;
            }
            else
            {
                _paging.Fields["Email"].Filter = null;
            }

            //----RegDate filter
            if (!string.IsNullOrEmpty(txtDateFrom.Text) || !string.IsNullOrEmpty(txtDateTo.Text))
            {
                var nfilter = new DateTimeRangeFieldFilter();
                try
                {
                    nfilter.From = DateTime.Parse(txtDateFrom.Text);
                }
                catch (Exception)
                {
                    nfilter.From = DateTime.Parse("01.01.1900");
                }

                try
                {
                    nfilter.To = DateTime.Parse(txtDateTo.Text);
                }
                catch (Exception)
                {
                    nfilter.To = DateTime.MaxValue;
                }
                nfilter.ParamName = "@RegistrationDateTime";
                _paging.Fields["RegistrationDateTime"].Filter = nfilter;
            }
            else
            {
                _paging.Fields["RegistrationDateTime"].Filter = null;
            }

            _paging.Fields["CustomerGroupId"].Filter = ddlCustomerGroup.SelectedValue != "0"
                                                           ? new EqualFieldFilter
                                                               {
                                                                   ParamName = "@CustomerGroupId",
                                                                   Value = ddlCustomerGroup.SelectedValue
                                                               }
                                                           : null;

            _paging.Fields["PriceType"].Filter = ddlPriceTypes.SelectedValue != "0"
                                                           ? new EqualFieldFilter
                                                               {
                                                                   ParamName = "@PriceType",
                                                                   Value = ddlPriceTypes.SelectedValue
                                                               }
                                                           : null;

            pageNumberer.CurrentPageIndex = 1;
            _paging.CurrentPageIndex = 1;
        }
Esempio n. 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MsgErr(true);

            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_CustomerSearch_SubHeader));

            if (!IsPostBack)
            {
                _paging = new SqlPaging
                    {
                        TableName = "[Customers].[Customer]", ItemsPerPage = 10
                    };

                _paging.AddFieldsRange(new List<Field>
                    {
                        new Field { Name = "CustomerID as ID", IsDistinct = true },
                        new Field { Name = "Email" },
                        new Field { Name = "Firstname", Sorting = SortDirection.Ascending },
                        new Field { Name = "Lastname" },
                        new Field { Name = "CustomerGroupId" },
                        new Field { Name = "RegistrationDateTime" },
                        new Field { Name = "CustomerRole" },
                        new Field { Name = "PriceType" }
                    });

                if (CustomerSession.CurrentCustomer.CustomerRole == Role.Moderator)
                {
                    _paging.Fields["CustomerRole"].Filter = new EqualFieldFilter { ParamName = "@CustomerRole", Value = ((int)Role.User).ToString() };
                }

                advCustomers.ChangeHeaderImageUrl("arrowFirstname", "images/arrowup.gif");

                _paging.ItemsPerPage = 10;

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;

                if (Request["search"].IsNotEmpty())
                {
                    var customer = CustomerService.GetCustomerByEmail(Request["search"]);
                    if (customer != null)
                    {
                        Response.Redirect("ViewCustomer.aspx?customerID=" + customer.Id);
                        return;
                    }

                    if (Request["search"].Contains("@"))
                    {
                        txtSearchEmail.Text = Request["search"];
                    }
                    else
                    {
                        txtSearchLastname.Text = Request["search"];
                    }

                    btnFilter_Click(null, null);
                }

            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                var strIds = Request.Form["SelectedIds"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    var arrids = strIds.Split(' ');

                    var ids = new string[arrids.Length ];
                    _selectionFilter = new InSetFieldFilter { IncludeValues = true };
                    for (int idx = 0; idx <= ids.Length - 1; idx++)
                    {
                        var t = arrids[idx];
                        if (t != "-1")
                        {
                            ids[idx] = t;
                        }
                        else
                        {
                            _selectionFilter.IncludeValues = false;
                            _inverseSelection = true;
                        }
                    }

                    _selectionFilter.Values = ids;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Message.Visible = false;
            MsgErr(true);

            SetMeta(string.Format("{0} - {1}", AdvantShop.Configuration.SettingsMain.ShopName, Resource.Admin_Discount_PriceRange_SubHeader));

            if (!IsPostBack)
            {
                chkModuleEnabled.Checked = AdvantShop.Configuration.SettingsOrderConfirmation.EnableDiscountModule;
            }

            if (!IsPostBack)
            {
                _paging = new SqlPaging { TableName = "[Order].[OrderPriceDiscount]", ItemsPerPage = 10 };

                var f = new Field { Name = "OrderPriceDiscountID as ID" };

                //f.IsDistinct = True
                _paging.AddField(f);

                f = new Field { Name = "PriceRange", Sorting = SortDirection.Ascending };
                _paging.AddField(f);

                f = new Field { Name = "PercentDiscount" };
                _paging.AddField(f);

                grid.ChangeHeaderImageUrl("arrowPriceRange", "images/arrowup.gif");

                _paging.ItemsPerPage = 10;

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;
            }
            else
            {
                _paging = (SqlPaging)ViewState["Paging"];
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw new Exception("Paging lost");
                }

                string strIds = Request.Form["SelectedIds"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    string[] arrids = strIds.Split(' ');

                    var ids = new string[arrids.Length];
                    _selectionFilter = new InSetFieldFilter { IncludeValues = true };
                    for (int idx = 0; idx <= ids.Length - 1; idx++)
                    {
                        string t = arrids[idx];
                        if (t != "-1")
                        {
                            ids[idx] = t;
                        }
                        else
                        {
                            _selectionFilter.IncludeValues = false;
                            _inverseSelection = true;
                        }
                    }

                    _selectionFilter.Values = ids;
                }
            }
        }
Esempio n. 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lblError.Text = string.Empty;
            lblError.Visible = false;

            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_Properties_ListPropreties));

            if (!IsPostBack)
            {
                _paging = new SqlPaging { TableName = "[Settings].[NewsCategory]" };

                _paging.AddFieldsRange(new List<Field>
                    {
                        new Field {Name = "NewsCategoryID as ID", IsDistinct = true},
                        new Field {Name = "Name"},
                        new Field {Name = "SortOrder", Sorting = SortDirection.Ascending},
                        new Field {Name = "UrlPath"},
                    });
                grid.ChangeHeaderImageUrl("arrowSortOrder", "images/arrowup.gif");

                _paging.ItemsPerPage = 10;

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;
            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                string strIds = Request.Form["SelectedIds"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    string[] arrids = strIds.Split(' ');

                    var ids = new string[arrids.Length];
                    _selectionFilter = new InSetFieldFilter { IncludeValues = true };
                    for (int idx = 0; idx <= ids.Length - 1; idx++)
                    {
                        int t = int.Parse(arrids[idx]);
                        if (t != -1)
                        {
                            ids[idx] = t.ToString();
                        }
                        else
                        {
                            _selectionFilter.IncludeValues = false;
                            _inverseSelection = true;
                        }
                    }
                    _selectionFilter.Values = ids;
                    //_InverseSelection = If(ids(0) = -1, True, False)
                }
            }
        }
Esempio n. 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            btnAdd.OnClientClick = "javascript:open_window('m_ProductVideos.aspx?ProductID=" + ProductID + "',780,600);return false;";

            if (!IsPostBack)
            {
                _paging = new SqlPaging { TableName = "[Catalog].[ProductVideo]", ItemsPerPage = 10 };

                var f = new Field { Name = "ProductVideoID", IsDistinct = true, Filter = _selectionFilter };
                _paging.AddField(f);

                f = new Field
                    {
                        Name = "ProductID",
                        Filter = new EqualFieldFilter
                            {
                                ParamName = "@productID",
                                Value = ProductID.ToString()
                            }
                    };
                _paging.AddField(f);

                f = new Field { Name = "Name" };
                _paging.AddField(f);

                f = new Field { Name = "VideoSortOrder", Sorting = SortDirection.Ascending };
                _paging.AddField(f);

                grid_video.ChangeHeaderImageUrl("arrowVideoSortOrder", "~/admin/images/arrowup.gif");

                _paging.ItemsPerPage = 10;

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;
            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                string strIds = Request.Form["SelectedIdsVideo"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    string[] arrids = strIds.Split(' ');

                    var ids = new string[arrids.Length ];
                    _selectionFilter = new InSetFieldFilter { IncludeValues = true };
                    for (int idx = 0; idx <= ids.Length - 1; idx++)
                    {
                        int t = -1;
                        int.TryParse(arrids[idx], out t);
                        if (t != -1)
                        {
                            ids[idx] = t.ToString();
                        }
                        else
                        {
                            _selectionFilter.IncludeValues = false;
                            _inverseSelection = true;
                        }
                    }

                    _selectionFilter.Values = ids;
                    //_InverseSelection = If(ids(0) = -1, True, False)
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string strIds = String.Empty;
            if(!Page.IsPostBack)
            {
                if (SelectedProducts != null && SelectedProducts.Count != 0)
                {
                    prevSelected =
                        SelectedProducts.Select(s => s.ToString()).Aggregate(
                            (prev, next) => prev.ToString() + " " + next.ToString());
                    strIds = prevSelected;
                }
            }
            else
            {
                strIds = Request.Form["SelectedIds"];
            }

            string[] ids;

            if (!string.IsNullOrEmpty(strIds))
            {
                strIds = strIds.Trim();
                var arrids = strIds.Split(' ');

                ids = new string[arrids.Length ];
                _selectionFilter = new InSetFieldFilter { IncludeValues = true };
                for (int idx = 0; idx <= ids.Length - 1; idx++)
                {
                    var t = arrids[idx];
                    if (t != "-1")
                    {
                        ids[idx] = t;
                    }
                    else
                    {
                        _selectionFilter.IncludeValues = false;
                    }
                }

                _selectionFilter.Values = ids;
            }

            if (!IsPostBack)
            {
                // load modalpopup for contact
                _paging = new SqlPaging { TableName = "[Catalog].[Product]", ItemsPerPage = 10 };

                var f = new Field { Name = "ProductID", IsDistinct = true };

                _paging.AddField(f);

                f = new Field { Name = "ArtNo", Sorting = SortDirection.Ascending};

                _paging.AddField(f);

                f = new Field { Name = "Name" };
                _paging.AddField(f);

                agvProducts.ChangeHeaderImageUrl("arrowArtNo", "../images/arrowup.gif");

                _paging.ItemsPerPage = 10;

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;
            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }
            }
        }
Esempio n. 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_MasterPageAdminCatalog_Catalog));

            Category cat = null;

            if (!string.IsNullOrEmpty(Request["categoryid"]))
            {
                if (Request["categoryid"].ToLower().Equals("WithoutCategory".ToLower()))
                {
                    ShowMethod = EShowMethod.OnlyWithoutCategories;
                }
                else if (Request["categoryid"].ToLower().Equals("InCategories".ToLower()))
                {
                    ShowMethod = EShowMethod.OnlyInCategories;
                }
                else if (Request["categoryid"].ToLower().Equals("AllProducts".ToLower()))
                {
                    ShowMethod = EShowMethod.AllProducts;
                }
                else
                {
                    ShowMethod = EShowMethod.Normal;
                    int.TryParse(Request["categoryid"], out CategoryId);
                    cat = CategoryService.GetCategory(CategoryId);
                    adminCategoryView.CategoryID = CategoryId;
                }
            }
            else
            {
                CategoryId = 0;
                ShowMethod = EShowMethod.Normal;
            }

            if (cat == null)
            {
                CategoryId = 0;
                if (ShowMethod == EShowMethod.Normal)
                {
                    ShowMethod = EShowMethod.AllProducts;
                    ShowMethod = EShowMethod.Normal;
                }
            }
            else
            {
                CategoryId = cat.CategoryId;
                lblCategoryName.Text = cat.Name;
                ConfirmButtonExtenderCategory.ConfirmText =
                    string.Format(Resource.Admin_MasterPageAdminCatalog_Confirmation, cat.Name);
            }

            hlEditCategory.NavigateUrl = "javascript:open_window(\'m_Category.aspx?CategoryID=" + CategoryId + "&mode=edit\', 750, 640)";

            if (!IsPostBack)
            {
                var node2 = new TreeNode { Text = Resource.Admin_m_Category_Root, Value = "0", Selected = true };
                tree2.Nodes.Add(node2);

                LoadChildCategories2(tree2.Nodes[0]);

                _paging = new SqlPaging()
                    {
                        ItemsPerPage = 10,
                    };

                switch (ShowMethod)
                {
                    case EShowMethod.AllProducts:
                        lblCategoryName.Text = Resource.Admin_Catalog_AllProducts;
                        _paging.TableName =
                            "[Catalog].[Product] left JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] and [Offer].[Main] = 1 LEFT JOIN [Catalog].[Photo] ON [Product].[ProductID] = [Photo].[ObjId]  and Type='Product' AND [Photo].[Main] = 1 LEFT JOIN [Catalog].[ProductCategories] ON [Catalog].[ProductCategories].[ProductID] = [Product].[ProductID]";
                        break;

                    case EShowMethod.OnlyInCategories:
                        lblCategoryName.Text = Resource.Admin_Catalog_AllProductsInCategories;
                        _paging.TableName =
                            "[Catalog].[Product] left JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] and [Offer].[Main] = 1 LEFT JOIN [Catalog].[Photo] ON [Product].[ProductID] = [Photo].[ObjId] and Type='Product' AND [Photo].[Main] = 1 inner JOIN [Catalog].[ProductCategories] ON [Catalog].[ProductCategories].[ProductID] = [Product].[ProductID]";
                        break;

                    case EShowMethod.OnlyWithoutCategories:
                        lblCategoryName.Text = Resource.Admin_Catalog_AllProductsWithoutCategories;
                        _paging.TableName =
                            "[Catalog].[Product] inner join (select ProductId from Catalog.Product where ProductId not in(Select ProductId from Catalog.ProductCategories)) as tmp on tmp.ProductId=[Product].[ProductID] Left JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] LEFT JOIN [Catalog].[Photo] ON [Product].[ProductID] = [Photo].[ObjId]  and Type='Product' AND [Photo].[Main] = 1";
                        break;

                    case EShowMethod.Normal:
                        _paging.TableName =
                            "[Catalog].[Product] left JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] and [Offer].[Main] = 1 LEFT JOIN [Catalog].[Photo] ON [Product].[ProductID] = [Photo].[ObjId] and Type='Product' AND [Photo].[Main] = 1 INNER JOIN Catalog.ProductCategories on ProductCategories.ProductId = [Product].[ProductID]";
                        break;
                }

                _paging.AddFieldsRange(new List<Field>()
                    {
                        new Field {Name = "Product.ProductID as ID", IsDistinct = true},

                        new Field {Name = "Product.ArtNo", Sorting = ShowMethod!= EShowMethod.Normal ? SortDirection.Ascending : (SortDirection?)null},
                        new Field {Name = "PhotoName"},
                        new Field {Name = "(Select Count(ProductID) From Catalog.ProductCategories Where ProductID=Product.ProductID) as ProductCategoriesCount"},
                        new Field {Name = "BriefDescription"},
                        new Field {Name = "Name"},
                        new Field {Name = "Price"},
                        new Field {Name = "(Select sum (Amount) from catalog.Offer where Offer.ProductID=Product.productID) as Amount"},
                        new Field {Name = "Enabled"},
                        new Field
                            {
                                Name = ShowMethod == EShowMethod.Normal ? "ProductCategories.SortOrder" : "-1 as SortOrder",
                                Sorting = SortDirection.Ascending
                            },
                        new Field {Name = "Offer.ColorID", NotInQuery = true},
                        new Field {Name = "Offer.SizeID", NotInQuery = true}
                    });

                if (ShowMethod == EShowMethod.Normal)
                {
                    _paging.AddField(new Field
                        {
                            Name = "ProductCategories.CategoryID",
                            NotInQuery = true,
                            Filter = new EqualFieldFilter
                                {
                                    Value = CategoryId.ToString(),
                                    ParamName = "@CategoryID"
                                }
                        });

                    grid.ChangeHeaderImageUrl("arrowSortOrder", "images/arrowup.gif");
                }
                else
                {
                    grid.ChangeHeaderImageUrl("arrowArtNo", "images/arrowup.gif");
                }

                pageNumberer.CurrentPageIndex = 1;
                pnlProducts.Visible = CategoryId != 0 || ShowMethod != EShowMethod.Normal;
                productsHeader.Visible = ShowMethod == EShowMethod.Normal;
                adminCategoryView.Visible = ShowMethod == EShowMethod.Normal;
                grid.Columns[9].Visible = ShowMethod == EShowMethod.Normal;

                _paging.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;

                if (Request["search"].IsNotEmpty())
                {
                    var product = ProductService.GetProduct(Request["search"]);
                    if (product != null)
                    {
                        Response.Redirect("Product.aspx?productID=" + product.ID);
                        return;
                    }

                    if (
                        ProductService.GetProductsCount("where name like '%' + @search + '%'",
                                                        new SqlParameter("@search", Request["search"])) >
                        ProductService.GetProductsCount("where artno like '%' + @search + '%'",
                                                        new SqlParameter("@search", Request["search"])))
                    {
                        txtName.Text = Request["search"];
                    }
                    else
                    {
                        txtArtNo.Text = Request["search"];
                    }
                    btnFilter_Click(null, null);
                }

                if (Request["colorId"].IsNotEmpty())
                {
                    var color = ColorService.GetColor(Request["colorId"].TryParseInt());
                    if (color != null)
                    {
                        lblCategoryName.Text += string.Format(" {0}: {1}", Resource.Admin_Catalog_Color, color.ColorName);
                        _paging.Fields["Offer.ColorID"].Filter = new EqualFieldFilter { ParamName = "@colorId", Value = Request["colorId"] };
                    }
                }

                if (Request["sizeid"].IsNotEmpty())
                {
                    var size = SizeService.GetSize(Request["sizeid"].TryParseInt());
                    if (size != null)
                    {
                        lblCategoryName.Text += string.Format(" {0}: {1}", Resource.Admin_Catalog_Size, size.SizeName);
                        _paging.Fields["Offer.SizeID"].Filter = new EqualFieldFilter { ParamName = "@sizeId", Value = Request["sizeId"] };
                    }
                }
            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                string strIds = Request.Form["SelectedIds"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    var arrids = strIds.Split(' ');

                    var ids = new string[arrids.Length];
                    _selectionFilter = new InSetFieldFilter { IncludeValues = true };
                    _selectionFilterCategories = new InSetFieldFilter { IncludeValues = true };

                    for (int idx = 0; idx <= ids.Length - 1; idx++)
                    {
                        string t = arrids[idx];
                        var idParts = t.Split('_');
                        switch (idParts[0])
                        {
                            case "Product":
                                if (idParts[1] != "-1")
                                {
                                    ids[idx] = idParts[1];
                                }
                                else
                                {
                                    _selectionFilter.IncludeValues = false;
                                    _inverseSelection = true;
                                }
                                break;
                            case "Category":
                                if (idParts[1] != "-1")
                                {
                                    _selectedCategories.Add(idParts[1]);
                                }
                                else
                                {
                                    _selectionFilterCategories.IncludeValues = false;
                                    _inverseSelection = true;
                                }
                                break;
                            default:
                                _inverseSelection = true;
                                break;
                        }
                    }
                    _selectionFilter.Values = ids.Distinct().Where(item => item != null).ToArray();
                    _selectionFilterCategories.Values = _selectedCategories.ToArray();
                }
            }
        }
Esempio n. 22
0
        protected void btnFilter_Click(object sender, EventArgs e)
        {
            //-----Selection filter
            if (ddSelect.SelectedIndex != 0)
            {
                if (ddSelect.SelectedIndex == 2)
                {
                    if (_selectionFilter != null)
                    {
                        _selectionFilter.IncludeValues = !_selectionFilter.IncludeValues;
                    }
                    else
                    {
                        _selectionFilter = null;
                    }
                }
                if (_selectionFilter != null)
                {
                    _paging.Fields["ID"].Filter = _selectionFilter;
                }
            }
            else
            {
                _paging.Fields["ID"].Filter = null;
            }

            //----Enabled filter
            if (ddlEnabled.SelectedIndex != 0)
            {
                var efilter = new EqualFieldFilter { ParamName = "@enabled" };
                if (ddlEnabled.SelectedIndex == 1)
                {
                    efilter.Value = "1";
                }
                if (ddlEnabled.SelectedIndex == 2)
                {
                    efilter.Value = "0";
                }
                _paging.Fields["Enabled"].Filter = efilter;
            }
            else
            {
                _paging.Fields["Enabled"].Filter = null;
            }

            //----Price filter

            var priceFilter = new RangeFieldFilter { ParamName = "@price" };

            int priceFrom;
            priceFilter.From = int.TryParse(txtPriceFrom.Text, out priceFrom) ? priceFrom : 0;

            int priceTo;
            priceFilter.To = int.TryParse(txtPriceTo.Text, out priceTo) ? priceTo : int.MaxValue;

            if (!string.IsNullOrEmpty(txtPriceFrom.Text) || !string.IsNullOrEmpty(txtPriceTo.Text))
            {
                _paging.Fields["Price"].Filter = priceFilter;
            }
            else
            {
                _paging.Fields["Price"].Filter = null;
            }

            //----Qty filter
            var qtyFilter = new RangeFieldFilter { ParamName = "@Amount" };
            int from;
            qtyFilter.From = int.TryParse(txtQtyFrom.Text, out from) ? from : int.MinValue;

            int to;
            qtyFilter.To = int.TryParse(txtQtyTo.Text, out to) ? to : int.MaxValue;

            if (!string.IsNullOrEmpty(txtQtyFrom.Text) || !string.IsNullOrEmpty(txtQtyTo.Text))
            {
                _paging.Fields["Amount"].Filter = qtyFilter;
            }
            else
            {
                _paging.Fields["Amount"].Filter = null;
            }

            //----SortOrder filter
            var soFilter = new RangeFieldFilter { ParamName = "@SortOrder" };

            try
            {
                soFilter.From = int.Parse(txtSortOrderFrom.Text);
            }
            catch (Exception)
            {
                soFilter.From = int.MinValue;
            }

            try
            {
                soFilter.To = int.Parse(txtSortOrderTo.Text);
            }
            catch (Exception)
            {
                soFilter.To = int.MaxValue;
            }

            if (ShowMethod == EShowMethod.Normal)
            {
                if (!string.IsNullOrEmpty(txtSortOrderFrom.Text) || !string.IsNullOrEmpty(txtSortOrderTo.Text))
                {
                    _paging.Fields["ProductCategories.SortOrder"].Filter = soFilter;
                }
                else
                {
                    _paging.Fields["ProductCategories.SortOrder"].Filter = null;
                }
            }

            //----Id filter
            if (!string.IsNullOrEmpty(txtArtNo.Text))
            {
                var sfilter = new CompareFieldFilter { Expression = txtArtNo.Text, ParamName = "@artno" };
                _paging.Fields["Product.ArtNo"].Filter = sfilter;

            }
            else
            {
                _paging.Fields["Product.ArtNo"].Filter = null;

            }

            //----Name filter
            if (!string.IsNullOrEmpty(txtName.Text))
            {
                var nfilter = new CompareFieldFilter { Expression = txtName.Text, ParamName = "@name" };
                _paging.Fields["Name"].Filter = nfilter;
            }
            else
            {
                _paging.Fields["Name"].Filter = null;
            }

            //---Photo filter
            if (ddPhoto.SelectedIndex != 0)
            {
                var phfilter = new NullFieldFilter();
                if (ddPhoto.SelectedIndex == 1)
                {
                    phfilter.Null = false;
                }
                if (ddPhoto.SelectedIndex == 2)
                {
                    phfilter.Null = true;
                }
                phfilter.ParamName = "@PhotoName";
                _paging.Fields["PhotoName"].Filter = phfilter;
            }
            else
            {
                _paging.Fields["PhotoName"].Filter = null;
            }

            pageNumberer.CurrentPageIndex = 1;
            _paging.CurrentPageIndex = 1;
            //lblFound.Text = _paging.TotalRowsCount.ToString();
            //pnlFilterCount.Visible = true;
            //pnlNormalCount.Visible = false;
        }
Esempio n. 23
0
    private void BuildFilter()
    {
        if (!string.IsNullOrEmpty(Request["pricefrom"]) || !string.IsNullOrEmpty(Request["priceto"]))
        {
            int pricefrom = Request["pricefrom"].TryParseInt(0);
            int priceto = Request["priceto"].TryParseInt(int.MaxValue);

            filterPrice.CurValMin = pricefrom;
            filterPrice.CurValMax = priceto;

            _paging.Fields["Price_ProductID"].Filter = new PriceFieldFilter
                                                           {
                                                               ParamName = "@priceRange",
                                                               From = pricefrom * CurrencyService.CurrentCurrency.Value,
                                                               To = priceto * CurrencyService.CurrentCurrency.Value,
                                                               CategoryId = _categoryId,
                                                               GetSubCategoryes = Indepth
                                                           };
        }
        else
        {
            filterPrice.CurValMin = 0;
            filterPrice.CurValMax = int.MaxValue;
        }

        if (!string.IsNullOrEmpty(Request["prop"]))
        {
            var valIDs = new Dictionary<int, List<int>>();
            var selectedPropertyIDs = new List<int>();
            var filterCollection = Request["prop"].Split('-');
            int key = 1;
            foreach (var val in filterCollection)
            {
                var tempListIds = new List<int>();
                foreach (int id in val.Split(',').Select(item => item.TryParseInt()).Where(id => id != 0))
                {
                    tempListIds.Add(id);
                    selectedPropertyIDs.Add(id);
                }
                valIDs.Add(key, tempListIds);
                key++;
            }

            if (valIDs.Count != 0)
            {
                var lfilter = new PropertyFieldFilter { ListFilter = valIDs, ParamName = "@prop", CategoryId = Category.CategoryId, GetSubCategoryes = Category.DisplayChildProducts };
                _paging.Fields["[Product].[ProductID]"].Filter = lfilter;
            }
            filterProperty.SelectedPropertyIDs = selectedPropertyIDs;
        }
        else
        {
            filterProperty.SelectedPropertyIDs = new List<int>();
        }

        if (!string.IsNullOrEmpty(Request["brand"]))
        {
            var brandIds = Request["brand"].Split(',').Select(item => item.TryParseInt()).Where(id => id != 0).ToList();
            filterBrand.SelectedBrandIDs = brandIds;
            var isf = new InSetFieldFilter
            {
                IncludeValues = true,
                ParamName = "@brands",
                Values = brandIds.Select(brandid => brandid.ToString()).ToArray()
            };
            _paging.Fields["BrandID"].Filter = isf;
        }
        else
        {
            filterBrand.SelectedBrandIDs = new List<int>();
        }

        if (!string.IsNullOrEmpty(Request["size"]))
        {
            var sizeIds = Request["size"].Split(',').Select(item => item.TryParseInt()).Where(id => id != 0).ToList();
            filterSize.SelectedSizesIDs = sizeIds;
            _paging.Fields["Size_ProductID"].Filter = new SizeFieldFilter
                {
                    CategoryId = _categoryId,
                    ParamName = "@size",
                    ListFilter = sizeIds,
                    GetSubCategoryes = Indepth
                };
        }
        else
        {
            filterSize.SelectedSizesIDs = new List<int>();
        }

        if (!string.IsNullOrEmpty(Request["color"]))
        {
            var colorIds = Request["color"].Split(',').Select(item => item.TryParseInt()).Where(id => id != 0).ToList();
            filterColor.SelectedColorsIDs = colorIds;
            _paging.Fields["Color_ProductID"].Filter = new ColorFieldFilter
                {
                    CategoryId = _categoryId,
                    ParamName = "@color",
                    ListFilter = colorIds,
                    GetSubCategoryes = Indepth
                };

            if (SettingsCatalog.ComplexFilter)
            {
                _paging.AddField(new Field
                    {
                        Name =
                            string.Format(
                                "(select Top 1 PhotoName from catalog.Photo inner join catalog.offer on Photo.objid=offer.productid and Type='product'" +
                                " where offer.productid=product.productid and Photo.ColorID in({0}) order by Photo.PhotoSortOrder, Photo.Main)" +
                                " as AdditionalPhoto",
                                colorIds.AggregateString(','))
                    });
            }
            else
            {
                _paging.AddField(new Field
                {
                    Name = "null as AdditionalPhoto"
                });
            }

        }
        else
        {
            filterColor.SelectedColorsIDs = new List<int>();
            _paging.AddField(new Field
            {
                Name = "null as AdditionalPhoto"
            });
        }
    }
Esempio n. 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resources.Resource.Admin_Brands_Header));

            if (!IsPostBack)
            {
                _paging = new SqlPaging
                    {
                        TableName = "[Catalog].[Brand] left join Catalog.Photo on Photo.ObjId = Brand.BrandID and Type = @Type ",
                        ItemsPerPage = 10
                    };

                _paging.AddFieldsRange(new List<Field>
                    {
                        new Field
                            {
                                Name = "BrandID as ID",
                                IsDistinct = true
                            },
                        new Field {Name = "ProductsCount", SelectExpression="(Select Count(ProductID) from Catalog.Product Where Product.BrandID=Brand.BrandID) as ProductsCount"},
                        new Field {Name = "PhotoName as BrandLogo"},
                        new Field {Name = "Enabled"},
                        new Field {Name = "SortOrder", Sorting = SortDirection.Ascending},
                        new Field {Name = "BrandName", Sorting=SortDirection.Ascending}
                    });
                _paging.AddParam(new SqlParam { Value = PhotoType.Brand.ToString(), ParameterName = "@Type" });
                grid.ChangeHeaderImageUrl("arrowSortOrder", "images/arrowup.gif");

                _paging.ItemsPerPage = 10;

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;
            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                string strIds = Request.Form["SelectedIds"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    string[] arrids = strIds.Split(' ');

                    _selectionFilter = new InSetFieldFilter();
                    if (arrids.Contains("-1"))
                    {
                        _selectionFilter.IncludeValues = false;
                        _inverseSelection = true;
                    }
                    else
                    {
                        _selectionFilter.IncludeValues = true;
                    }
                    _selectionFilter.Values = arrids.Where(id => id != "-1").ToArray();
                }
            }
        }
Esempio n. 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_SizesDictionary_Header));

            MsgError();

            if (!IsPostBack)
            {
                _paging = new SqlPaging
                    {
                        TableName = "[Catalog].[Size]",
                        ItemsPerPage = 20,
                        CurrentPageIndex = 1
                    };

                _paging.AddFieldsRange(new[]
                    {
                        new Field {Name = "SizeID as ID", IsDistinct = true},
                        new Field {Name = "SizeName"},
                        new Field {Name = "SortOrder", Sorting = SortDirection.Ascending}
                    });
                grid.ChangeHeaderImageUrl("arrowSortOrder", "images/arrowup.gif");
                pageNumberer.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;
            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                string strIds = Request.Form["SelectedIds"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    var arrids = strIds.Split(' ');

                    var ids = new string[arrids.Length];
                    _selectionFilter = new InSetFieldFilter { IncludeValues = true };
                    for (int idx = 0; idx <= ids.Length - 1; idx++)
                    {
                        int t = int.Parse(arrids[idx]);
                        if (t != -1)
                        {
                            ids[idx] = t.ToString(CultureInfo.InvariantCulture);
                        }
                        else
                        {
                            _selectionFilter.IncludeValues = false;
                            _inverseSelection = true;
                        }
                    }
                    _selectionFilter.Values = ids;
                }
            }
        }
Esempio n. 26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_Properties_ListPropreties));

            if (!IsPostBack)
            {
                _paging = new SqlPaging
                    {
                        TableName = "[Catalog].[Property]",
                        ItemsPerPage = 20,
                        CurrentPageIndex = 1
                    };

                _paging.AddFieldsRange(new[]
                    {
                        new Field {Name = "PropertyID as ID", IsDistinct = true},
                        new Field {Name = "Name"},
                        new Field {Name = "UseInFilter"},
                        new Field {Name = "Expanded"},
                        new Field {Name = "SortOrder", Sorting = SortDirection.Ascending},
                        new Field {Name = "(Select Count(ProductID) from Catalog.ProductPropertyValue Where [PropertyValueID] in ( SELECT [PropertyValueID]  FROM [Catalog].[PropertyValue] WHERE [PropertyID] = [Property].PropertyID)) as ProductsCount"},
                    });

                grid.ChangeHeaderImageUrl("arrowSortOrder", "images/arrowup.gif");
                pageNumberer.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;
            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = Convert.ToInt32(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                string strIds = Request.Form["SelectedIds"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    var arrids = strIds.Split(' ');

                    var ids = new string[arrids.Length];
                    _selectionFilter = new InSetFieldFilter { IncludeValues = true };
                    for (int idx = 0; idx <= ids.Length - 1; idx++)
                    {
                        int t = int.Parse(arrids[idx]);
                        if (t != -1)
                        {
                            ids[idx] = t.ToString(CultureInfo.InvariantCulture);
                        }
                        else
                        {
                            _selectionFilter.IncludeValues = false;
                            _inverseSelection = true;
                        }
                    }
                    _selectionFilter.Values = ids;
                }
            }
        }
Esempio n. 27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request["type"]))
            {
                if (!string.IsNullOrEmpty(Request["type"]))
                {
                    Enum.TryParse(Request["type"], true, out _typeFlag);
                }
            }

            switch (_typeFlag)
            {
                case ProductOnMain.TypeFlag.Bestseller:
                    lblHead.Text = Resource.Admin_UserControls_MainPageProduct_Bestseller;
                    break;
                case ProductOnMain.TypeFlag.New:
                    lblHead.Text = Resource.Admin_UserControls_MainPageProduct_New;
                    break;
                case ProductOnMain.TypeFlag.Discount:
                    lblHead.Text = Resource.Admin_UserControls_MainPageProduct_Discount;
                    break;
            }

            SetMeta(string.Format("{0} - {1}", AdvantShop.Configuration.SettingsMain.ShopName, lblHead.Text));

            if (!IsPostBack)
            {
                _paging = new SqlPaging { TableName = "[Catalog].[Product]", ItemsPerPage = 20 };

                var f = new Field { Name = "Product.ProductId as ID" };
                _paging.AddField(f);

                f = new Field { Name = "ArtNo" };
                _paging.AddField(f);

                f = new Field { Name = "Name" };
                _paging.AddField(f);

                if (_typeFlag == ProductOnMain.TypeFlag.Bestseller)
                {
                    f = new Field { Name = "Bestseller" };
                    var filterB = new EqualFieldFilter { ParamName = "@Bestseller", Value = "1" };
                    f.Filter = filterB;
                    _paging.AddField(f);

                    _paging.AddField(new Field { Name = "SortBestseller as Sort", Sorting = SortDirection.Ascending });
                }

                if (_typeFlag == ProductOnMain.TypeFlag.New)
                {
                    f = new Field { Name = "New" };
                    var filterN = new EqualFieldFilter { ParamName = "@New", Value = "1" };
                    f.Filter = filterN;
                    _paging.AddField(f);

                    _paging.AddField(new Field { Name = "SortNew as Sort", Sorting = SortDirection.Ascending });
                }

                if (_typeFlag == ProductOnMain.TypeFlag.Discount)
                {
                    f = new Field { Name = "Discount" };
                    var filterN = new NotEqualFieldFilter() { ParamName = "@Discount", Value = "0" };
                    f.Filter = filterN;
                    _paging.AddField(f);

                    _paging.AddField(new Field { Name = "SortDiscount as Sort", Sorting = SortDirection.Ascending });
                    btnAddProduct.Visible = false;
                }

                grid.ChangeHeaderImageUrl("arrowSort", "images/arrowup.gif");

                _paging.ItemsPerPage = 20;

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;

            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                string strIds = Request.Form["SelectedIds"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    string[] arrids = strIds.Split(' ');

                    var ids = new string[arrids.Length ];
                    _selectionFilter = new InSetFieldFilter { IncludeValues = true };
                    for (int idx = 0; idx <= ids.Length - 1; idx++)
                    {
                        int t = int.Parse(arrids[idx]);
                        if (t != -1)
                        {
                            ids[idx] = t.ToString();
                        }
                        else
                        {
                            _selectionFilter.IncludeValues = false;
                            _inverseSelection = true;
                        }
                    }
                    _selectionFilter.Values = ids;
                }
            }
        }
Esempio n. 28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_MenuManager_TopMenu));

            Int32.TryParse(Request["menuid"], out _menuId);
            _needReloadTree = SQLDataHelper.GetBoolean(ViewState["updateTree"]);

            hlEditCategory.Visible = _menuId > 0;
            lblSeparator.Visible = _menuId > 0;
            hlDeleteCategory.Visible = _menuId > 0;

            if (!string.IsNullOrWhiteSpace(Request["type"]))
                Enum.TryParse(Request["type"], true, out _menuType);

            var menuitem = new AdvMenuItem();
            switch (_menuType)
            {
                case MenuService.EMenuType.Top:
                    menuitem = MenuService.GetMenuItemById(_menuId, _menuType);

                    lblHead.Text = menuitem == null
                                       ? Resource.Admin_MenuManager_TopMenu
                                       : string.Format("{0} - {1}", Resource.Admin_MenuManager_TopMenu, menuitem.MenuItemName);
                    lblSubHead.Text = Resource.Admin_MenuManager_SubHeaderTop;

                    Page.Title = menuitem == null
                                     ? Resource.Admin_MenuManager_TopMenu
                                     : string.Format("{0} - {1}", Resource.Admin_MenuManager_TopMenu, menuitem.MenuItemName);

                    break;
                case MenuService.EMenuType.Bottom:
                    menuitem = MenuService.GetMenuItemById(_menuId, _menuType);

                    lblHead.Text = menuitem == null
                                       ? Resource.Admin_MenuManager_BottomMenu
                                       : string.Format("{0} - {1}", Resource.Admin_MenuManager_BottomMenu, menuitem.MenuItemName);
                    lblSubHead.Text = Resource.Admin_MenuManager_SubHeaderBottom;

                    Page.Title = menuitem == null
                                     ? Resource.Admin_MenuManager_BottomMenu
                                     : string.Format("{0} - {1}", Resource.Admin_MenuManager_BottomMenu, menuitem.MenuItemName);
                    break;
            }

            btnAdd.OnClientClick = "open_window('m_Menu.aspx?MenuID=" + _menuId + "&mode=create&type=" + _menuType + "', 750, 640);return false;";
            hlEditCategory.NavigateUrl = "javascript:open_window(\'m_Menu.aspx?MenuID=" + _menuId + "&mode=edit&type=" + _menuType + "\', 750, 640)";
            ConfirmButtonExtenderCategory.ConfirmText =
                string.Format(Resource.Admin_MasterPageAdminCatalog_MenuConfirmation, menuitem != null ? menuitem.MenuItemName : string.Empty);

            if (!IsPostBack)
            {
                switch (_menuType)
                {
                    case MenuService.EMenuType.Top:
                        _paging = new SqlPaging
                            {
                                TableName = "[CMS].[MainMenu]",
                                ItemsPerPage = 10
                            };
                        break;
                    case MenuService.EMenuType.Bottom:
                        _paging = new SqlPaging
                            {
                                TableName = "[CMS].[BottomMenu]",
                                ItemsPerPage = 10
                            };
                        break;
                }

                _paging.AddFieldsRange(new List<Field>
                    {
                        new Field
                            {
                                Name = "MenuItemID as ID",
                                IsDistinct = true
                            },
                        new Field {Name = "MenuItemParentID" },
                        new Field {Name = "MenuItemName"},
                        new Field {Name = "Enabled"},
                        new Field {Name = "Blank"},
                        new Field {Name = "SortOrder",Sorting = SortDirection.Ascending}
                    });

                if (_menuId != 0)
                {
                    var filter = new EqualFieldFilter { ParamName = "@MenuItemParentID", Value = _menuId.ToString() };
                    _paging.Fields["MenuItemParentID"].Filter = filter;
                }
                else
                {
                    var filter = new NullFieldFilter { ParamName = "@MenuItemParentID", Null = true };
                    _paging.Fields["MenuItemParentID"].Filter = filter;
                }

                grid.ChangeHeaderImageUrl("arrowSortOrder", "images/arrowup.gif");

                _paging.ItemsPerPage = 10;

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;
            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                string strIds = Request.Form["SelectedIds"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    string[] arrids = strIds.Split(' ');

                    _selectionFilter = new InSetFieldFilter();
                    if (arrids.Contains("-1"))
                    {
                        _selectionFilter.IncludeValues = false;
                        _inverseSelection = true;
                    }
                    else
                    {
                        _selectionFilter.IncludeValues = true;
                    }
                    _selectionFilter.Values = arrids.Where(id => id != "-1").ToArray();
                }
            }
        }
Esempio n. 29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", AdvantShop.Configuration.SettingsMain.ShopName, Resources.Resource.Admin_Regions_Header));
            if (string.IsNullOrEmpty(Request["countryid"]))
            {
                Response.Redirect("Country.aspx");
            }

            Country country = CountryService.GetCountry(SQLDataHelper.GetInt(CountryID));
            if (country == null)
                Response.Redirect("Country.aspx");
            else
            {
                lblHead.Text = country.Name;
                hlBack.NavigateUrl = "Country.aspx";
                hlBack.Text = Resources.Resource.Admin_Cities_BackToCoutries;
            }

            if (!IsPostBack)
            {
                _paging = new SqlPaging { TableName = "[Customers].[Region]", ItemsPerPage = 20 };

                var f = new Field { Name = "RegionID as ID", IsDistinct = true };
                _paging.AddField(f);

                f = new Field { Name = "RegionName", Sorting = SortDirection.Ascending };
                _paging.AddField(f);

                f = new Field { Name = "RegionCode" };
                _paging.AddField(f);

                f = new Field { Name = "RegionSort" };
                _paging.AddField(f);

                f = new Field() { Name = "CountryID", Filter = new EqualFieldFilter() { ParamName = "@CounrtyID", Value = CountryID.ToString() } };
                _paging.AddField(f);

                grid.ChangeHeaderImageUrl("arrowRegionName", "images/arrowup.gif");

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;

            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                string strIds = Request.Form["SelectedIds"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    var arrids = strIds.Split(' ');

                    var ids = new string[arrids.Length ];
                    _selectionFilter = new InSetFieldFilter { IncludeValues = true };
                    for (int idx = 0; idx <= ids.Length - 1; idx++)
                    {
                        int t = int.Parse(arrids[idx]);
                        if (t != -1)
                        {
                            ids[idx] = t.ToString(CultureInfo.InvariantCulture);
                        }
                        else
                        {
                            _selectionFilter.IncludeValues = false;
                            _inverseSelection = true;
                        }
                    }
                    _selectionFilter.Values = ids;
                }
            }
        }
Esempio n. 30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", AdvantShop.Configuration.SettingsMain.ShopName, Resources.Resource.Admin_Taxes_Header));

            if (!IsPostBack)
            {
                _paging = new SqlPaging { TableName = "[Catalog].[Tax] JOIN [Customers].[Country] ON [Tax].[CountryID] = [Country].[CountryID]", ItemsPerPage = 10 };

                var f = new Field { Name = "TaxID as ID", IsDistinct = true };
                _paging.AddField(f);

                f = new Field { Name = "Name", Sorting = SortDirection.Ascending };
                _paging.AddField(f);

                f = new Field { Name = "RegNumber" };
                _paging.AddField(f);

                f = new Field { Name = "Enabled" };
                _paging.AddField(f);

                f = new Field { Name = "[Tax].CountryID" };
                _paging.AddField(f);

                f = new Field { Name = "CountryName" };
                _paging.AddField(f);

                grid.ChangeHeaderImageUrl("arrowName", "images/arrowup.gif");

                _paging.ItemsPerPage = 10;

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;

            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                string strIds = Request.Form["SelectedIds"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    string[] arrids = strIds.Split(' ');

                    var ids = new string[arrids.Length];
                    _selectionFilter = new InSetFieldFilter { IncludeValues = true };
                    for (int idx = 0; idx <= ids.Length - 1; idx++)
                    {
                        int t = int.Parse(arrids[idx]);
                        if (t != -1)
                        {
                            ids[idx] = t.ToString(CultureInfo.InvariantCulture);
                        }
                        else
                        {
                            _selectionFilter.IncludeValues = false;
                            _inverseSelection = true;
                        }
                    }

                    _selectionFilter.Values = ids;
                }

            }
        }