Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _paging = new SqlPaging {
                TableName = "[Customers].[Customer]"
            };

            _paging.AddFieldsRange(new List <Field>
            {
                new Field {
                    Name = "CustomerID as ID", IsDistinct = true
                },
                new Field {
                    Name = "EMail"
                },
                new Field {
                    Name = "FirstName"
                },
                new Field {
                    Name = "LastName"
                },
                new Field {
                    Name = "CustomerRole"
                },
            });
        }
        protected void LoadOrders(int orderStatusId = 0, int page = 1)
        {
            lvOrderStatuses.DataBind();

            _paging = new SqlPaging
            {
                TableName = "[Order].[Order] " +
                            "INNER JOIN [Order].[OrderCustomer] ON [Order].[OrderID] = [OrderCustomer].[OrderID] " +
                            "INNER JOIN [Order].[OrderCurrency] ON [Order].[OrderID] = [OrderCurrency].[OrderID] " +
                            "INNER JOIN [Order].[OrderStatus] ON [Order].[OrderStatusID] = [OrderStatus].[OrderStatusID]"
            };

            _paging.AddFieldsRange(new Field[]
            {
                new Field {
                    Name = "[Order].[OrderID]"
                },
                new Field {
                    Name = "[Order].[OrderStatusID]"
                },
                new Field {
                    Name = "LastName + ' ' +  FirstName as CustomerName"
                },
                new Field {
                    Name = "[Order].[OrderDate]", Sorting = SortDirection.Descending
                },
                new Field {
                    Name = "[Order].[Sum]"
                },
                new Field {
                    Name = "[Order].[PaymentDate]"
                },
                new Field {
                    Name = "[OrderCurrency].[CurrencyCode]"
                },
                new Field {
                    Name = "[OrderCurrency].[CurrencyValue]"
                },
                new Field {
                    Name = "[OrderStatus].[Color]"
                }
            });

            if (orderStatusId != 0)
            {
                _paging.Fields["[Order].[OrderStatusID]"].Filter = new EqualFieldFilter {
                    ParamName = "@OrderStatusID", Value = orderStatusId.ToString()
                };
            }

            _paging.ItemsPerPage     = 10;
            _paging.CurrentPageIndex = page;

            pageNumberer.PageCount        = _paging.PageCount;
            pageNumberer.CurrentPageIndex = _paging.CurrentPageIndex;
            ViewState["Paging"]           = _paging;
        }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_OfferLists_Header);

        if (!IsPostBack)
        {
            _paging = new SqlPaging {
                TableName = "[Catalog].[OffersList]", ItemsPerPage = 10
            };
            _paging.AddFieldsRange(new[]
            {
                new Field
                {
                    Name = "OfferListID as ID", IsDistinct = true, Filter = _selectionFilter
                },
                new Field {
                    Name = "Name", Sorting = SortDirection.Ascending
                }
            });

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

            _paging.ItemsPerPage = 10;

            pageNumberer.CurrentPageIndex = 1;
            _paging.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))
            {
                List <string> arrids = strIds.Trim().Split(' ').ToList();
                if (arrids.Contains("-1"))
                {
                    _inverseSelection = true;
                    arrids.Remove("-1");
                }
                int t;
                _selectionFilter = new InSetFieldFilter
                {
                    IncludeValues = !_inverseSelection,
                    Values        = arrids.Where(id => int.TryParse(id, out t)).ToArray()
                };
            }
        }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            _paging = new SqlPaging {TableName = "[Customers].[Customer]"};

            _paging.AddFieldsRange(new List<Field>
                {
                    new Field {Name = "CustomerID as ID", IsDistinct = true},
                    new Field {Name = "EMail"},
                    new Field {Name = "FirstName"},
                    new Field {Name = "LastName"},
                    new Field {Name = "CustomerRole"},
                });
        }
Beispiel #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_MasterPageAdmin_SEO_redirects);

        if (!IsPostBack)
        {
            _Paging = new SqlPaging
            {
                TableName    = "[Settings].[Redirect]",
                ItemsPerPage = 1000
            };

            _Paging.AddFieldsRange(
                new List <Field>
            {
                new Field {
                    Name = "ID", IsDistinct = true
                },
                new Field {
                    Name = "RedirectFrom"
                },
                new Field {
                    Name = "RedirectTo"
                }
            });

            _Paging.ItemsPerPage = 1000;

            _Paging.CurrentPageIndex = 1;
            ViewState["Paging"]      = _Paging;
        }
        else
        {
            _Paging = (SqlPaging)(ViewState["Paging"]);
            _Paging.ItemsPerPage = 1000;

            if (_Paging == null)
            {
                throw (new Exception("Paging lost"));
            }
        }
    }
Beispiel #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_MasterPageAdmin_SEO_redirects);

        if (!IsPostBack)
        {
            _Paging = new SqlPaging
                          {
                              TableName = "[Settings].[Redirect]",
                              ItemsPerPage = 1000
                          };

            _Paging.AddFieldsRange(
                new List<Field>
                    {
                        new Field {Name = "ID", IsDistinct = true},
                        new Field {Name = "RedirectFrom"},
                        new Field {Name = "RedirectTo"}
                    });

            _Paging.ItemsPerPage = 1000;

            _Paging.CurrentPageIndex = 1;
            ViewState["Paging"] = _Paging;
        }
        else
        {
            _Paging = (SqlPaging)(ViewState["Paging"]);
            _Paging.ItemsPerPage = 1000;

            if (_Paging == null)
            {
                throw (new Exception("Paging lost"));
            }
        }
    }
Beispiel #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _priceField = CustomerSession.CurrentCustomer.PriceType.ToString();

            _paging = new SqlPaging
                {
                    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] " +
                        "LEFT JOIN [Catalog].[ShoppingCart] ON [Catalog].[ShoppingCart].[OfferID] = [Catalog].[Offer].[OfferID] AND [Catalog].[ShoppingCart].[ShoppingCartType] = 3 AND [ShoppingCart].[CustomerID] = @CustomerId " +
                        "Left JOIN [Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=@CustomerId " +
                        "LEFT JOIN [Customers].[LastPrice] ON [LastPrice].[ProductId] = [Product].[ProductId] AND [LastPrice].[CustomerId] = @CustomerId"
                };

            _paging.AddFieldsRange(
            new List<Field>
                {
                    new Field {Name = "[Product].[ProductID]", IsDistinct = true},
                    new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select Count(PhotoName) From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) ELSE (Select Count(PhotoName) From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) END)  AS CountPhoto"},
                    new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END)  AS Photo"},
                    new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END)  AS PhotoDesc"},
                    new Field {Name = "[ProductCategories].[CategoryID]", NotInQuery=true},
                    new Field {Name = "BriefDescription"},
                    new Field {Name = "Product.ArtNo"},
                    new Field {Name = "Name"},

                    new Field {Name = "Recomended"},
                    new Field {Name = "Bestseller"},
                    new Field {Name = "New"},
                    new Field {Name = "OnSale"},
                    new Field {Name = "Discount"},
                    new Field {Name = "Offer.Main", NotInQuery=true},
                    new Field {Name = "Offer.OfferID"},
                    new Field {Name = "Offer.Amount"},
                    new Field {Name = "(CASE WHEN Offer.Amount=0 OR Offer.Amount < IsNull(MinAmount,0) THEN 0 ELSE 1 END) as TempAmountSort", Sorting=SortDirection.Descending},
                    new Field {Name = "MinAmount"},
                    new Field {Name = "MaxAmount"},
                    new Field {Name = "Multiplicity"},
                    new Field {Name = "Enabled"},
                    new Field {Name = "AllowPreOrder"},
                    new Field {Name = "Ratio"},
                    new Field {Name = "RatioID"},
                    new Field {Name = "DateModified"},
                    new Field {Name = "ShoppingCartItemId"},
                    new Field {Name = "UrlPath"},

                    new Field {Name = "[ShoppingCart].[CustomerID]", NotInQuery=true},
                    new Field {Name = "BrandID", NotInQuery=true},
                    new Field {Name = "Offer.ProductID as Size_ProductID", NotInQuery=true},
                    new Field {Name = "Offer.ProductID as Color_ProductID", NotInQuery=true},
                    new Field {Name = "Offer.ProductID as Price_ProductID", NotInQuery=true},
                    new Field {Name = "Offer.ColorID"},
                    new Field {Name = "CategoryEnabled", NotInQuery=true},
                    new Field {Name = "null as AdditionalPhoto"}
                });

            if (SettingsCatalog.ComplexFilter)
            {
                _paging.AddFieldsRange(new List<Field>
                {
                    new Field {Name = "(select [Settings].[ProductColorsToString]([Product].[ProductID])) as Colors"},
                    new Field {Name = string.Format("(select max ({0}) - min ({0}) from catalog.offer where offer.productid=product.productid) as MultiPrices", _priceField)},
                    new Field {Name = string.Format("(select min ({0}) from catalog.offer where offer.productid=product.productid) as Price", _priceField)},
                });
            }
            else
            {
                _paging.AddFieldsRange(new List<Field>
                {
                    new Field {Name = "null as Colors"},
                    new Field {Name = "0 as MultiPrices"},
                    new Field
                    {
                        Name = SettingsCatalog.UseLastPrice
                            ? string.Format("(CASE WHEN ProductPrice IS NULL THEN {0} ELSE ProductPrice END) as Price", _priceField)
                            : string.Format("{0} as Price", _priceField)
                    },
                });
            }
            _paging.AddParam(new SqlParam { ParameterName = "@CustomerId", Value = CustomerSession.CustomerId.ToString() });
            _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.Product.ToString() });

            BuildSorting();
            BuildFilter();

            var nmeta = new MetaInfo(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Client_Search_AdvancedSearch));
            SetMeta(nmeta, string.Empty, page:paging.CurrentPage);
            txtName.Focus();
        }
Beispiel #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["theme"] == null)
        {
            Response.Redirect("Voting.aspx");
        }
        lblHead.Text = VoiceService.GetVotingName(ThemeId);
        Page.Title   = 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 = Convert.ToInt32(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();
            }
        }
    }
Beispiel #9
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;
                }
            }
        }
Beispiel #10
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)
                }
            }
        }
Beispiel #11
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;
                }
            }
        }
Beispiel #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_NewsAdmin_Header));

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

                _paging.AddFieldsRange(new List <Field>
                {
                    new Field
                    {
                        Name       = "NewsID as ID",
                        IsDistinct = true
                    },
                    new Field {
                        Name = "Title"
                    },
                    new Field {
                        Name = "ShowOnMainPage"
                    },
                    new Field {
                        Name = "NewsCategoryID"
                    },
                    new Field {
                        Name = "AddingDate", Sorting = SortDirection.Descending
                    }
                });

                grid.ChangeHeaderImageUrl("arrowAddingDate", "images/arrowdown.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(' ');

                    _selectionFilter = new InSetFieldFilter();
                    if (arrids.Contains("-1"))
                    {
                        _selectionFilter.IncludeValues = false;
                        _inverseSelection = true;
                    }
                    else
                    {
                        _selectionFilter.IncludeValues = true;
                    }
                    _selectionFilter.Values = arrids.Where(id => id != "-1").ToArray();
                }
            }


            var modules = AttachedModules.GetModules <ISendMails>();


            foreach (var moduleType in modules)
            {
                var moduleObject = (ISendMails)Activator.CreateInstance(moduleType, null);
                if (ModulesRepository.IsActiveModule(moduleObject.ModuleStringId))
                {
                    CanSendNews = true;
                }
            }
        }
