Beispiel #1
0
 private string CreatePath(int ParentId, string CategoryName)
 {
     string strpath = CategoryName;
     CategoryInfo nfocategory;
     while (ParentId > 0)
     {
         nfocategory = new CategoryInfo();
         nfocategory = GetCategory(ParentId);
         strpath = nfocategory.CategoryName + " > " + strpath;
         ParentId = nfocategory.ParentCategoryID;
     }
     return strpath;
 }
Beispiel #2
0
 public int AddCategory(CategoryInfo categoryInfo)
 {
     return DataProvider.Instance().AddCategory(categoryInfo.PortalID, categoryInfo.CategoryName,
         categoryInfo.CategoryDescription, categoryInfo.Message, categoryInfo.Archived,
         categoryInfo.CreatedByUser, categoryInfo.CreatedDate, categoryInfo.OrderID, categoryInfo.ParentCategoryID);
 }
Beispiel #3
0
 public CategoryInfo GetCategoryPath(int categoryId)
 {
     CategoryInfo nfocategory = new CategoryInfo();
     nfocategory = GetCategory(categoryId);
     if (nfocategory.ParentCategoryID > 0)
     {
         nfocategory.CategoryPathName = CreatePath(nfocategory.ParentCategoryID, nfocategory.CategoryName);
     }
     else
     {
         nfocategory.CategoryPathName = nfocategory.CategoryName;
     }
     return nfocategory;
 }
Beispiel #4
0
 public void UpdateCategory(CategoryInfo categoryInfo)
 {
     DataProvider.Instance().UpdateCategory(categoryInfo.CategoryID, categoryInfo.CategoryName,
         categoryInfo.CategoryDescription, categoryInfo.Message, categoryInfo.Archived, categoryInfo.OrderID, categoryInfo.ParentCategoryID);
 }