Beispiel #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", AdvantShop.Configuration.SettingsMain.ShopName, Resources.Resource.Admin_MasterPageAdmin_Sities));

            if (RegionId < 0 && CountryId < 0)
            {
                Response.Redirect("Country.aspx");
            }

            if (RegionId != 0)
            {
                var region = RegionService.GetRegion(RegionId);
                if (region != null)
                {
                    lblHead.Text       = region.Name;
                    hlBack.NavigateUrl = "Regions.aspx?CountryId=" + region.CountryID;
                    hlBack.Text        = Resources.Resource.Admin_Cities_BackToRegions;

                    hlBack2.NavigateUrl = "Country.aspx";
                    hlBack2.Text        = Resources.Resource.Admin_Cities_BackToCoutries;
                }
            }

            if (CountryId != 0)
            {
                var country = CountryService.GetCountry(CountryId);
                if (country != null)
                {
                    lblHead.Text       = country.Name;
                    hlBack.NavigateUrl = "Regions.aspx?CountryId=" + country.CountryId;
                    hlBack.Text        = Resources.Resource.Admin_Cities_BackToRegions;

                    hlBack2.NavigateUrl = "Country.aspx";
                    hlBack2.Text        = Resources.Resource.Admin_Cities_BackToCoutries;
                }
                btnAddCity.Visible = false;
            }



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

                _paging.AddFieldsRange(
                    new List <Field>
                {
                    new Field {
                        Name = "CityID as ID", IsDistinct = true
                    },
                    new Field {
                        Name = "CityName", Sorting = SortDirection.Ascending
                    },
                    new Field {
                        Name = "CitySort"
                    },
                    new Field {
                        Name = "City.RegionID"
                    },
                    new Field {
                        Name = "City.DisplayInPopup"
                    },
                    new Field {
                        Name = "PhoneNumber"
                    },
                    new Field {
                        Name = "Region.CountryId", NotInQuery = true
                    },
                });

                if (RegionId != 0)
                {
                    _paging.Fields["City.RegionID"].Filter = new EqualFieldFilter
                    {
                        ParamName = "@RegionID",
                        Value     = RegionId.ToString()
                    };
                }

                if (CountryId != 0)
                {
                    _paging.Fields["Region.CountryId"].Filter = new EqualFieldFilter
                    {
                        ParamName = "@CountryId",
                        Value     = CountryId.ToString()
                    };
                }

                grid.ChangeHeaderImageUrl("arrowCityName", "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;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                Paging = (SqlPaging)(ViewState["Paging"]);
            }
            else
            {
                Paging = new SqlPaging
                    {
                        TableName = CategoryID == CategoryService.DefaultNonCategoryId ? "[Catalog].[GetProductsWithoutCategories]()" : string.Format("[Catalog].[CategoryContent](\'{0}\')", CategoryID),
                        ItemsPerPage = 18
                    };

                Paging.AddFieldsRange(new[]
                    {
                        new Field { Name = "ID", IsDistinct = true },
                        new Field { Name = "ItemType", Sorting = SortDirection.Ascending },
                        new Field { Name = "PhotoName" },
                        new Field { Name = "Name" },
                        new Field { Name = "sortOrder", Sorting = SortDirection.Ascending }
                    });

                int pageIndex = 1;

                if (!string.IsNullOrEmpty(Request["pn"]))
                {
                    int.TryParse(Request["pn"], out pageIndex);
                }

                Paging.CurrentPageIndex = pageIndex;
                if (CategoryID != CategoryService.DefaultNonCategoryId)
                {
                    hlAddProduct.NavigateUrl = "~/admin/Product.aspx?CategoryId=" + CategoryID;
                    IList<Category> parentCategories = CategoryService.GetParentCategories(CategoryID);
                    if (parentCategories != null)
                    {
                        if (CategoryID == CategoryService.DefaultNonCategoryId)
                        {
                            ddlCategory.SelectedValue = CategoryService.DefaultNonCategoryId.ToString();
                        }
                        if (parentCategories.Count != 0)
                        {
                            ddlCategory.SelectedValue = parentCategories[parentCategories.Count - 1].CategoryId.ToString();
                        }
                    }
                }
                else
                {
                    ddlCategory.SelectedValue = CategoryService.DefaultNonCategoryId.ToString();
                }

                FillRootCategory();
            }
        }
Beispiel #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        lblError.Text    = string.Empty;
        lblError.Visible = false;

        Page.Title = 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 = Convert.ToInt32(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)
            }
        }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_CertificateAdmin_Header));

            if (!IsPostBack)
            {
                _paging = new SqlPaging
                {
                    TableName    = "[Order].[Certificate] INNER JOIN [Order].[Order] ON [Order].[OrderID] = [Certificate].[OrderID] INNER JOIN [Order].[OrderCurrency] ON [OrderCurrency].[OrderID] = [Certificate].[OrderID]",
                    ItemsPerPage = 10
                };

                _paging.AddFieldsRange(new List <Field>
                {
                    new Field
                    {
                        Name       = "CertificateID as ID",
                        IsDistinct = true
                    },
                    new Field {
                        Name = "[Certificate].CertificateCode as CertificateCode"
                    },
                    new Field {
                        Name = "[Certificate].ApplyOrderNumber as ApplyOrderNumber"
                    },
                    new Field {
                        Name = "[Certificate].OrderId as OrderId"
                    },
                    new Field {
                        Name = "[Certificate].Sum as Sum"
                    },
                    new Field {
                        Name = "[Certificate].Used as Used"
                    },
                    new Field {
                        Name = "[Certificate].Enable as Enable"
                    },
                    new Field {
                        Name = "[Certificate].CreationDate as CreationDate", Sorting = SortDirection.Descending
                    },
                    //OrderCurrency
                    new Field {
                        Name = "[OrderCurrency].CurrencyValue as CurrencyValue"
                    },
                    new Field {
                        Name = "[OrderCurrency].CurrencyCode as CurrencyCode"
                    },
                    //Order
                    new Field {
                        Name = "[Order].PaymentDate as PaymentDate"
                    },
                    //new Field {Name = "[Order].PaymentDate is null as Paid"}
                });

                grid.ChangeHeaderImageUrl("arrowCreationDate", "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();
                }
            }
        }
Beispiel #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Request["countryid"]))
            {
                Response.Redirect("Country.aspx");
            }

            var country = CountryService.GetCountry(CountryId);

            if (country == null)
            {
                Response.Redirect("Country.aspx");
            }
            else
            {
                lblHead.Text       = country.Name;
                hlBack.NavigateUrl = "Country.aspx";

                hlAllCities.NavigateUrl = "Cities.aspx?countryid=" + country.CountryId;
            }

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

                _paging.AddFieldsRange(
                    new List <Field>
                {
                    new Field {
                        Name = "RegionID as ID", IsDistinct = true
                    },
                    new Field {
                        Name = "RegionName", Sorting = SortDirection.Ascending
                    },
                    new Field {
                        Name = "RegionCode"
                    },
                    new Field {
                        Name = "RegionSort"
                    },
                    new Field
                    {
                        Name   = "CountryID",
                        Filter = new EqualFieldFilter()
                        {
                            ParamName = "@CounrtyID", Value = CountryId.ToString()
                        }
                    }
                });

                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;
                }
            }

            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resources.Resource.Admin_Regions_Header));
        }
Beispiel #18
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;
                hlDeleteCategory.Attributes["data-confirm"] =
                    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] and [Offer].[Main] = 1 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 = "[Settings].[ArtNoToString](Product.ProductID) as ArtNo", Sorting = ShowMethod != EShowMethod.Normal ? SortDirection.Ascending : (SortDirection?)null
                    },
                    new Field {
                        Name = "Product.ArtNo as ProductArtNo"
                    },
                    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 = "(Select count (offerid) from catalog.Offer where Offer.ProductID=Product.productID) as OffersCount"
                    },
                    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"], true);
                    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
                    };

                    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;

                        default:
                            _inverseSelection = true;
                            break;
                        }
                    }
                    _selectionFilter.Values = ids.Distinct().Where(item => item != null).ToArray();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Message.Visible = false;
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_OrderStatuses_OrderStatuses));

            MsgErr(true);

            if (!IsPostBack)
            {
                _paging = new SqlPaging { TableName = "[Order].[OrderStatus]" };
                _paging.AddFieldsRange(
                    new Field("OrderStatusID as ID"),
                    new Field("StatusName"),
                    new Field("IsDefault"),
                    new Field("IsCanceled"),
                    new Field("CommandID"),
                    new Field("Color"),
                    new Field("SortOrder") { Sorting = SortDirection.Ascending });
                grid.ChangeHeaderImageUrl("arrowSortOrder", "images/arrowup.gif");

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

                if (Request["productid"] != null)
                {
                    _paging.Fields["ProductID"].Filter = new CompareFieldFilter
                        {
                            ParamName = "@ProductID",
                            Expression = Request["productid"]
                        };
                }
            }
            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))
                {
                    List<string> arrids = strIds.Trim().Split(' ').ToList();
                    if (arrids.Contains("-1"))
                    {
                        _inverseSelection = true;
                        arrids.Remove("-1");
                    }
                    int t;
                    _selectionFilter = new InSetFieldFilter
                        {
                            IncludeValues = !_inverseSelection,
                            Values = arrids.Where(id => int.TryParse(id, out t)).ToArray()
                        };
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_PageParts_StaticBlocks));
            if (!IsPostBack)
            {
                _paging = new SqlPaging
                {
                    TableName    = "[CMS].[StaticBlock]",
                    ItemsPerPage = 50
                };

                _paging.AddFieldsRange(new List <Field>
                {
                    new Field {
                        Name = "StaticBlockID as ID", IsDistinct = true
                    },
                    new Field {
                        Name = "[Key]", Sorting = SortDirection.Ascending
                    },
                    new Field {
                        Name = "InnerName"
                    },
                    new Field {
                        Name = "Added"
                    },
                    new Field {
                        Name = "Modified"
                    },
                    new Field {
                        Name = "Enabled"
                    }
                });

                grid.ChangeHeaderImageUrl("arrowKey", "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(' ');

                    _selectionFilter = new InSetFieldFilter();
                    if (arrids.Contains("-1"))
                    {
                        _selectionFilter.IncludeValues = false;
                        _inverseSelection = true;
                    }
                    else
                    {
                        _selectionFilter.IncludeValues = true;
                    }
                    _selectionFilter.Values = arrids.Where(id => id != "-1").ToArray();
                }
            }
        }