Beispiel #5
0
        private Control processToken(string tokenName)
        {
            ProductController productController = new ProductController();
            ArrayList productList = new ArrayList();

            Control parent = new Control();
            switch (tokenName)
            {
                case "MESSAGE":
                    if(bool.Parse(moduleSettings.General.ShowMessage) && categoryInfo != null)
                    {
                        // canadean changed: added category name
                        LiteralControl message = new LiteralControl(Server.HtmlDecode(categoryInfo.CategoryName));
                        parent.Controls.Add(message);
                        message = new LiteralControl(Server.HtmlDecode(categoryInfo.Message));
                        parent.Controls.Add(message);
                    }

                    if (catalogNav.CategoryID != Null.NullInteger)
                    {
                        //sub categories...
                        CategoryController controller = new CategoryController();
                        ArrayList subCategories = controller.GetCategories(PortalId, false, catalogNav.CategoryID);
                        if (subCategories.Count > 0)
                        {
                            LiteralControl BreakRow4 = new LiteralControl("<br /><div align=\"center\">");
                            parent.Controls.Add(BreakRow4);
                        }
                        //StoreController storeController = new StoreController();
                        //StoreInfo storeInfo = storeController.GetStoreInfo(PortalId);
                        foreach (CategoryInfo category in subCategories)
                        {
                            LiteralControl BreakRow = new LiteralControl("|&nbsp;");
                            parent.Controls.Add(BreakRow);
                            HyperLink link = new HyperLink();
                            link.Text = category.CategoryName;
                            StringDictionary replaceParams = new StringDictionary();
                            replaceParams["CategoryID"] = category.CategoryID.ToString();
                            replaceParams["ProductID"] = Null.NullString;
                            replaceParams["PageIndex"] = Null.NullString;
                            link.NavigateUrl = catalogNav.GetNavigationUrl(replaceParams, storeInfo.StorePageID);
                            parent.Controls.Add(link);
                            LiteralControl BreakRow2 = new LiteralControl("&nbsp;");
                            parent.Controls.Add(BreakRow2);
                        }
                        if (subCategories.Count > 0)
                        {
                            LiteralControl BreakRow3 = new LiteralControl("|</div><br/>");
                            parent.Controls.Add(BreakRow3);
                        }
                        else
                        {
                            LiteralControl BreakRow5 = new LiteralControl("<br/>");
                            parent.Controls.Add(BreakRow5);
                        }
                    }
                    return parent;

                // Canadean changed: added subcategory token
                case "SUBCATEGORY":
                    /*LiteralControl lc = new LiteralControl("pId: " + catalogNav.ProductID);
                    parent.Controls.Add(lc);*/
                    if ((catalogNav.CategoryID != Null.NullInteger) && (catalogNav.ProductID == Null.NullInteger))
                    {
                        //sub categories...
                        CategoryController controller = new CategoryController();
                        ArrayList subCategories = controller.GetCategories(PortalId, false, catalogNav.CategoryID);

                        if (subCategories.Count > 0)
                        {
                            /*
                            String htmlstr = "<br><table cellspacing='3' cellpadding='0' border='0'><tr><td class='subtitleShop'>select report category</td></tr><tr><td>" +
                                "<table cellspacing='0' cellpadding='0' border='0'> " +
                                "    <tbody>" +
                                "        <tr>" +
                                "            <td><a class='shopIntroText' href='/Shop/Reports/tabid/109/CategoryID/5/Default.aspx'>Soft Drinks</a></td>" +
                                "            <td><a href='/Shop/Reports/tabid/109/CategoryID/5/Default.aspx'><img alt='' border='0' src='/images/canadean/shop/shop_bullet.gif' /> </a></td>" +
                                "            <td>&nbsp;</td>" +
                                "            <td><a class='shopIntroText' href='/Shop/Reports/tabid/109/CategoryID/8/Default.aspx'>Beverage Packaging</a></td>" +
                                "            <td><a href='/Shop/Reports/tabid/109/CategoryID/8/Default.aspx'><img alt='' border='0' src='/images/canadean/shop/shop_bullet.gif' /> </a></td>" +
                                "            <td>&nbsp;</td>" +
                                "        </tr>" +
                                "        <tr>" +
                                "            <td><a class='shopIntroText' href='/Shop/Reports/tabid/109/CategoryID/6/Default.aspx'>Beer</a></td>" +
                                "            <td><a class='shopIntroText' href='/Shop/Reports/tabid/109/CategoryID/6/Default.aspx'><img alt='' border='0' src='/images/canadean/shop/shop_bullet.gif' /> </a></td>" +
                                "            <td>&nbsp;</td>" +
                                "            <td><a class='shopIntroText' href='/Shop/Reports/tabid/109/CategoryID/9/Default.aspx'>All Beverages</a></td>" +
                                "            <td><a class='shopIntroText' href='/Shop/Reports/tabid/109/CategoryID/9/Default.aspx'><img alt='' border='0' src='/images/canadean/shop/shop_bullet.gif' /> </a></td>" +
                                "            <td>&nbsp;</td>" +
                                "        </tr>" +
                                "        <tr>" +
                                "            <td><a class='shopIntroText' href='/Shop/Reports/tabid/109/CategoryID/7/Default.aspx'>Dairy</a></td>" +
                                "            <td><a class='shopIntroText' href='/Shop/Reports/tabid/109/CategoryID/7/Default.aspx'><img alt='' border='0' src='/images/canadean/shop/shop_bullet.gif' /> </a></td>" +
                                "            <td>&nbsp;</td>" +
                                "            <td>&nbsp;</td>" +
                                "            <td>&nbsp;</td>" +
                                "            <td>&nbsp;</td>" +
                                "        </tr>" +
                                "    </tbody>" +
                                "</table></td></tr></table><p>&nbsp;</p>";
                            */
                            // LiteralControl title = new LiteralControl(htmlstr);
                            //parent.Controls.Add(title);
                            phSubcategory.Visible = true;

                        }
                        /*
                        // Not used because of aesthetics questions
                        if (subCategories.Count > 0)
                        {
                            LiteralControl title = new LiteralControl("<br /><div class=subtitleShop>select report category</div>");
                            parent.Controls.Add(title);
                            LiteralControl BreakRow4 = new LiteralControl("<div class=categoryList><ul>");
                            parent.Controls.Add(BreakRow4);
                        }
                        //StoreController storeController = new StoreController();
                        //StoreInfo storeInfo = storeController.GetStoreInfo(PortalId);
                        foreach (CategoryInfo category in subCategories)
                        {
                            LiteralControl BreakRow = new LiteralControl("<li>");
                            parent.Controls.Add(BreakRow);
                            HyperLink link = new HyperLink();
                            link.Text = category.CategoryName;
                            link.CssClass = "newsMenuOn";
                            StringDictionary replaceParams = new StringDictionary();
                            replaceParams["CategoryID"] = category.CategoryID.ToString();
                            replaceParams["ProductID"] = Null.NullString;
                            replaceParams["PageIndex"] = Null.NullString;
                            link.NavigateUrl = catalogNav.GetNavigationUrl(replaceParams, storeInfo.StorePageID);
                            parent.Controls.Add(link);
                            LiteralControl BreakRow2 = new LiteralControl("</li>");
                            parent.Controls.Add(BreakRow2);
                        }
                        if (subCategories.Count > 0)
                        {
                            LiteralControl BreakRow3 = new LiteralControl("<ul></div>");
                            parent.Controls.Add(BreakRow3);
                        }
                        //else
                        //{
                        //    LiteralControl BreakRow5 = new LiteralControl("<br/>");
                        //    parent.Controls.Add(BreakRow5);
                        //}
                        */

                        return parent;
                    }
                    return null;

                // Canadean changed: added subsubcategory token
                case "SUBSUBCATEGORY":
                    if ((catalogNav.CategoryID3 == Null.NullInteger) && (catalogNav.CategoryID != Null.NullInteger) && (categoryInfo.ParentCategoryID == 4))    // Only show DD sub categories when we're on the Drink Type category
                    {
                        phSubSubcategory.Visible = true;
                        int categoryId1 = -1;
                        int categoryId2 = -1;
                        int returnCategory = 2;
                        categoryId1 = catalogNav.CategoryID;
                        CategoryController controller = new CategoryController();

                        if (catalogNav.CategoryID2 != Null.NullInteger)     // Type & Continent already selected, missing Country
                        {
                            labelSubSubcategoryNow.Text = "now select country";
                            categoryId2 = catalogNav.CategoryID2;
                            returnCategory = 3;
                            CategoryInfo categoryInfo2 = new CategoryInfo();
                            categoryInfo2 = controller.GetCategory(catalogNav.CategoryID2);
                            //labelCategoryName.Text = categoryInfo.CategoryName + " in " + categoryInfo2.CategoryName;
                            labelCategoryName.Text = "<u><a href='" + FixHyperlinkCatalog(catalogNav, 1) + "' class='demoHeadingLink'>" + categoryInfo.CategoryName + "</a></u> in " +
                                "<u><a href='" + FixHyperlinkCatalog(catalogNav, 2) + "' class='demoHeadingLink'>" + categoryInfo2.CategoryName + "</a></u>";

                        }
                        else
                        {
                            labelSubSubcategoryNow.Text = "now select continent";
                            //labelCategoryName.Text = categoryInfo.CategoryName;
                            labelCategoryName.Text = "<u><a href='" + FixHyperlinkCatalog(catalogNav, 1) + "' class='demoHeadingLink'>" + categoryInfo.CategoryName + "</a></u>";
                        }

                        /*String str = "<br>Getting data. Portal " + PortalId + " c1: " + categoryId1 + " c2: " + categoryId2 + " rc: " + returnCategory;
                        labelLog2.Text = str;
                        Response.Write(str);*/

                        ArrayList subCategories = controller.GetCategoriesFromProducts(PortalId, categoryId1, categoryId2, -1, returnCategory);
                        if (subCategories.Count > 0)
                        {
                            //labelSubSubCategory.Text = "<ul>";
                            bool two_columns = false;
                            int count = 0;
                            if(subCategories.Count > 24)
                                two_columns = true;

                            //Response.Write("lines: " + subCategories.Count);

                            labelSubSubCategory.Text = "<br /><table cellspacing='0' cellpadding='0' border='0'>";
                            CatalogNavigation currentCatalogNav = catalogNav;
                            foreach (CategoryInfo cur_category in subCategories)
                            {
                                String cat_name = cur_category.CategoryName;
                                int cat_id = cur_category.CategoryID;

                                StringDictionary replaceParams = new StringDictionary();
                                replaceParams["CategoryID"] = categoryId1.ToString();
                                if (catalogNav.CategoryID2 != Null.NullInteger)
                                {
                                    replaceParams["CategoryID2"] = catalogNav.CategoryID2.ToString();
                                    replaceParams["CategoryID3"] = cat_id.ToString();
                                }
                                else
                                {
                                    replaceParams["CategoryID2"] = cat_id.ToString();
                                }
                                replaceParams["ProductID"] = Null.NullString;
                                replaceParams["PageIndex"] = Null.NullString;
                                String linkCat = currentCatalogNav.GetNavigationUrl(replaceParams);

                                //Response.Write("two_colums: " + two_columns + " mod: " + (count % 2));

                                if (!two_columns || (count % 2 == 0))
                                    labelSubSubCategory.Text += "<tr>";
                                //labelSubSubCategory.Text += "<li><a href='" + linkCat + "' class='newsMenuOff'>" + cat_name + "</a></li>";
                                labelSubSubCategory.Text += "<td><a class='shopIntroText' href='" + linkCat + "'>" + cat_name + "</a></td><td>&nbsp;</td>";
                                labelSubSubCategory.Text += "<td><a href='" + linkCat + "'><img border='0' alt='' src='/images/canadean/shop/shop_bullet.gif' /></a></td>";
                                labelSubSubCategory.Text += "<td width='20%'>&nbsp;</td>";
                                if (!two_columns || (count % 2 == 1))
                                    labelSubSubCategory.Text += "</tr>";
                                count++;
                            }
                            //labelSubSubCategory.Text += "</ul>";
                            labelSubSubCategory.Text += "</table><br />";
                        }

                        //Response.Write("SUBCATEGORYDD make it visible ");
                        return parent;
                    }
                    else
                    {   // Only show the products if we have all the categories information
                        if ((catalogNav.CategoryID != Null.NullInteger) && (catalogNav.CategoryID2 != Null.NullInteger) && (catalogNav.CategoryID3 != Null.NullInteger) && (catalogNav.ProductID == Null.NullInteger))
                        {
                            phSubSubcategory.Visible = true;
                            tableSubSubCategory.Visible = false;
                            phSearchResults.Visible = true;
                            PopulateGridView(true);
                            Label1.Visible = true;
                            return parent;
                        }
                    }

                    return null;
                // Canadean changed: added subcategory token (unused for now)
                case "SUBCATEGORYDD":
                    if ((catalogNav.CategoryID != Null.NullInteger) && (categoryInfo.ParentCategoryID == 4))    // Only show DD sub categories when we're on the Drink Type category
                    {
                        phSubcategoryDD.Visible = true;
                        phSearchResults.Visible = true;
                        ddHidden.Items.Add(new ListItem(catalogNav.CategoryID.ToString(), catalogNav.CategoryID.ToString()));
                        labelAreaName.Text = categoryInfo.CategoryName;
                        //Response.Write("SUBCATEGORYDD make it visible ");
                        return parent;
                    }
                    return null;
                // Canadean changed: added Data Extracts subcategory token
                case "SUBCATEGORYDEDD":
                    //Response.Write("SUBCATEGORYDEDD make it visible {" + catalogNav.CategoryID + "} {" + categoryInfo.ParentCategoryID + "}");
                    //if ((catalogNav.CategoryID != Null.NullInteger) && (categoryInfo.ParentCategoryID == -1))    // Only show DD sub categories when we're on the Data Extracts category
                    if ((catalogNav.CategoryID != Null.NullInteger) && (categoryInfo.CategoryID == 2))    // Only show DD sub categories when we're on the Data Extracts category
                    {
                        phSubcategoryDEDD.Visible = true;
                        ddDEHidden.Items.Add(new ListItem(catalogNav.CategoryID.ToString(), catalogNav.CategoryID.ToString()));
                        //Response.Write("<br>Inside SUBCATEGORYDEDD make it visible. Selected item: " + ddDEHidden.SelectedIndex);
                        ddDEHidden.ClearSelection();

                        System.Collections.ArrayList prods = PopulateDEGridView(true);
                        int numProds = prods.Count;
                        Label2.Text = "Total cart cost: &pound;" + numProds * 50 + "";

                        return parent;
                    }
                    return null;

                case "SELECTED":    // Disabled!!       Show the products that exist in the current selected categories
                    Response.Write("SELECTED: " + catalogNav.CategoryID + " - " + catalogNav.CategoryID2 + " - " + catalogNav.CategoryID3);
                    if ((catalogNav.CategoryID != Null.NullInteger) && (catalogNav.CategoryID2 != Null.NullInteger) && (catalogNav.CategoryID3 != Null.NullInteger))    // Only show the products if we all the categories information
                    {
                        int categoryID1 = catalogNav.CategoryID;
                        int categoryID2 = catalogNav.CategoryID2;
                        int categoryID3 = catalogNav.CategoryID3;

                        phSearchResults.Visible = true;
                        GetSelectedProducts(-1, categoryID1, categoryID2, categoryID3, productList);
                        //productList = truncateList(productList, int.Parse(moduleSettings.NewProducts.RowCount) * int.Parse(moduleSettings.NewProducts.ColumnCount));
                        return loadProductList(productList, ProductListTypes.Category);
                    }
                    return null;

                // Canadean changed: added search token
                case "CATALOGSEARCH":
                    phSearchResults.Visible = true;

                    /*
                    int categoryID = 0;
                    string searchTerm = "";
                    Response.Write("here I am: " + searchTerm);
                    if (Page.IsPostBack)
                        Response.Write(" postback: ");
                    else
                        Response.Write(" not a postback: ");
                    */

                    /*
                    if (!Page.IsPostBack)
                    {
                        if (Request.Params["SearchCategoryId"] != null)
                            int.TryParse(Request.Params["SearchCategoryId"].ToString(), out categoryID);
                        if (Request.Params["Search"] != null)
                            searchTerm = Request.Params["Search"].ToString();
                        GetSearchedProducts(categoryID, searchTerm, productList);
                        //productList = truncateList(productList, int.Parse(moduleSettings.NewProducts.RowCount) * int.Parse(moduleSettings.NewProducts.ColumnCount));
                        if (productList.Count > 0)
                        {
                            gvResults.DataSource = productList;
                            gvResults.DataBind();
                        }
                    }
                    */
                    Label1.Visible = false;
                    PopulateGridView(true);

                    return parent;
                case "NEW":
                    if (bool.Parse(moduleSettings.General.ShowNewProducts))
                    {
                        if (catalogNav.CategoryID != Null.NullInteger)
                        {
                            GetNewProducts(catalogNav.CategoryID, productList);
                            productList = truncateList(productList, int.Parse(moduleSettings.NewProducts.RowCount) * int.Parse(moduleSettings.NewProducts.ColumnCount));
                            return loadProductList(productList, ProductListTypes.New);
                        }
                        else
                        {
                            productList = productController.GetPortalNewProducts(PortalId, false);
                            productList = truncateList(productList, int.Parse(moduleSettings.NewProducts.RowCount) * int.Parse(moduleSettings.NewProducts.ColumnCount));
                            return loadProductList(productList, ProductListTypes.New);
                        }
                    }
                    else
                    {
                        return null;
                    }

                case "FEATURED":
                    if (bool.Parse(moduleSettings.General.ShowFeaturedProducts))
                    {
                        if(catalogNav.CategoryID != Null.NullInteger)
                        {
                            GetFeaturedProducts(catalogNav.CategoryID, productList);
                            productList = SortProductsInRandomOrder(productList);
                            productList = truncateList(productList, int.Parse(moduleSettings.FeaturedProducts.RowCount) * int.Parse(moduleSettings.FeaturedProducts.ColumnCount));
                            return loadProductList(productList, ProductListTypes.Featured);
                        }
                        else
                        {
                            productList = productController.GetPortalFeaturedProducts(PortalId, false);
                            productList = truncateList(productList, int.Parse(moduleSettings.FeaturedProducts.RowCount) * int.Parse(moduleSettings.FeaturedProducts.ColumnCount));
                            return loadProductList(productList, ProductListTypes.Featured);
                        }
                    }
                    else
                    {
                        return null;
                    }

                case "POPULAR":
                    if (bool.Parse(moduleSettings.General.ShowPopularProducts))
                    {
                        if(catalogNav.CategoryID != Null.NullInteger)
                        {
                            GetPopularProducts(catalogNav.CategoryID, productList);
                            productList = SortProductsInRandomOrder(productList);
                            productList = truncateList(productList, int.Parse(moduleSettings.PopularProducts.RowCount) * int.Parse(moduleSettings.PopularProducts.ColumnCount));
                            return loadProductList(productList, ProductListTypes.Popular);
                        }
                        else
                        {
                            productList = productController.GetPortalPopularProducts(PortalId, false);
                            productList = truncateList(productList, int.Parse(moduleSettings.PopularProducts.RowCount) * int.Parse(moduleSettings.PopularProducts.ColumnCount));
                            return loadProductList(productList, ProductListTypes.Popular);
                        }
                    }
                    else
                    {
                        return null;
                    }

                case "CATEGORY":
                    if (bool.Parse(moduleSettings.General.ShowCategoryProducts))
                    {
                        if(catalogNav.CategoryID != Null.NullInteger && catalogNav.ProductID == Null.NullInteger)
                        {
                            GetCategoryProducts(catalogNav.CategoryID, productList);
                            productList = SortProductsInAlphabeticalOrder(productList);
                            return loadProductList(productList, ProductListTypes.Category);
                        }
                        else
                        {
                            return null;
                        }
                    }
                    else
                    {
                        return null;
                    }

                case "DETAIL":
                    if(bool.Parse(moduleSettings.General.ShowProductDetail) && catalogNav.ProductID != Null.NullInteger)
                    {
                        return loadProductDetail();
                    }
                    else
                    {
                        return null;
                    }

                default:
                    LiteralControl litText = new LiteralControl(tokenName);
                    return litText;
            }
        }
Beispiel #6
0
        void DotNetNuke.Entities.Modules.IPortable.ImportModule(int ModuleID, string Content, string Version, int UserID)
        {
            XmlNode xmlCategories = DotNetNuke.Common.Globals.GetContent(Content, "Categories");
            SortedList slCategories = new SortedList(xmlCategories.ChildNodes.Count);
            int intIndexID = Null.NullInteger;

            foreach (XmlNode xmlCategory in xmlCategories)
            {
                CategoryInfo categoryInfo = new CategoryInfo();
                categoryInfo.PortalID = PortalId;
                categoryInfo.CategoryName = xmlCategory["Name"].InnerText;
                categoryInfo.CategoryDescription = xmlCategory["Description"].InnerText;
                categoryInfo.Message = xmlCategory["Message"].InnerText;
                categoryInfo.Archived = Convert.ToBoolean(xmlCategory["Archived"].InnerText);
                categoryInfo.CreatedByUser = UserId.ToString();
                categoryInfo.CreatedDate = DateTime.Now;
                categoryInfo.OrderID = Convert.ToInt32(xmlCategory["OrderID"].InnerText);
                intIndexID = slCategories.IndexOfKey(Convert.ToInt32(xmlCategory["ParentCategoryID"].InnerText));
                if (intIndexID > -1)
                {
                    categoryInfo.ParentCategoryID = (int)slCategories.GetByIndex(intIndexID);
                }
                else
                {
                    categoryInfo.ParentCategoryID = -1;
                }
                slCategories.Add(Convert.ToInt32(xmlCategory["CategoryID"].InnerText), AddCategory(categoryInfo));
            }
        }