Beispiel #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_Voting_Voting);

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

            _paging.AddFieldsRange(new List <Field>
            {
                new Field {
                    Name = "VoiceThemeID as ID", IsDistinct = true
                },
                new Field {
                    Name = "PsyID"
                },
                new Field {
                    Name = "Name", Sorting = SortDirection.Ascending
                },
                new Field {
                    Name = "IsDefault"
                },
                new Field {
                    Name = "IsHaveNullVoice"
                },
                new Field {
                    Name = "IsClose"
                },
                new Field {
                    Name = "DateAdded"
                },
                new Field {
                    Name = "DateModify"
                },
                new Field {
                    Name = "(SELECT COUNT(*) FROM [Voice].[Answer] WHERE [FKIDTheme] = VoiceThemeID) as AnswerCount"
                }
            });

            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 = 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(' ');

                _selectionFilter = new InSetFieldFilter();
                if (arrids.Contains("-1"))
                {
                    _selectionFilter.IncludeValues = false;
                    _inverseSelection = true;
                }
                else
                {
                    _selectionFilter.IncludeValues = true;
                }
                _selectionFilter.Values = arrids.Where(id => id != "-1").ToArray();
            }
        }
    }
Beispiel #22
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();
                }
            }
        }
Beispiel #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_StaticPage_lblSubMain));

            int.TryParse(Request["parentid"], out _parentPageId);
            if (!IsPostBack)
            {
                _paging = new SqlPaging
                    {
                        TableName = "[CMS].[StaticPage]",
                        ItemsPerPage = 10
                    };

                _paging.AddFieldsRange(new List<Field>
                    {
                        new Field {Name = "StaticPageID as ID",IsDistinct = true},
                        new Field {Name = "PageName"},
                        new Field {Name = "Enabled"},
                        new Field {Name = "ParentID"},
                        new Field {Name = "SortOrder",Sorting = SortDirection.Ascending},
                        new Field {Name = "ModifyDate"}
                    });

                if (_parentPageId != 0)
                {
                    var ef = new EqualFieldFilter()
                        {
                            ParamName = "@ParentID",
                            Value = _parentPageId.ToString(CultureInfo.InvariantCulture)
                        };

                    _paging.Fields["ParentID"].Filter = ef;
                }
                else
                {
                    var nf = new NullFieldFilter()
                        {
                            ParamName = "@ParentID",
                            Null = true
                        };

                    _paging.Fields["ParentID"].Filter = nf;
                }

                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();
                    var 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();
                }
            }
        }
Beispiel #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = 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 = Convert.ToInt32(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();
            }
        }
    }
Beispiel #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_Reviews_Reviews));
            Message.Visible = false;

            MsgErr(true);

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

                _paging.AddFieldsRange(
                    new Field { Name = "ReviewId as ID", IsDistinct = true },
                    new Field { Name = "(Select Product.Name From Catalog.Product Where Product.ProductID = EntityId) as ProductName" },
                    new Field { Name = "(Select Top 1 PhotoName From Catalog.Photo Where ObjId = EntityId and Type = 'Product' Order by [Main] DESC) as ProductPhoto" },
                    new Field { Name = "Name" },
                    new Field { Name = "Email" },
                    new Field { Name = "AddDate", Sorting = SortDirection.Descending },
                    new Field { Name = "Checked" },
                    new Field { Name = "[Text]" });

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

                _paging.ItemsPerPage = 10;

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex = 1;
                ViewState["Paging"] = _paging;
                if (Request["ReviewId"] != null)
                {
                    _paging.Fields["ReviewId"].Filter = new CompareFieldFilter
                        {
                            ParamName = "@ReviewId",
                            Expression = Request["ReviewId"]
                        };
                }
            }
            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))
                {
                    List<string> arrids = strIds.Trim().Split(' ').ToList();

                    _selectionFilter = new InSetFieldFilter();
                    if (arrids.Contains("-1"))
                    {
                        _selectionFilter.IncludeValues = false;
                        _inverseSelection = true;
                        arrids.Remove("-1");
                    }
                    else
                    {
                        _selectionFilter.IncludeValues = true;
                    }
                    _selectionFilter.Values = arrids.ToArray();
                }
            }
        }
Beispiel #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", AdvantShop.Configuration.SettingsMain.ShopName, Resources.Resource.Admin_Country_SubHeader));

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

                _paging.AddFieldsRange(
                    new List <Field>
                {
                    new Field {
                        Name = "CountryID as ID", IsDistinct = true
                    },
                    new Field {
                        Name = "SortOrder", Sorting = SortDirection.Descending
                    },
                    new Field {
                        Name = "CountryName", Sorting = SortDirection.Ascending
                    },
                    new Field {
                        Name = "CountryISO2"
                    },
                    new Field {
                        Name = "CountryISO3"
                    },
                    new Field {
                        Name = "DisplayInPopup"
                    },
                });

                grid.ChangeHeaderImageUrl("arrowSortOrder", "images/arrowdown.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];
                    int t;
                    _selectionFilter = new InSetFieldFilter {
                        IncludeValues = true
                    };
                    for (int idx = 0; idx <= ids.Length - 1; idx++)
                    {
                        t = int.Parse(arrids[idx]);
                        if (t != -1)
                        {
                            ids[idx] = t.ToString();
                        }
                        else
                        {
                            _selectionFilter.IncludeValues = false;
                            _inverseSelection = true;
                        }
                    }

                    _selectionFilter.Values = ids;
                }
            }
        }
Beispiel #27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Message.Visible = false;
        Page.Title      = string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_OrderStatuses_OrderStatuses);

        MsgErr(true);

        if (!IsPostBack)
        {
            _paging = new SqlPaging {
                TableName = "[Order].[OrderStatus]"
            };
            _paging.AddFieldsRange(
                new Field("OrderStatusID as ID"),
                new Field("StatusName")
            {
                Sorting = SortDirection.Ascending
            },
                new Field("IsDefault"),
                new Field("Canceled"),
                new Field("CommandID"));
            grid.ChangeHeaderImageUrl("arrowStatusName", "images/arrowup.gif");


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

            if (Request["productid"] != null)
            {
                _paging.Fields["ProductID"].Filter = new CompareFieldFilter
                {
                    ParamName  = "@ProductID",
                    Expression = Request["productid"]
                };
            }
        }
        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))
            {
                List <string> arrids = strIds.Trim().Split(' ').ToList();
                if (arrids.Contains("-1"))
                {
                    _inverseSelection = true;
                    arrids.Remove("-1");
                }
                int t;
                _selectionFilter = new InSetFieldFilter
                {
                    IncludeValues = !_inverseSelection,
                    Values        = arrids.Where(id => int.TryParse(id, out t)).ToArray()
                };
            }
        }
    }
Beispiel #28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_Properties_ListPropreties);

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

            _paging.AddFieldsRange(new[]
            {
                new Field {
                    Name = "PropertyValueID as ID"
                },
                new Field {
                    Name = "PropertyID"
                },
                new Field {
                    Name = "Value"
                },
                new Field {
                    Name = "SortOrder", Sorting = SortDirection.Ascending
                },
                new Field {
                    Name = "(Select Count(ProductID) from Catalog.ProductPropertyValue Where propertyValueid=[PropertyValue].propertyValueid) as ProductsCount"
                },
            });

            if (!String.IsNullOrEmpty(Request["propertyid"]))
            {
                int      propertyId = 0;
                Property prop       = null;
                if (int.TryParse(Request["propertyid"], out propertyId))
                {
                    prop = PropertyService.GetPropertyById(propertyId);
                }
                if (prop != null)
                {
                    lblHead.Text += string.Format(" - \"{0}\"", prop.Name);

                    var ef = new EqualFieldFilter
                    {
                        ParamName = "@PropertyID",
                        Value     = propertyId.ToString(CultureInfo.InvariantCulture)
                    };
                    _paging.Fields["PropertyID"].Filter = ef;
                }
                else
                {
                    Response.Redirect("Properties.aspx");
                }
            }
            else
            {
                Response.Redirect("Properties.aspx");
            }

            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;
            }
        }
    }
Beispiel #29
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;
                }
            }
        }
Beispiel #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_CertificateAdmin_Header));

            if (!IsPostBack)
            {
                _paging = new SqlPaging
                    {
                        TableName = "[Order].[Certificate] INNER JOIN [Order].[Order] ON [Order].[OrderID] = [Certificate].[OrderID] INNER JOIN [Order].[OrderCurrency] ON [OrderCurrency].[OrderID] = [Certificate].[OrderID]",
                        ItemsPerPage = 10
                    };

                _paging.AddFieldsRange(new List<Field>
                    {
                        new Field
                            {
                                Name = "CertificateID as ID",
                                IsDistinct = true
                            },
                        new Field {Name = "[Certificate].CertificateCode"},
                        new Field {Name = "[Certificate].ApplyOrderNumber"},
                        new Field {Name = "[Certificate].OrderId"},
                        new Field {Name = "[Certificate].Sum"},
                        new Field {Name = "[Certificate].Used"},
                        new Field {Name = "[Certificate].Enable"},
                        new Field {Name = "[Certificate].CreationDate", Sorting = SortDirection.Descending},
                        //OrderCurrency
                        new Field {Name = "[OrderCurrency].CurrencyValue"},
                        new Field {Name = "[OrderCurrency].CurrencyCode"},
                        //Order
                        new Field {Name = "[Order].PaymentDate"}
                    });

                grid.ChangeHeaderImageUrl("arrowCreationDate", "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();
                }
            }
        }
Beispiel #31
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            Paging = (SqlPaging)(ViewState["Paging"]);
        }
        else
        {
            Paging = new SqlPaging
            {
                TableName    = CategoryID == CategoryService.DefaultNonCategoryId ? "[Catalog].[GetProductsWithoutCategories]()" : string.Format("[Catalog].[CategoryContent](\'{0}\')", CategoryID),
                ItemsPerPage = 18
            };

            Paging.AddFieldsRange(new[]
            {
                new Field {
                    Name = "ID", IsDistinct = true
                },
                new Field {
                    Name = "ItemType", Sorting = SortDirection.Ascending
                },
                new Field {
                    Name = "PhotoName"
                },
                new Field {
                    Name = "Name"
                },
                new Field {
                    Name = "sortOrder", Sorting = SortDirection.Ascending
                }
            });

            int pageIndex = 1;

            if (!string.IsNullOrEmpty(Request["pn"]))
            {
                int.TryParse(Request["pn"], out pageIndex);
            }

            Paging.CurrentPageIndex = pageIndex;
            if (CategoryID != CategoryService.DefaultNonCategoryId)
            {
                hlAddProduct.NavigateUrl = "~/admin/Product.aspx?CategoryId=" + CategoryID;
                IList <Category> parentCategories = CategoryService.GetParentCategories(CategoryID);
                if (parentCategories != null)
                {
                    if (CategoryID == CategoryService.DefaultNonCategoryId)
                    {
                        ddlCategory.SelectedValue = CategoryService.DefaultNonCategoryId.ToString();
                    }
                    if (parentCategories.Count != 0)
                    {
                        ddlCategory.SelectedValue = parentCategories[parentCategories.Count - 1].CategoryId.ToString();
                    }
                }
            }
            else
            {
                ddlCategory.SelectedValue = CategoryService.DefaultNonCategoryId.ToString();
            }

            FillRootCategory();
        }
    }
Beispiel #32
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Message.Visible = false;
        Page.Title      = string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_Reviews_Reviews);


        MsgErr(true);

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

            _paging.AddFieldsRange(
                new Field {
                Name = "ReviewId as ID", IsDistinct = true
            },
                new Field {
                Name = "Name"
            },
                new Field {
                Name = "Email"
            },
                new Field {
                Name = "AddDate", Sorting = SortDirection.Descending
            },
                new Field {
                Name = "Checked"
            },
                new Field {
                Name = "[Text]"
            });
            grid.ChangeHeaderImageUrl("arrowAddDate", "images/arrowdown.gif");

            _paging.ItemsPerPage = 10;

            pageNumberer.CurrentPageIndex = 1;
            _paging.CurrentPageIndex      = 1;
            ViewState["Paging"]           = _paging;
            if (Request["ReviewId"] != null)
            {
                _paging.Fields["ReviewId"].Filter = new CompareFieldFilter
                {
                    ParamName  = "@ReviewId",
                    Expression = Request["ReviewId"]
                };
            }
        }
        else
        {
            _paging = (SqlPaging)ViewState["Paging"];
            _paging.ItemsPerPage = Convert.ToInt32(ddRowsPerPage.SelectedValue);

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

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

            if (!string.IsNullOrEmpty(strIds))
            {
                List <string> arrids = strIds.Trim().Split(' ').ToList();

                _selectionFilter = new InSetFieldFilter();
                if (arrids.Contains("-1"))
                {
                    _selectionFilter.IncludeValues = false;
                    _inverseSelection = true;
                    arrids.Remove("-1");
                }
                else
                {
                    _selectionFilter.IncludeValues = true;
                }
                _selectionFilter.Values = arrids.ToArray();
            }
        }
    }
Beispiel #33
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();
                }
            }
        }
Beispiel #34
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();
                }
            }
        }
Beispiel #35
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(Request["categoryid"]) || !Int32.TryParse(Request["categoryid"], out _categoryId))
        {
            Error404();
        }

        Category = CategoryService.GetCategory(_categoryId);
        if (Category == null || Category.Enabled == false || Category.ParentsEnabled == false)
        {
            Error404();
            return;
        }

        Indepth = Request["indepth"] == "1" || Category.DisplayChildProducts;

        _priceField = CustomerSession.CurrentCustomer.PriceType.ToString();

        _paging = new SqlPaging
            {
                TableName =
                    "[Catalog].[Product] " +
                    "LEFT JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] " +
                    "inner join Catalog.ProductCategories on ProductCategories.ProductId = [Product].[ProductID] " +
                    "Left JOIN [Catalog].[ProductPropertyValue] ON [Product].[ProductID] = [ProductPropertyValue].[ProductID] " +
                    "LEFT JOIN [Catalog].[ShoppingCart] ON [Catalog].[ShoppingCart].[OfferID] = [Catalog].[Offer].[OfferID] AND [Catalog].[ShoppingCart].[ShoppingCartType] = 3 AND [ShoppingCart].[CustomerID] = @CustomerId " +
                    "Left JOIN [Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=@CustomerId " +
                    "LEFT JOIN [Customers].[LastPrice] ON [LastPrice].[ProductId] = [Product].[ProductId] AND [LastPrice].[CustomerId] = @CustomerId"
            };

        _paging.AddFieldsRange(
           new List<Field>
                {
                    new Field {Name = "[Product].[ProductID]", IsDistinct = true},
                    new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select Count(PhotoName) From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) ELSE (Select Count(PhotoName) From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) END)  AS CountPhoto"},
                    new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END)  AS Photo"},
                    new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END)  AS PhotoDesc"},
                    new Field {Name = "[ProductCategories].[CategoryID]", NotInQuery=true},
                    new Field {Name = "BriefDescription"},
                    new Field {Name = "Product.ArtNo"},
                    new Field {Name = "Name"},
                    new Field {Name = string.Format("(CASE WHEN {0}=0 THEN 0 ELSE 1 END) as TempSort", _priceField), Sorting=SortDirection.Descending},
                    new Field {Name = "Recomended"},
                    new Field {Name = "Bestseller"},
                    new Field {Name = "New"},
                    new Field {Name = "OnSale"},
                    new Field {Name = "Discount"},
                    new Field {Name = "Offer.Main", NotInQuery=true},
                    new Field {Name = "Offer.OfferID"},
                    new Field {Name = "(Select Max(Offer.Amount) from catalog.Offer Where ProductId=[Product].[ProductID]) as Amount"},
                    new Field {Name = "(CASE WHEN (Select Max(Offer.Amount) from catalog.Offer Where ProductId=[Product].[ProductID])  <= 0 OR (Select Max(Offer.Amount) from catalog.Offer Where ProductId=[Product].[ProductID]) < IsNull(MinAmount,0) THEN 0 ELSE 1 END) as TempAmountSort", Sorting=SortDirection.Descending},
                    new Field {Name = "MinAmount"},
                    new Field {Name = "MaxAmount"},
                    new Field {Name = "Multiplicity"},
                    new Field {Name = "Enabled"},
                    new Field {Name = "AllowPreOrder"},
                    new Field {Name = "Ratio"},
                    new Field {Name = "RatioID"},
                    new Field {Name = "DateModified"},
                    new Field {Name = "ShoppingCartItemId"},
                    new Field {Name = "UrlPath"},
                    new Field {Name = !Indepth ? "[ProductCategories].[SortOrder]" : "0 as SortOrder"},
                    new Field {Name = "[ShoppingCart].[CustomerID]", NotInQuery=true},
                    new Field {Name = "BrandID", NotInQuery=true},
                    new Field {Name = "Offer.ProductID as Size_ProductID", NotInQuery=true},
                    new Field {Name = "Offer.ProductID as Color_ProductID", NotInQuery=true},
                    new Field {Name = "Offer.ProductID as Price_ProductID", NotInQuery=true},
                    new Field {Name = "Offer.ColorID"},
                    new Field {Name = "CategoryEnabled", NotInQuery=true},
                });

        if (SettingsCatalog.ComplexFilter)
        {
            _paging.AddFieldsRange(new List<Field>
                {
                    new Field {Name = "(select [Settings].[ProductColorsToString]([Product].[ProductID])) as Colors"},
                    new Field {Name = string.Format("(select max ({0}) - min ({0}) from catalog.offer where offer.productid=product.productid) as MultiPrices", _priceField)},
                    new Field {Name = string.Format("(select min ({0}) from catalog.offer where offer.productid=product.productid) as Price", _priceField)},
                });
        }
        else
        {
            _paging.AddFieldsRange(new List<Field>
                {
                    new Field {Name = "null as Colors"},
                    new Field {Name = "0 as MultiPrices"},
                    new Field
                    {
                        Name = SettingsCatalog.UseLastPrice
                            ? string.Format("(CASE WHEN ProductPrice IS NULL THEN {0} ELSE ProductPrice END) as Price", _priceField)
                            : string.Format("{0} as Price", _priceField)
                    },
                });
        }

        _paging.AddParam(new SqlParam { ParameterName = "@CustomerId", Value = CustomerSession.CustomerId.ToString() });
        _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.Product.ToString() });

        ProductsCount = Indepth ? Category.TotalProductsCount : Category.GetProductCount();

        categoryView.CategoryID = _categoryId;
        categoryView.Visible = Category.DisplayStyle == "True" || ProductsCount == 0;
        pnlSort.Visible = ProductsCount > 0;
        productView.Visible = ProductsCount > 0;
        catalogView.CategoryID = _categoryId;

        filterProperty.CategoryId = _categoryId;

        filterBrand.CategoryId = _categoryId;
        filterBrand.InDepth = Indepth;

        filterSize.CategoryId = _categoryId;
        filterSize.InDepth = Indepth;

        filterColor.CategoryId = _categoryId;
        filterColor.InDepth = Indepth;

        filterPrice.CategoryId = _categoryId;
        filterPrice.InDepth = Indepth;

        filterPrice.PriceType = CustomerSession.CurrentCustomer.PriceType;

        lblCategoryName.Text = _categoryId != 0 ? Category.Name : Resource.Client_MasterPage_Catalog;

        breadCrumbs.Items =
            CategoryService.GetParentCategories(_categoryId).Select(parent => new BreadCrumbs
                                                                                  {
                                                                                      Name = parent.Name,
                                                                                      Url = UrlService.GetLink(ParamType.Category, parent.UrlPath, parent.CategoryId)
                                                                                  }).Reverse().ToList();
        breadCrumbs.Items.Insert(0, new BreadCrumbs
                                        {
                                            Name = Resource.Client_MasterPage_MainPage,
                                            Url = UrlService.GetAbsoluteLink("/")
                                        });

        var categoryMeta = SetMeta(Category.Meta, Category.Name, page: paging.CurrentPage);
        lblCategoryName.Text = categoryMeta.H1;

        if (Category.DisplayChildProducts || Indepth)
        {
            var cfilter = new InChildCategoriesFieldFilter
                              {
                                  CategoryId = _categoryId.ToString(),
                                  ParamName = "@CategoryID"
                              };
            _paging.Fields["[ProductCategories].[CategoryID]"].Filter = cfilter;
        }
        else
        {
            var cfilter = new EqualFieldFilter { Value = _categoryId.ToString(), ParamName = "@catalog" };
            _paging.Fields["[ProductCategories].[CategoryID]"].Filter = cfilter;
        }

        _paging.Fields["Enabled"].Filter = new EqualFieldFilter { Value = "1", ParamName = "@enabled" };
        _paging.Fields["CategoryEnabled"].Filter = new EqualFieldFilter { Value = "1", ParamName = "@CategoryEnabled" };

        var logicalFilter = new LogicalFilter{ ParamName = "@Main", HideInCustomData = true };
        logicalFilter.AddFilter(new EqualFieldFilter {Value = "1", ParamName = "@Main1", HideInCustomData = true});
        logicalFilter.AddLogicalOperation("OR");
        logicalFilter.AddFilter(new NullFieldFilter { Null = true, ParamName = "@Main2", HideInCustomData = true });
        _paging.Fields["Offer.Main"].Filter = logicalFilter;

        BuildSorting();
        BuildFilter();
    }