Beispiel #7
0
        protected ArrayList PopulateGridView(bool shouldBind)
        {
            ArrayList productList = new ArrayList();
            int categoryID = 0;
            string searchTerm = "";
            try
            {
                if (Request.Params["Search"] != null)
                    searchTerm = Request.Params["Search"].ToString();
                if (Request.Params["SearchCategoryId"] != null)
                    int.TryParse(Request.Params["SearchCategoryId"].ToString(), out categoryID);
                if ((Request.Params["Search"] != null) && (Request.Params["SearchCategoryId"] != null))
                {
                    GetSearchedProducts(categoryID, searchTerm, productList);
                    //productList = truncateList(productList, int.Parse(moduleSettings.NewProducts.RowCount) * int.Parse(moduleSettings.NewProducts.ColumnCount));
                    if (productList.Count > 0)
                    {
                        Label1.Text = "your results";
                        Label1.Visible = true;
                        gvResults.DataSource = productList;
                        if (shouldBind)
                            gvResults.DataBind();
                    }
                    else
                    {
                        Label1.Text = "no results found";
                        Label1.Visible = true;
                    }

                }
                else
                {

                    /*
                    // Get selected values
                    string continent = DropDownList1.SelectedItem.Text;
                    string country = DropDownList2.SelectedItem.Text;
                    //labelLog.Text = labelLog.Text + "<br>DD1: " + continent + " DD2: " + country + DateTime.Now.ToString();
                    int cat1 = -1;
                    int cat2 = -1;
                    int.TryParse(DropDownList1.SelectedValue, out cat1);
                    int.TryParse(DropDownList2.SelectedValue, out cat2);
                    //labelLog.Text = labelLog.Text + "<br>Populate GV dd1: " + cat1.ToString() + " dd2: " + cat2.ToString() + DateTime.Now.ToString();

                    // Output result string based on which values are specified
                    if (string.IsNullOrEmpty(continent))
                    {
                        Label1.Text = "Please select a continent.";
                    }
                    else if (string.IsNullOrEmpty(country))
                    {
                        Label1.Text = "Please select a country.";
                    }
                    else
                    {*/
                    //Label1.Text = string.Format("You have chosen {0} {1}. ", continent, country);

                        CategoryInfo categoryInfo = new CategoryInfo();
                        CategoryInfo categoryInfo2 = new CategoryInfo();
                        CategoryInfo categoryInfo3 = new CategoryInfo();
                        CategoryController categoryController = new CategoryController();
                        categoryInfo = categoryController.GetCategory(catalogNav.CategoryID);
                        categoryInfo2 = categoryController.GetCategory(catalogNav.CategoryID2);
                        categoryInfo3 = categoryController.GetCategory(catalogNav.CategoryID3);
                        //Response.Write("category: " + categoryInfo.CategoryID + " name: " + categoryInfo.CategoryName);
                        //labelCategoryName.Text = categoryInfo.CategoryName + " in " + categoryInfo2.CategoryName + " / " + categoryInfo3.CategoryName;
                        if ((categoryInfo != null) && (categoryInfo2 != null) && (categoryInfo3 != null))
                        {
                            labelCategoryName.Text = "<u><a href='" + FixHyperlinkCatalog(catalogNav, 1) +
                                "' class='demoHeadingLink'>" + categoryInfo.CategoryName + "</a></u> in " +
                                "<u><a href='" + FixHyperlinkCatalog(catalogNav, 2) + "' class='demoHeadingLink'>" + categoryInfo2.CategoryName + "</a></u> / " +
                                "<u><a href='" + FixHyperlinkCatalog(catalogNav, 3) + "' class='demoHeadingLink'>" + categoryInfo3.CategoryName + "</a></u>";

                            Label1.Text = "your results";
                            //Response.Write("dd1: " + DropDownList1.Items.Count + " dd2: " + DropDownList2.Items.Count);
                            //if ((DropDownList1.Items.Count > 1) && (DropDownList2.Items.Count > 1) && (catalogNav.CategoryID != Null.NullInteger))
                            {
                                /*
                                int categoryID1 = catalogNav.CategoryID;
                                int categoryID2 = int.Parse(DropDownList1.SelectedValue);
                                int categoryID3 = int.Parse(DropDownList2.SelectedValue);
                                */
                                int categoryID1 = catalogNav.CategoryID;
                                int categoryID2 = catalogNav.CategoryID2;
                                int categoryID3 = catalogNav.CategoryID3;

                                GetSelectedProducts(-1, categoryID1, categoryID2, categoryID3, productList);

                                gvResults.DataSource = productList;
                                if (shouldBind)
                                    gvResults.DataBind();

                                if (productList.Count == 0)
                                {
                                    Label1.Text = "no results found";
                                    Label1.Visible = true;
                                }

                            }
                        }
                    //}
                }
            }
            catch (Exception ex)
            {
                Response.Write("<br>" + ex.Message);
                Response.Write("<br>" + ex.StackTrace);
            }
            return productList;
        }
Beispiel #8
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            /*
            Response.Write("<br>Page_load2 ");
            if (Page.IsPostBack)
                Response.Write("<br>Postback2 ");
            */

            /*
            if (Page.IsPostBack)
            {
                labelLog.Text = labelLog.Text + "<br>Page load PostBack" + DateTime.Now.ToString();
                int cat1 = -1;
                int.TryParse(DropDownList1.SelectedValue, out cat1);
                int cat2 = -1;
                int.TryParse(DropDownList2.SelectedValue, out cat2);
                labelLog.Text = labelLog.Text + "<br>dd1: " + cat1.ToString() + " dd2: " + cat2.ToString() + DateTime.Now.ToString();
            }
            else
            {
                labelLog.Text = labelLog.Text + "<br>Page load - Not a PostBack" + DateTime.Now.ToString();
            } */
                //Response.Write("Page_PreRender");

                npTitle = Localization.GetString("NPTitle.Text", this.LocalResourceFile);
                fpTitle = Localization.GetString("FPTitle.Text", this.LocalResourceFile);
                ppTitle = Localization.GetString("PPTitle.Text", this.LocalResourceFile);
                cpTitle = Localization.GetString("CPTitle.Text", this.LocalResourceFile);

                try
                {
                    if (storeInfo == null)
                    {
                        StoreController storeController = new StoreController();
                        storeInfo = storeController.GetStoreInfo(PortalId);
                        if (storeInfo.PortalTemplates)
                        {
                            templatesPath = PortalSettings.HomeDirectoryMapPath + "Store\\";
                            CssTools.AddCss(this.Page, PortalSettings.HomeDirectory + "Store", PortalId);
                        }
                        else
                        {
                            templatesPath = MapPath(ModulePath) + "\\";
                            CssTools.AddCss(this.Page, this.TemplateSourceDirectory, PortalId);
                        }
                    }

                    moduleSettings = new ModuleSettings(this.ModuleId, this.TabId);

                    catalogNav = new CatalogNavigation(Request.QueryString);

                    if (catalogNav.CategoryID == Null.NullInteger)
                    {
                        if (bool.Parse(moduleSettings.General.UseDefaultCategory))
                        {
                            catalogNav.CategoryID = int.Parse(moduleSettings.General.DefaultCategoryID);
                        }
                    }

                    if (catalogNav.ProductID != Null.NullInteger)
                    {
                        ProductController productController = new ProductController();
                        productInfo = productController.GetProduct(catalogNav.ProductID);
                        catalogNav.CategoryID = productInfo.CategoryID;
                    }

                    if (catalogNav.CategoryID != Null.NullInteger)
                    {
                        CategoryController categoryController = new CategoryController();
                        categoryInfo = categoryController.GetCategory(catalogNav.CategoryID);
                    }

                    this.Controls.Add(TemplateController.ParseTemplate(templatesPath, moduleSettings.General.Template, new ProcessTokenDelegate(processToken)));

                    // Canadean changed: added current categoryid on a hidden dropdown, to use on the cascade categories
                    /*
                    if (catalogNav.CategoryID != Null.NullInteger)
                    {
                        ddHidden.Items.Add(new ListItem(catalogNav.CategoryID.ToString(), catalogNav.CategoryID.ToString()));
                    }
                    */

                }
                catch (Exception ex)
                {
                    string ErrorSettings = Localization.GetString("ErrorSettings", this.LocalResourceFile);
                    Response.Write("<br>" + ex.Message);
                    Response.Write("<br>" + ex.StackTrace);

                    //Exceptions.ProcessModuleLoadException(ErrorSettings, this, ex, true);
                }
                if (DotNetNuke.Framework.AJAX.IsInstalled())
                {
                    DotNetNuke.Framework.AJAX.RegisterScriptManager();
                }

            //}
        }