Beispiel #36
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                _paging = new SqlPaging
                {
                    TableName        = @"[Order].[Order] 
                            INNER JOIN [Order].[OrderStatus] ON [Order].[OrderStatusID] = [OrderStatus].[OrderStatusID] 
                            INNER JOIN [Order].[OrderCurrency] ON [Order].[OrderID] = [OrderCurrency].[OrderID] 
                            INNER JOIN [Order].[OrderCustomer] ON [Order].[OrderID] = [OrderCustomer].[OrderID] 
                            LEFT JOIN [Order].[ShippingMethod] ON [Order].[ShippingMethodID] = [ShippingMethod].[ShippingMethodID] 
                            LEFT JOIN [Order].[PaymentMethod] ON [Order].[PaymentMethodID] = [PaymentMethod].[PaymentMethodID]",
                    ItemsPerPage     = 10,
                    CurrentPageIndex = 1
                };

                _paging.AddFieldsRange(new[]
                {
                    new Field {
                        Name = "[Order].OrderID", Sorting = SortDirection.Ascending
                    },
                    new Field {
                        Name = "[Order].OrderDiscount"
                    },
                    new Field {
                        Name = "[OrderStatus].StatusName"
                    },
                    new Field {
                        Name = "[OrderStatus].OrderStatusID"
                    },                                                    // , NotInQuery =true
                    new Field {
                        Name = "[Order].Sum"
                    },
                    new Field {
                        Name = "[Order].OrderDate", Sorting = SortDirection.Descending
                    },
                    new Field {
                        Name = "[Order].ShippingMethod.Name as ShippingMethod"
                    },
                    new Field {
                        Name = "[Order].PaymentMethod.Name as PaymentMethod"
                    },
                    new Field {
                        Name = "[OrderCustomer].FirstName"
                    },
                    new Field {
                        Name = "[OrderCustomer].LastName"
                    },
                    new Field {
                        Name = "[OrderCustomer].CustomerID"
                    },
                    new Field {
                        Name = "[OrderCurrency].CurrencyCode"
                    },
                    new Field {
                        Name = "[OrderCurrency].CurrencyValue"
                    }
                });

                _paging.Fields["[OrderCustomer].CustomerID"].Filter = string.IsNullOrEmpty(Request["customerid"]) ? null : new CompareFieldFilter {
                    Expression = Request["customerid"], ParamName = "@CustomerID"
                };
                //grid.ChangeHeaderImageUrl("arrowSortOrder", "images/arrowup.gif");
                pageNumberer.CurrentPageIndex = 1;
                ViewState["CustomerOrderHistoryAdminPaging"] = _paging;

                ddlOrderStatus.Items.Clear();
                ddlOrderStatus.Items.Add(new ListItem(Resource.Admin_Catalog_Any, "-1"));
                foreach (var status in OrderService.GetOrderStatuses())
                {
                    ddlOrderStatus.Items.Add(status.StatusName);
                }
            }
            else
            {
                _paging = (SqlPaging)(ViewState["CustomerOrderHistoryAdminPaging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

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

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

                _paging.AddFieldsRange(new List<Field>
                    {
                        new Field {Name = "VoiceThemeID as ID", IsDistinct = true},
                        new Field {Name = "PsyID"},
                        new Field {Name = "Name", Sorting = SortDirection.Ascending},
                        new Field {Name = "IsDefault"},
                        new Field {Name = "IsHaveNullVoice"},
                        new Field {Name = "IsClose"},
                        new Field {Name = "DateAdded"},
                        new Field {Name = "DateModify"},
                        new Field {Name= "(SELECT COUNT(*) FROM [Voice].[Answer] WHERE [FKIDTheme] = VoiceThemeID) as AnswerCount" }
                    });

                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();
                    var 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();
                }
            }
        }
Beispiel #38
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();
                }
            }
        }
Beispiel #39
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                _paging = new SqlPaging
                {
                    TableName = "[Catalog].[ShoppingCart] as sc " +
                                "Inner Join [Customers].[Customer] On sc.[CustomerId] = [Customer].[CustomerID] ",
                    ItemsPerPage = 30,
                };

                _paging.AddFieldsRange(new List <Field>
                {
                    new Field {
                        Name = "sc.[CustomerId]", IsDistinct = true
                    },
                    new Field {
                        Name = "ShoppingCartType"
                    },
                    new Field
                    {
                        Name = "(Select top(1) Email From [Customers].[Customer] " +
                               "Where [Customer].[CustomerID] = sc.CustomerId) as Email"
                    },
                    new Field
                    {
                        Name = "(Select top(1) UpdatedOn From [Catalog].[ShoppingCart] " +
                               "Where [ShoppingCart].[CustomerID] = sc.CustomerId and ShoppingCartType = @CartType Order By UpdatedOn Desc) as LastUpdate",
                        Sorting = SortDirection.Descending
                    },
                    new Field
                    {
                        Name = "(Select SUM(Price * [ShoppingCart].[Amount]) " +
                               "From [Catalog].[ShoppingCart] " +
                               "Inner Join [Catalog].[Offer] On [Offer].[OfferID] = [ShoppingCart].[OfferId] " +
                               "Where [ShoppingCart].[CustomerID] = sc.CustomerId and ShoppingCartType = @CartType) As Sum"
                    },
                    new Field
                    {
                        Name = "(Select Count(*) From [Module].[AbandonedCartLetter] " +
                               "Where AbandonedCartLetter.CustomerId = sc.CustomerId) as SendingCount"
                    },
                    new Field
                    {
                        Name = "(Select Top(1)SendingDate From [Module].[AbandonedCartLetter] " +
                               "Where AbandonedCartLetter.CustomerId = sc.CustomerId Order By SendingDate Desc) as SendingDate"
                    },
                });

                _paging.Fields["ShoppingCartType"].Filter = new EqualFieldFilter()
                {
                    ParamName = "@CartType",
                    Value     = ((int)ShoppingCartType.ShoppingCart).ToString()
                };

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

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

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

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    var 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();
                }
            }


            if (!IsPostBack)
            {
                ddlTemplate.Items.Clear();
                ddlTemplate.Items.Add(new ListItem("не выбран", "-1"));
                foreach (var template in AbandonedCartsService.GetTemplates())
                {
                    ddlTemplate.Items.Add(new ListItem(template.Name, template.Id.ToString()));
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _paging = new SqlPaging
                {
                    TableName =
                        "[Catalog].[Product] LEFT JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] inner join Catalog.ProductCategories on ProductCategories.ProductId = [Product].[ProductID] Left JOIN [Catalog].[ProductPropertyValue] ON [Product].[ProductID] = [ProductPropertyValue].[ProductID] LEFT JOIN [Catalog].[ShoppingCart] ON [Catalog].[ShoppingCart].[OfferID] = [Catalog].[Offer].[OfferID] AND [Catalog].[ShoppingCart].[ShoppingCartType] = 3 AND [ShoppingCart].[CustomerID] = @CustomerId Left JOIN [Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=@CustomerId"
                };
            _paging.AddFieldsRange(
                new List<Field>
                    {
                        new Field {Name = "[Product].[ProductID]", IsDistinct = true},
                        //new Field {Name = "PhotoName AS Photo"},
                        new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select Count(PhotoName) From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) ELSE (Select Count(PhotoName) From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) END)  AS CountPhoto"},
                    new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END)  AS Photo"},
                    new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END)  AS PhotoDesc"},

                        new Field {Name = "(select [Settings].[ProductColorsToString]([Product].[ProductID])) as Colors"},
                        //new Field {Name = "[Photo].[Description] AS PhotoDesc"},
                        new Field {Name = "[ProductCategories].[CategoryID]", NotInQuery=true},
                        new Field {Name = "BriefDescription"},
                        new Field {Name = "Product.ArtNo"},
                        new Field {Name = "Name"},
                        new Field {Name = "(CASE WHEN Price=0 THEN 0 ELSE 1 END) as TempSort", Sorting=SortDirection.Descending},
                        new Field {Name = "Recomended"},
                        new Field {Name = "Bestseller"},
                        new Field {Name = "New"},
                        new Field {Name = "OnSale"},
                        new Field {Name = "Discount"},
                        new Field {Name = "Offer.Main", NotInQuery=true},
                        new Field {Name = "Offer.OfferID"},
                        new Field {Name = "Offer.Amount"},
                        new Field {Name = "(CASE WHEN Offer.Amount=0 OR Offer.Amount < IsNull(MinAmount,0) THEN 0 ELSE 1 END) as TempAmountSort", Sorting=SortDirection.Descending},
                        new Field {Name = "MinAmount"},
                        new Field {Name = "MaxAmount"},
                        new Field {Name = "Enabled"},
                        new Field {Name = "AllowPreOrder"},
                        new Field {Name = "Ratio"},
                        new Field {Name = "RatioID"},
                        new Field {Name = "DateModified"},
                        new Field {Name = "ShoppingCartItemId"},
                        new Field {Name = "UrlPath"},
                        new Field {Name = "[ProductCategories].[SortOrder]"},
                        new Field {Name = "[ShoppingCart].[CustomerID]", NotInQuery=true},
                        new Field {Name = "BrandID", NotInQuery=true},
                        new Field {Name = "Offer.ProductID as Size_ProductID", NotInQuery=true},
                        new Field {Name = "Offer.ProductID as Color_ProductID", NotInQuery=true},
                        new Field {Name = "Offer.ProductID as Price_ProductID", NotInQuery=true},
                        new Field {Name = "Offer.ColorID"},
                        new Field {Name = "CategoryEnabled", NotInQuery=true},
                    });

            if (SettingsCatalog.ComplexFilter)
            {
                _paging.AddFieldsRange(new List<Field>
                    {
                        new Field {Name = "(select max (price) - min (price) from catalog.offer where offer.productid=product.productid) as MultiPrices"},
                        new Field {Name = "(select min (price) from catalog.offer where offer.productid=product.productid) as Price"},
                    });
            }
            else
            {
                _paging.AddFieldsRange(new List<Field>
                    {
                        new Field {Name = "0 as MultiPrices"},
                        new Field {Name = "Price"},
                    });
            }

            _paging.AddParam(new SqlParam { ParameterName = "@CustomerId", Value = CustomerSession.CustomerId.ToString() });
            _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.Product.ToString() });

            if (string.IsNullOrEmpty(Request["categoryid"]) || !Int32.TryParse(Request["categoryid"], out _categoryId))
            {
                _categoryId = 0;

                var sbMainPage = StaticBlockService.GetPagePartByKeyWithCache("MainPageSocial");
                if (sbMainPage != null && sbMainPage.Enabled)
                    MainPageText = sbMainPage.Content;
            }

            if (!string.IsNullOrEmpty(MainPageText))
            {
                SetMeta(null, string.Empty);
                return;
            }

            category = CategoryService.GetCategory(_categoryId);
            if (category == null || category.Enabled == false || category.ParentsEnabled == false)
            {
                Error404();
                return;
            }

            ProductsCount = category.GetProductCount();

            categoryView.CategoryID = _categoryId;
            categoryView.Visible = true;
            pnlSort.Visible = ProductsCount > 0;
            productView.Visible = ProductsCount > 0;

            lblCategoryName.Text = _categoryId != 0 ? category.Name : Resource.Client_MasterPage_Catalog;
            //lblCategoryDescription.Text = category.Description;

            //imgCategoryImage.ImageUrl = string.IsNullOrEmpty(category.Picture) ? "" : string.Format("{0}", ImageFolders.GetImageCategoryPath(false, category.Picture));

            breadCrumbs.Items =
                CategoryService.GetParentCategories(_categoryId).Select(parent => new BreadCrumbs
                    {
                        Name = parent.Name,
                        Url = "social/catalogsocial.aspx?categoryid=" + parent.CategoryId
                    }).Reverse().ToList();
            breadCrumbs.Items.Insert(0, new BreadCrumbs
                {
                    Name = Resource.Client_MasterPage_MainPage,
                    Url = UrlService.GetAbsoluteLink("social/catalogsocial.aspx")
                });

            SetMeta(category.Meta, category.Name);

            if (category.DisplayChildProducts)
            {
                var cfilter = new InChildCategoriesFieldFilter
                    {
                        CategoryId = _categoryId.ToString(),
                        ParamName = "@CategoryID"
                    };
                _paging.Fields["[ProductCategories].[CategoryID]"].Filter = cfilter;
            }
            else
            {
                var cfilter = new EqualFieldFilter { Value = _categoryId.ToString(), ParamName = "@catalog" };
                _paging.Fields["[ProductCategories].[CategoryID]"].Filter = cfilter;
            }

            _paging.Fields["Enabled"].Filter = new EqualFieldFilter { Value = "1", ParamName = "@enabled" }; ;
            _paging.Fields["CategoryEnabled"].Filter = new EqualFieldFilter { Value = "1", ParamName = "@CategoryEnabled" };

            var logicalFilter = new LogicalFilter { ParamName = "@Main", HideInCustomData = true };
            logicalFilter.AddFilter(new EqualFieldFilter { Value = "1", ParamName = "@Main1", HideInCustomData = true });
            logicalFilter.AddLogicalOperation("OR");
            logicalFilter.AddFilter(new NullFieldFilter { Null = true, ParamName = "@Main2", HideInCustomData = true });
            _paging.Fields["Offer.Main"].Filter = logicalFilter;

            BuildSorting();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _paging = new SqlPaging
            {
                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] Left JOIN [Catalog].[ProductPropertyValue] ON [Product].[ProductID] = [ProductPropertyValue].[ProductID] LEFT JOIN [Catalog].[ShoppingCart] ON [Catalog].[ShoppingCart].[OfferId] = [Catalog].[Offer].[OfferID] AND [Catalog].[ShoppingCart].[ShoppingCartType] = 3 AND [ShoppingCart].[CustomerID] = @CustomerId Left JOIN [Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=@CustomerId"
            };
            _paging.AddParam(new SqlParam {
                ParameterName = "@CustomerId", Value = CustomerContext.CustomerId.ToString()
            });
            _paging.AddParam(new SqlParam {
                ParameterName = "@Type", Value = PhotoType.Product.ToString()
            });

            _paging.AddFieldsRange(
                new List <Field>
            {
                new Field {
                    Name = "[Product].[ProductID]", IsDistinct = true
                },
                new Field {
                    Name = "(CASE WHEN Offer.ColorID is not null THEN (Select Count(PhotoName) From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) ELSE (Select Count(PhotoName) From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) END)  AS CountPhoto"
                },
                new Field {
                    Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END)  AS Photo"
                },
                new Field {
                    Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END)  AS PhotoDesc"
                },
                new Field {
                    Name = "[ProductCategories].[CategoryID]", NotInQuery = true
                },
                new Field {
                    Name = "BriefDescription"
                },
                new Field {
                    Name = "Product.ArtNo"
                },
                new Field {
                    Name = "Name"
                },

                new Field {
                    Name = "Recomended"
                },
                new Field {
                    Name = "Bestseller"
                },
                new Field {
                    Name = "New"
                },
                new Field {
                    Name = "OnSale"
                },
                new Field {
                    Name = "Discount"
                },
                new Field {
                    Name = "Offer.Main", NotInQuery = true
                },
                new Field {
                    Name = "Offer.OfferID"
                },
                new Field {
                    Name = "Offer.Amount"
                },
                new Field {
                    Name = "(CASE WHEN Offer.Amount=0 OR Offer.Amount < IsNull(MinAmount,0) THEN 0 ELSE 1 END) as TempAmountSort", Sorting = SortDirection.Descending
                },
                new Field {
                    Name = "MinAmount"
                },
                new Field {
                    Name = "MaxAmount"
                },
                new Field {
                    Name = "Enabled"
                },
                new Field {
                    Name = "AllowPreOrder"
                },
                new Field {
                    Name = "Ratio"
                },
                new Field {
                    Name = "RatioID"
                },
                new Field {
                    Name = "DateModified"
                },
                new Field {
                    Name = "ShoppingCartItemId"
                },
                new Field {
                    Name = "UrlPath"
                },

                new Field {
                    Name = "[ShoppingCart].[CustomerID]", NotInQuery = true
                },
                new Field {
                    Name = "BrandID", NotInQuery = true
                },
                new Field {
                    Name = "Offer.ProductID as Size_ProductID", NotInQuery = true
                },
                new Field {
                    Name = "Offer.ProductID as Color_ProductID", NotInQuery = true
                },
                new Field {
                    Name = "Offer.ProductID as Price_ProductID", NotInQuery = true
                },
                new Field {
                    Name = "Offer.ColorID"
                },
                new Field {
                    Name = "CategoryEnabled", NotInQuery = true
                },
                new Field {
                    Name = "null as AdditionalPhoto"
                }
            });

            if (SettingsCatalog.ComplexFilter)
            {
                _paging.AddFieldsRange(new List <Field>
                {
                    new Field {
                        Name = "(select [Settings].[ProductColorsToString]([Product].[ProductID])) as Colors"
                    },
                    new Field {
                        Name = "(select max (price) - min (price) from catalog.offer where offer.productid=product.productid) as MultiPrices"
                    },
                    new Field {
                        Name = "(select min (price) from catalog.offer where offer.productid=product.productid) as Price"
                    },
                });
            }
            else
            {
                _paging.AddFieldsRange(new List <Field>
                {
                    new Field {
                        Name = "null as Colors"
                    },
                    new Field {
                        Name = "0 as MultiPrices"
                    },
                    new Field {
                        Name = "Price"
                    },
                });
            }

            _paging.Fields["[Product].[ProductID]"].Filter = new CountProductInCategory();
            _paging.Fields["Enabled"].Filter = new EqualFieldFilter {
                ParamName = "@enabled", Value = "1"
            };
            _paging.Fields["CategoryEnabled"].Filter = new EqualFieldFilter {
                ParamName = "@CategoryEnabled", Value = "1"
            };

            BuildSorting();
            BuildFilter();

            SetMeta(null, string.Empty);
            txtName.Focus();
        }