Beispiel #9
0
        private void DisplayChildCategories(CategoryInfo category, DataListItem dataListItem, int storePageID, int indentLevel)
        {
            CategoryController controller = new CategoryController();
            StringDictionary replaceParams = new StringDictionary();
            replaceParams["ProductID"] = Null.NullString;
            replaceParams["PageIndex"] = Null.NullString;

            ArrayList childCategories = controller.GetCategories(PortalId, false, category.CategoryID);
            foreach (CategoryInfo childCategory in childCategories)
            {
                replaceParams["CategoryID"] = childCategory.CategoryID.ToString();
                dataListItem.Controls.Add(GetBreakRow(indentLevel));
                dataListItem.Controls.Add(CreateHyperLink(childCategory.CategoryName, _nav.GetNavigationUrl(replaceParams, storePageID), selectedCategoryID == childCategory.CategoryID));

                //If this category is in the parent array, then recurse...
                foreach (CategoryInfo myCategory in parentCategories)
                {
                    if (myCategory.CategoryID == childCategory.CategoryID)
                    {
                        int newIndentLevel = indentLevel + 1;
                        DisplayChildCategories(childCategory, dataListItem, storePageID, newIndentLevel);
                    }
                }
            }
        }
Beispiel #10
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            //try
            //{

                if (Page.IsValid == true)
                {
                    PortalSecurity security = new PortalSecurity();
                    CategoryController controller = new CategoryController();
                    CategoryInfo existingCategory = controller.GetCategory(_categoryID);

                    CategoryInfo category = new CategoryInfo();
                    category = ((CategoryInfo)CBO.InitializeObject(category, typeof(CategoryInfo)));
                    category.CategoryID				= _categoryID;
                    category.PortalID				= this.PortalId;
                    category.CategoryName			= security.InputFilter(txtCategoryName.Text, PortalSecurity.FilterFlag.NoMarkup | PortalSecurity.FilterFlag.NoScripting);
                    category.CategoryDescription    = category.CategoryName; // security.InputFilter(txtDescription.Text, PortalSecurity.FilterFlag.NoMarkup | PortalSecurity.FilterFlag.NoScripting);
                    category.Archived               = false; // chkArchived.Checked;
                    category.Message                = ""; // txtMessage.Text;
                    category.CreatedByUser			= this.UserId.ToString();
                    category.CreatedDate			= DateTime.Now;

                    /*
                    try
                    {
                        category.OrderID = Convert.ToInt32(txtOrder.Text);
                    }
                    catch (ArgumentException)
                    {
                        category.OrderID = existingCategory.OrderID;
                    }
                    */
                    category.OrderID = 0;

                    try
                    {
                        category.ParentCategoryID = Convert.ToInt32(ddlParentCategory.SelectedItem.Value);
                    }
                    catch (ArgumentException)
                    {
                        category.ParentCategoryID = existingCategory.ParentCategoryID;
                    }

                    if (_categoryID == 0)
                    {
                        //No recursion check needed...
                        controller.AddCategory(category);
                        invokeEditComplete();
                    }
                    else
                    {
                        //Recursion Check...
                        if (category.ParentCategoryID != Null.NullInteger && !RecursionCheckPassed(category.CategoryID, category.ParentCategoryID))
                        {
                            lblRecursionWarning.Visible = true;
                        }
                        else
                        {
                            lblRecursionWarning.Visible = false;
                            controller.UpdateCategory(category);
                            invokeEditComplete();
                        }
                    }
                }

            //}
            //catch(Exception ex)
            //{
            //	Exceptions.ProcessModuleLoadException(this, ex);
            //}
        }