Beispiel #42
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _priceField = CustomerSession.CurrentCustomer.PriceType.ToString();

            _paging = new SqlPaging
                {
                    TableName =
                        "[Catalog].[Product] " +
                        "LEFT JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] and [Offer].Main = 1 " +
                        "LEFT JOIN [Catalog].[ShoppingCart] ON [Catalog].[ShoppingCart].[OfferID] = [Catalog].[Offer].[OfferID] AND [Catalog].[ShoppingCart].[ShoppingCartType] = 3 AND [ShoppingCart].[CustomerID] = @CustomerId  " +
                        "Left JOIN [Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=@CustomerId " +
                        "LEFT JOIN [Customers].[LastPrice] ON [LastPrice].[ProductId] = [Product].[ProductId] AND [LastPrice].[CustomerId] = @CustomerId"
                };

            _paging.AddFieldsRange(
                new List<Field>()
                    {
                        new Field {Name = "[Product].[ProductID] as ProductID", IsDistinct = true},
                        new Field {Name = "null AS AdditionalPhoto"},
                        new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select Count(PhotoName) From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) ELSE (Select Count(PhotoName) From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) END)  AS CountPhoto"},
                        new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END)  AS Photo"},
                        new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END)  AS PhotoDesc"},
                        new Field {Name = "BriefDescription"},
                        new Field {Name = "Product.ArtNo"},
                        new Field {Name = "Name"},
                        new Field
                        {
                            Name = SettingsCatalog.UseLastPrice
                            ? string.Format("(CASE WHEN ProductPrice IS NULL THEN {0} ELSE ProductPrice END) as Price", _priceField)
                            : string.Format("{0} as Price", _priceField)
                        },
                        new Field {Name = string.Format("{0} - {0}*discount/100 as discountPrice", _priceField), NotInQuery = true},
                        new Field {Name = "0 as MultiPrices"},
                        new Field {Name = "Recomended"},
                        new Field {Name = "New"},
                        new Field {Name = "Bestseller"},
                        new Field {Name = "OnSale"},
                        new Field {Name = "Discount"},
                        new Field {Name = "UrlPath"},
                        new Field {Name = "[Offer].Amount"},
                        new Field {Name = "Offer.Main", NotInQuery = true},
                        new Field {Name = "Offer.OfferID"},
                        new Field {Name = "MinAmount"},
                        new Field {Name = "MaxAmount"},
                        new Field {Name = "Multiplicity"},
                        new Field {Name = "Enabled"},
                        new Field {Name = "ShoppingCartItemId"},
                        new Field {Name = "AllowPreOrder"},
                        new Field {Name = "Ratio"},
                        new Field {Name = "RatioID"},
                        new Field {Name = "DateModified"},
                        new Field {Name = "[ShoppingCart].[CustomerID]", NotInQuery = true},
                        new Field {Name = "BrandID", NotInQuery = true},
                        new Field {Name = "CategoryEnabled", NotInQuery = true},
                        new Field {Name = "Offer.ColorID as ColorID"},
                        new Field
                            {
                                Name = "(select [Settings].[ProductColorsToString]([Product].[ProductID])) as Colors"
                            }
                    });

            _paging.AddParam(new SqlParam { ParameterName = "@CustomerId", Value = CustomerSession.CustomerId.ToString() });
            _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.Product.ToString() });

            if (string.IsNullOrEmpty(Request["type"]) || !Enum.TryParse(Request["type"], true, out _typeFlag) ||
                _typeFlag == ProductOnMain.TypeFlag.None)
            {
                Error404();
            }

            ProductsCount = ProductOnMain.GetProductCountByType(_typeFlag);
            pnlSort.Visible = ProductsCount > 0;
            productView.Visible = ProductsCount > 0;

            filterBrand.CategoryId = 0;
            filterBrand.InDepth = true;
            filterBrand.WorkType = _typeFlag;

            filterPrice.CategoryId = 0;
            filterPrice.InDepth = true;

            _paging.Fields["CategoryEnabled"].Filter = new EqualFieldFilter
                {
                    Value = "1",
                    ParamName = "@CategoryEnabled"
                };
            _paging.Fields["Enabled"].Filter = new EqualFieldFilter {Value = "1", ParamName = "@Enabled"};

            if (_typeFlag == ProductOnMain.TypeFlag.Bestseller)
            {
                var filterB = new EqualFieldFilter {ParamName = "@Bestseller", Value = "1"};
                _paging.Fields["Bestseller"].Filter = filterB;
                _paging.Fields.Add(new KeyValuePair<string, Field>("SortBestseller",
                                                                   new Field {Name = "SortBestseller as Sort"}));
                PageName = Resource.Client_ProductList_AllBestSellers;

                SetMeta(
                    new AdvantShop.SEO.MetaInfo(SettingsMain.ShopName + " - " + Resource.Client_Bestsellers_Header),
                    string.Empty);
            }
            if (_typeFlag == ProductOnMain.TypeFlag.New)
            {
                var filterN = new EqualFieldFilter {ParamName = "@New", Value = "1"};
                _paging.Fields["New"].Filter = filterN;
                _paging.Fields.Add(new KeyValuePair<string, Field>("SortNew", new Field {Name = "SortNew as Sort"}));
                PageName = Resource.Client_ProductList_AllNew;

                SetMeta(new AdvantShop.SEO.MetaInfo(SettingsMain.ShopName + " - " + Resource.Client_New_Header),
                        string.Empty);
            }
            if (_typeFlag == ProductOnMain.TypeFlag.Discount)
            {
                var filterN = new NotEqualFieldFilter() {ParamName = "@Discount", Value = "0"};
                _paging.Fields["Discount"].Filter = filterN;
                _paging.Fields.Add(new KeyValuePair<string, Field>("SortDiscount",
                                                                   new Field {Name = "SortDiscount as Sort"}));
                PageName = Resource.Client_ProductList_AllDiscount;

                SetMeta(new AdvantShop.SEO.MetaInfo(SettingsMain.ShopName + " - " + Resource.Client_Discount_Header),
                        string.Empty);
            }

            breadCrumbs.Items.AddRange(new BreadCrumbs[]
                {
                    new BreadCrumbs()
                        {
                            Name = Resource.Client_MasterPage_MainPage,
                            Url = UrlService.GetAbsoluteLink("/")
                        },
                    new BreadCrumbs() {Name = PageName, Url = null}
                });

            BuildSorting();
            BuildFilter();
        }
Beispiel #43
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = 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 = "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;
            }
        }
    }
Beispiel #44
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _paging = new SqlPaging
            {
                TableName =
                    "[Catalog].[Product] LEFT JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] inner join Catalog.ProductCategories on ProductCategories.ProductId = [Product].[ProductID] Left JOIN [Catalog].[ProductPropertyValue] ON [Product].[ProductID] = [ProductPropertyValue].[ProductID] LEFT JOIN [Catalog].[ShoppingCart] ON [Catalog].[ShoppingCart].[OfferID] = [Catalog].[Offer].[OfferID] AND [Catalog].[ShoppingCart].[ShoppingCartType] = 3 AND [ShoppingCart].[CustomerID] = @CustomerId Left JOIN [Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=@CustomerId"
            };
            _paging.AddFieldsRange(
                new List <Field>
            {
                new Field {
                    Name = "[Product].[ProductID]", IsDistinct = true
                },
                //new Field {Name = "PhotoName AS Photo"},
                new Field {
                    Name = "(CASE WHEN Offer.ColorID is not null THEN (Select Count(PhotoName) From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) ELSE (Select Count(PhotoName) From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) END)  AS CountPhoto"
                },
                new Field {
                    Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END)  AS Photo"
                },
                new Field {
                    Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END)  AS PhotoDesc"
                },

                new Field {
                    Name = "(select [Settings].[ProductColorsToString]([Product].[ProductID])) as Colors"
                },
                //new Field {Name = "[Photo].[Description] AS PhotoDesc"},
                new Field {
                    Name = "[ProductCategories].[CategoryID]", NotInQuery = true
                },
                new Field {
                    Name = "BriefDescription"
                },
                new Field {
                    Name = "Product.ArtNo"
                },
                new Field {
                    Name = "Name"
                },
                new Field {
                    Name = "(CASE WHEN Price=0 THEN 0 ELSE 1 END) as TempSort", Sorting = SortDirection.Descending
                },
                new Field {
                    Name = "Recomended"
                },
                new Field {
                    Name = "Bestseller"
                },
                new Field {
                    Name = "New"
                },
                new Field {
                    Name = "OnSale"
                },
                new Field {
                    Name = "Discount"
                },
                new Field {
                    Name = "Offer.Main", NotInQuery = true
                },
                new Field {
                    Name = "Offer.OfferID"
                },
                new Field {
                    Name = "Offer.Amount"
                },
                new Field {
                    Name = "(CASE WHEN Offer.Amount=0 OR Offer.Amount < IsNull(MinAmount,0) THEN 0 ELSE 1 END) as TempAmountSort", Sorting = SortDirection.Descending
                },
                new Field {
                    Name = "MinAmount"
                },
                new Field {
                    Name = "MaxAmount"
                },
                new Field {
                    Name = "Enabled"
                },
                new Field {
                    Name = "AllowPreOrder"
                },
                new Field {
                    Name = "Ratio"
                },
                new Field {
                    Name = "RatioID"
                },
                new Field {
                    Name = "DateModified"
                },
                new Field {
                    Name = "ShoppingCartItemId"
                },
                new Field {
                    Name = "UrlPath"
                },
                new Field {
                    Name = "[ProductCategories].[SortOrder]"
                },
                new Field {
                    Name = "[ShoppingCart].[CustomerID]", NotInQuery = true
                },
                new Field {
                    Name = "BrandID", NotInQuery = true
                },
                new Field {
                    Name = "Offer.ProductID as Size_ProductID", NotInQuery = true
                },
                new Field {
                    Name = "Offer.ProductID as Color_ProductID", NotInQuery = true
                },
                new Field {
                    Name = "Offer.ProductID as Price_ProductID", NotInQuery = true
                },
                new Field {
                    Name = "Offer.ColorID"
                },
                new Field {
                    Name = "CategoryEnabled", NotInQuery = true
                },
            });

            if (SettingsCatalog.ComplexFilter)
            {
                _paging.AddFieldsRange(new List <Field>
                {
                    new Field {
                        Name = "(select max (price) - min (price) from catalog.offer where offer.productid=product.productid) as MultiPrices"
                    },
                    new Field {
                        Name = "(select min (price) from catalog.offer where offer.productid=product.productid) as Price"
                    },
                });
            }
            else
            {
                _paging.AddFieldsRange(new List <Field>
                {
                    new Field {
                        Name = "0 as MultiPrices"
                    },
                    new Field {
                        Name = "Price"
                    },
                });
            }

            _paging.AddParam(new SqlParam {
                ParameterName = "@CustomerId", Value = CustomerContext.CustomerId.ToString()
            });
            _paging.AddParam(new SqlParam {
                ParameterName = "@Type", Value = PhotoType.Product.ToString()
            });

            if (string.IsNullOrEmpty(Request["categoryid"]) || !Int32.TryParse(Request["categoryid"], out _categoryId))
            {
                _categoryId = 0;

                var sbMainPage = StaticBlockService.GetPagePartByKeyWithCache("MainPageSocial");
                if (sbMainPage != null && sbMainPage.Enabled)
                {
                    MainPageText = sbMainPage.Content;
                }
            }

            if (!string.IsNullOrEmpty(MainPageText))
            {
                SetMeta(null, string.Empty);
                return;
            }

            category = CategoryService.GetCategory(_categoryId);
            if (category == null || category.Enabled == false || category.ParentsEnabled == false)
            {
                Error404();
                return;
            }

            ProductsCount = category.GetProductCount();

            categoryView.CategoryID = _categoryId;
            categoryView.Visible    = true;
            pnlSort.Visible         = ProductsCount > 0;
            productView.Visible     = ProductsCount > 0;

            lblCategoryName.Text = _categoryId != 0 ? category.Name : Resource.Client_MasterPage_Catalog;
            //lblCategoryDescription.Text = category.Description;

            //imgCategoryImage.ImageUrl = string.IsNullOrEmpty(category.Picture) ? "" : string.Format("{0}", ImageFolders.GetImageCategoryPath(false, category.Picture));

            breadCrumbs.Items =
                CategoryService.GetParentCategories(_categoryId).Select(parent => new BreadCrumbs
            {
                Name = parent.Name,
                Url  = "social/catalogsocial.aspx?categoryid=" + parent.CategoryId
            }).Reverse().ToList();
            breadCrumbs.Items.Insert(0, new BreadCrumbs
            {
                Name = Resource.Client_MasterPage_MainPage,
                Url  = UrlService.GetAbsoluteLink("social/catalogsocial.aspx")
            });

            SetMeta(category.Meta, category.Name);

            if (category.DisplayChildProducts)
            {
                var cfilter = new InChildCategoriesFieldFilter
                {
                    CategoryId = _categoryId.ToString(),
                    ParamName  = "@CategoryID"
                };
                _paging.Fields["[ProductCategories].[CategoryID]"].Filter = cfilter;
            }
            else
            {
                var cfilter = new EqualFieldFilter {
                    Value = _categoryId.ToString(), ParamName = "@catalog"
                };
                _paging.Fields["[ProductCategories].[CategoryID]"].Filter = cfilter;
            }

            _paging.Fields["Enabled"].Filter = new EqualFieldFilter {
                Value = "1", ParamName = "@enabled"
            };;
            _paging.Fields["CategoryEnabled"].Filter = new EqualFieldFilter {
                Value = "1", ParamName = "@CategoryEnabled"
            };

            var logicalFilter = new LogicalFilter {
                ParamName = "@Main", HideInCustomData = true
            };

            logicalFilter.AddFilter(new EqualFieldFilter {
                Value = "1", ParamName = "@Main1", HideInCustomData = true
            });
            logicalFilter.AddLogicalOperation("OR");
            logicalFilter.AddFilter(new NullFieldFilter {
                Null = true, ParamName = "@Main2", HideInCustomData = true
            });
            _paging.Fields["Offer.Main"].Filter = logicalFilter;

            BuildSorting();
        }
Beispiel #45
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_MenuManager_TopMenu);

        Int32.TryParse(Request["menuid"], out _menuId);
        _needReloadTree = Convert.ToBoolean(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:
            //_menuType = 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:
            //_menuType = 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)
        {
            if (_menuType == MenuService.EMenuType.Top)
            {
                _paging = new SqlPaging
                {
                    TableName    = "[CMS].[MainMenu]",
                    ItemsPerPage = 10
                };
            }
            else if (_menuType == MenuService.EMenuType.Bottom)
            {
                _paging = new SqlPaging
                {
                    TableName    = "[CMS].[BottomMenu]",
                    ItemsPerPage = 10
                };
            }

            _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 = Convert.ToInt32(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();
            }
        }
    }
Beispiel #46
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();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                _paging = new SqlPaging
                    {
                        TableName = @"[Order].[Order]
                            INNER JOIN [Order].[OrderStatus] ON [Order].[OrderStatusID] = [OrderStatus].[OrderStatusID]
                            INNER JOIN [Order].[OrderCurrency] ON [Order].[OrderID] = [OrderCurrency].[OrderID]
                            INNER JOIN [Order].[OrderCustomer] ON [Order].[OrderID] = [OrderCustomer].[OrderID]
                            INNER JOIN [Order].[ShippingMethod] ON [Order].[ShippingMethodID] = [ShippingMethod].[ShippingMethodID]
                            INNER JOIN [Order].[PaymentMethod] ON [Order].[PaymentMethodID] = [PaymentMethod].[PaymentMethodID]",
                        ItemsPerPage = 10,
                        CurrentPageIndex = 1
                    };

                _paging.AddFieldsRange(new[]
                    {
                        new Field {Name = "[Order].OrderID", Sorting=SortDirection.Ascending  },
                        new Field {Name = "[Order].OrderDiscount"},
                        new Field {Name = "[OrderStatus].StatusName"},
                        new Field {Name = "[OrderStatus].OrderStatusID"}, // , NotInQuery =true
                        new Field {Name = "[Order].Sum"},
                        new Field {Name = "[Order].OrderDate"},
                        new Field {Name = "[Order].ShippingMethod.Name as ShippingMethod"},
                        new Field {Name = "[Order].PaymentMethod.Name as PaymentMethod"},
                        new Field {Name = "[OrderCustomer].FirstName"},
                        new Field {Name = "[OrderCustomer].LastName"},
                        new Field {Name = "[OrderCustomer].CustomerID"},
                        new Field {Name = "[OrderCurrency].CurrencyCode"},
                        new Field {Name = "[OrderCurrency].CurrencyValue"}
                    });

                _paging.Fields["[OrderCustomer].CustomerID"].Filter = string.IsNullOrEmpty(Request["customerid"]) ? null : new CompareFieldFilter { Expression = Request["customerid"], ParamName = "@CustomerID" };
                //grid.ChangeHeaderImageUrl("arrowSortOrder", "images/arrowup.gif");
                pageNumberer.CurrentPageIndex = 1;
                ViewState["CustomerOrderHistoryAdminPaging"] = _paging;

                ddlOrderStatus.Items.Clear();
                ddlOrderStatus.Items.Add(new ListItem(Resource.Admin_Catalog_Any, "-1"));
                foreach (var status in OrderService.GetOrderStatuses())
                {
                    ddlOrderStatus.Items.Add(status.StatusName);
                }
            }
            else
            {
                _paging = (SqlPaging)(ViewState["CustomerOrderHistoryAdminPaging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }
            }
        }
        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;
                }
            }
        }