Beispiel #11
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Get the Category ID
                CategoryInfo category = new CategoryInfo();
                _categoryID = (int)dataSource;

                if (!Page.IsPostBack)
                {
                    cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");
                    if (!Null.IsNull(_categoryID))
                    {
                        CategoryController controller = new CategoryController();

                        //Bind parent category list...
                        ddlParentCategory.DataSource = controller.GetCategoriesPath(PortalId, true, -1);
                        ddlParentCategory.DataTextField = "CategoryPathName";
                        ddlParentCategory.DataValueField = "CategoryID";
                        ddlParentCategory.DataBind();
                        ddlParentCategory.Items.Insert(0, new ListItem(Localization.GetString("None", this.LocalResourceFile), "-1"));

                        category = controller.GetCategory(_categoryID);
                        if (category != null)
                        {
                            cmdDelete.Visible = true;

                            txtCategoryName.Text	= category.CategoryName;
                            //txtDescription.Text		= category.CategoryDescription;
                            //chkArchived.Checked		= category.Archived;
                            //txtMessage.Text			= category.Message;
                            //txtOrder.Text           = category.OrderID.ToString();
                            if (category.ParentCategoryID != Null.NullInteger
                                && category.ParentCategoryID > 0)
                            {
                                if (ddlParentCategory.Items.FindByValue(category.ParentCategoryID.ToString()) != null)
                                {
                                    ddlParentCategory.ClearSelection();
                                    ddlParentCategory.Items.FindByValue(category.ParentCategoryID.ToString()).Selected = true;
                                }
                            }
                        }
                    }
                }
        }