Beispiel #49
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();
                }
            }
        }
Beispiel #50
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MsgErr(true);
        Page.Title = string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_OrderSearch_SubHeader);

        if (!IsPostBack)
        {
            FillStatusFilter();
            FillPaymentMethodFilter();
            FillShippingMethodFilter();

            _paging = new SqlPaging
            {
                TableName =
                    @"[Order].[Order] 
                                        JOIN [Order].[OrderCustomer] ON [Order].[OrderID]=[OrderCustomer].[OrderID] 
                                        LEFT JOIN [Order].[OrderStatus] ON [OrderStatus].[OrderStatusID]=[Order].[OrderStatusID] 
                                        JOIN [Order].[OrderCurrency] ON [Order].[OrderID] = [OrderCurrency].[OrderID]
                                        JOIN [Order].[OrderContact] ON [Order].[BillingContactID] = [OrderContact].[OrderContactID]
                                        LEFT JOIN [Order].[PaymentMethod] ON [Order].[PaymentMethodID] = [Order].[PaymentMethod].[PaymentMethodID]
                                        LEFT JOIN [Order].[ShippingMethod] ON [Order].[ShippingMethodID] = [Order].[ShippingMethod].ShippingMethodID",
                ItemsPerPage = 10
            };

            _paging.AddFieldsRange(
                new Field("[Order].OrderID as ID")
            {
                IsDistinct = true, Sorting = SortDirection.Descending
            },
                new Field("StatusName"),
                new Field("PaymentDate"),
                new Field("PaymentMethodName"),
                new Field("ShippingMethodName"),
                new Field("FirstName + ' ' + LastName as BuyerName"),
                new Field("OrderContact.Name as BillingName"),
                new Field("PaymentMethod.Name as PaymentMethod"),
                new Field("ShippingMethod.Name as ShippingMethod"),
                new Field("Sum"),
                new Field("OrderDate"),
                new Field("CurrencyValue"),
                new Field("CurrencyCode"),
                new Field("CustomerID"));


            _paging.ItemsPerPage = 10;

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

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

            if (Request["filter"] != null)
            {
                if (Request["filter"] == "lastmonth")
                {
                    txtDateFrom.Text = DateTime.Now.Date.AddDays(-1).ToString("dd.MM.yyyy");
                    txtDateTo.Text   = DateTime.Now.Date.AddMonths(1).ToString("dd.MM.yyyy");
                }
                if (Request["filter"] == "today")
                {
                    txtDateFrom.Text = DateTime.Now.Date.ToString("dd.MM.yyyy");
                    txtDateTo.Text   = DateTime.Now.Date.ToString("dd.MM.yyyy");
                }
                if (Request["filter"] == "yesterday")
                {
                    txtDateFrom.Text = DateTime.Now.Date.AddDays(-1).ToString("dd.MM.yyyy");
                    txtDateTo.Text   = DateTime.Now.Date.AddDays(-1).ToString("dd.MM.yyyy");
                }
                btnFilter_Click(sender, e);
            }

            ddlStatus.DataBind();
        }
        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++)
                {
                    var t = arrids[idx];
                    if (t.Replace(" ", "") != "-1")
                    {
                        ids[idx] = t;
                    }
                    else
                    {
                        _selectionFilter.IncludeValues = false;
                        _inverseSelection = true;
                    }
                }

                _selectionFilter.Values = ids;
            }
        }

        if (!IsPostBack && !string.IsNullOrEmpty(Request["status"]))
        {
            ddlStatusName.SelectedValue = Request["status"].ToLower();
            btnFilter_Click(new object(), new EventArgs());
        }
    }
Beispiel #51
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _paging = new SqlPaging
                {
                    TableName =
                        "[Catalog].[Product] 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 inner join Catalog.ProductCategories on ProductCategories.ProductId = [Product].[ProductID] Left JOIN [Catalog].[ProductPropertyValue] ON [Product].[ProductID] = [ProductPropertyValue].[ProductID] LEFT JOIN [Catalog].[ShoppingCart] ON [Catalog].[ShoppingCart].[OfferId] = [Catalog].[Offer].[OfferID] AND [Catalog].[ShoppingCart].[ShoppingCartType] = 3 AND [ShoppingCart].[CustomerID] = @CustomerId Left JOIN [Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=@CustomerId"
                };
            _paging.AddParam(new SqlParam { ParameterName = "@CustomerId", Value = CustomerSession.CustomerId.ToString() });
            _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.Product.ToString() });

            _paging.AddFieldsRange(
                new List<Field>
                    {
                       new Field {Name = "[Product].[ProductID]", IsDistinct = true},
                        new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select Count(PhotoName) From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) ELSE (Select Count(PhotoName) From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) END)  AS CountPhoto"},
                        new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END)  AS Photo"},
                        new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END)  AS PhotoDesc"},
                        new Field {Name = "[ProductCategories].[CategoryID]", NotInQuery=true},
                        new Field {Name = "BriefDescription"},
                        new Field {Name = "Product.ArtNo"},
                        new Field {Name = "Name"},

                        new Field {Name = "Recomended"},
                        new Field {Name = "Bestseller"},
                        new Field {Name = "New"},
                        new Field {Name = "OnSale"},
                        new Field {Name = "Discount"},
                        new Field {Name = "Offer.Main", NotInQuery=true},
                        new Field {Name = "Offer.OfferID"},
                        new Field {Name = "Offer.Amount"},
                        new Field {Name = "(CASE WHEN Offer.Amount=0 OR Offer.Amount < IsNull(MinAmount,0) THEN 0 ELSE 1 END) as TempAmountSort", Sorting=SortDirection.Descending},
                        new Field {Name = "MinAmount"},
                        new Field {Name = "MaxAmount"},
                        new Field {Name = "Enabled"},
                        new Field {Name = "AllowPreOrder"},
                        new Field {Name = "Ratio"},
                        new Field {Name = "RatioID"},
                        new Field {Name = "DateModified"},
                        new Field {Name = "ShoppingCartItemId"},
                        new Field {Name = "UrlPath"},

                        new Field {Name = "[ShoppingCart].[CustomerID]", NotInQuery=true},
                        new Field {Name = "BrandID", NotInQuery=true},
                        new Field {Name = "Offer.ProductID as Size_ProductID", NotInQuery=true},
                        new Field {Name = "Offer.ProductID as Color_ProductID", NotInQuery=true},
                        new Field {Name = "Offer.ProductID as Price_ProductID", NotInQuery=true},
                        new Field {Name = "Offer.ColorID"},
                        new Field {Name = "CategoryEnabled", NotInQuery=true},
                        new Field {Name = "null as AdditionalPhoto"}
                    });

            if (SettingsCatalog.ComplexFilter)
            {
                _paging.AddFieldsRange(new List<Field>
                {
                    new Field {Name = "(select [Settings].[ProductColorsToString]([Product].[ProductID])) as Colors"},
                    new Field {Name = "(select max (price) - min (price) from catalog.offer where offer.productid=product.productid) as MultiPrices"},
                    new Field {Name = "(select min (price) from catalog.offer where offer.productid=product.productid) as Price"},
                });
            }
            else
            {
                _paging.AddFieldsRange(new List<Field>
                {
                    new Field {Name = "null as Colors"},
                    new Field {Name = "0 as MultiPrices"},
                    new Field {Name = "Price"},
                });
            }

            _paging.Fields["[Product].[ProductID]"].Filter = new CountProductInCategory();
            _paging.Fields["Enabled"].Filter = new EqualFieldFilter { ParamName = "@enabled", Value = "1" };
            _paging.Fields["CategoryEnabled"].Filter = new EqualFieldFilter { ParamName = "@CategoryEnabled", Value = "1" };

            BuildSorting();
            BuildFilter();

            SetMeta(null, string.Empty);
            txtName.Focus();
        }
Beispiel #52
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_StaticPage_lblSubMain));

            int.TryParse(Request["parentid"], out _parentPageId);
            if (!IsPostBack)
            {
                _paging = new SqlPaging
                {
                    TableName    = "[CMS].[StaticPage]",
                    ItemsPerPage = 10
                };

                _paging.AddFieldsRange(new List <Field>
                {
                    new Field {
                        Name = "StaticPageID as ID", IsDistinct = true
                    },
                    new Field {
                        Name = "PageName"
                    },
                    new Field {
                        Name = "Enabled"
                    },
                    new Field {
                        Name = "ParentID"
                    },
                    new Field {
                        Name = "SortOrder", Sorting = SortDirection.Ascending
                    },
                    new Field {
                        Name = "ModifyDate"
                    }
                });


                if (_parentPageId != 0)
                {
                    var ef = new EqualFieldFilter()
                    {
                        ParamName = "@ParentID",
                        Value     = _parentPageId.ToString(CultureInfo.InvariantCulture)
                    };

                    _paging.Fields["ParentID"].Filter = ef;
                }
                else
                {
                    var nf = new NullFieldFilter()
                    {
                        ParamName = "@ParentID",
                        Null      = true
                    };

                    _paging.Fields["ParentID"].Filter = nf;
                }



                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();
                    var 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();
                }
            }
        }
        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].[PropertyValue]",
                        ItemsPerPage = 50,
                        CurrentPageIndex = 1
                    };

                _paging.AddFieldsRange(new[]
                    {
                        new Field {Name = "PropertyValueID as ID"},
                        new Field {Name = "PropertyID"},
                        new Field {Name = "Value"},
                        new Field {Name = "SortOrder", Sorting = SortDirection.Ascending},
                        new Field {Name = "(Select Count(ProductID) from Catalog.ProductPropertyValue Where propertyValueid=[PropertyValue].propertyValueid) as ProductsCount"},
                    });

                if (!String.IsNullOrEmpty(Request["propertyid"]))
                {
                    int propertyId = 0;
                    Property prop = null;
                    if (int.TryParse(Request["propertyid"], out propertyId))
                    {
                        prop = PropertyService.GetPropertyById(propertyId);

                    }
                    if (prop != null)
                    {
                        lblHead.Text += string.Format(" - \"{0}\"", prop.Name);

                        var ef = new EqualFieldFilter
                            {
                                ParamName = "@PropertyID",
                                Value = propertyId.ToString(CultureInfo.InvariantCulture)
                            };
                        _paging.Fields["PropertyID"].Filter = ef;
                    }
                    else
                    {
                        Response.Redirect("Properties.aspx");
                    }
                }
                else
                    Response.Redirect("Properties.aspx");

                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;
                }
            }
        }