Beispiel #1
0
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Null.IsNull(_categoryID))
                {
                    CategoryController controller = new CategoryController();
                    controller.DeleteCategory(_categoryID);

                    _categoryID = Null.NullInteger;
                }

                invokeEditComplete();
            }
            catch(Exception ex)
            {
                if (ex.InnerException != null)
                {
                    Exceptions.ProcessModuleLoadException(this, ex.InnerException);
                }
                else
                {
                    string ErrorDelete = Localization.GetString("ErrorDelete", this.LocalResourceFile);
                    Exceptions.ProcessModuleLoadException(ErrorDelete, this, ex);
                }
            }
        }
Beispiel #2
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 #3
0
        private ArrayList GetPopularProducts(int categoryID, ArrayList products)
        {
            CategoryController categoryController = new CategoryController();
            ProductController productController = new ProductController();

            CategoryInfo category = categoryController.GetCategory(categoryID);

            foreach (ProductInfo product in productController.GetPopularProducts(PortalId, categoryID, false))
            {
                products.Add(product);
            }

            foreach (CategoryInfo childCategory in categoryController.GetCategories(PortalId, false, categoryID))
            {
                if (childCategory.CategoryID != Null.NullInteger)
                {
                    GetPopularProducts(childCategory.CategoryID, products);
                }
            }

            return products;
        }
Beispiel #4
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 #5
0
        protected ArrayList PopulateDEGridView(bool shouldBind)
        {
            ArrayList productList = new ArrayList();
            if (Session["selectedDE"] != null)
            {
                try
                {
                    String selectedDEStr = (String)Session["selectedDE"];
                    char[] splitter = { ';' };
                    char[] splitter2 = { ':' };
                    String[] selectedDEs = selectedDEStr.Split(splitter);
                    CategoryController categoryController = new CategoryController();
                    foreach (String selectedDE in selectedDEs)
                    {
                        if (selectedDE != "")
                        {

                            String[] options = selectedDE.Split(splitter2);
                            int cat1 = -1;
                            int.TryParse(options[0], out cat1);
                            int cat2 = -1;
                            int.TryParse(options[1], out cat2);

                            CategoryInfo catg1 = categoryController.GetCategory(cat1);
                            CategoryInfo catg2 = categoryController.GetCategory(cat2);
                            //Response.Write("<!-- cat1 {" + cat1 + "} -->");
                            //Response.Write("<!-- cat2 {" + cat2 + "} -->");
                            //Response.Write("<!-- catg1 {" + catg1.CategoryID + "} {" + catg1.CategoryName + "} -->");
                            //Response.Write("<!-- catg2 {" + catg2.CategoryID + "} {" + catg2.CategoryName + "} -->");

                            DEProductInfo prod = new DEProductInfo(catg1.CategoryID, catg1.CategoryName, catg2.CategoryID, catg2.CategoryName);
                            productList.Add(prod);
                            //productList.Add(catg1);
                        }
                    }
                    gvDECart.DataSource = productList;
                    if (shouldBind)
                        gvDECart.DataBind();

                }
                catch (Exception ex)
                {
                    Response.Write("<!-- Error with selectedDE {" + Session["selectedDE"] + "} " + ex.Message);
                    Response.Write("<br>" + ex.StackTrace + "-->");
                }
            }
            return productList;
        }
Beispiel #6
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();
                }

            //}
        }
        private string getDEDetails(string selectedDEStr)
        {
            string returnText = "";
            if (selectedDEStr.IndexOf(":") > 0)
            {
                char[] splitter = { ';' };
                char[] splitter2 = { ':' };

                String[] selectedDEs = selectedDEStr.Split(splitter);
                CategoryController categoryController = new CategoryController();
                foreach (String selectedDE in selectedDEs)
                {
                    if (selectedDE != "")
                    {
                        String[] options = selectedDE.Split(splitter2);
                        int cat1 = -1;
                        int.TryParse(options[0], out cat1);
                        int cat2 = -1;
                        int.TryParse(options[1], out cat2);

                        CategoryInfo catg1 = categoryController.GetCategory(cat1);
                        CategoryInfo catg2 = categoryController.GetCategory(cat2);
                        //DEProductInfo prod = new DEProductInfo(catg1.CategoryID, catg1.CategoryName, catg2.CategoryID, catg2.CategoryName);
                        returnText = returnText + catg1.CategoryName + " / " + catg2.CategoryName + "<br>";
                    }
                }
            }
            return returnText;
        }
Beispiel #8
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                // Load utility objects
                _nav = new CatalogNavigation(Request.QueryString);
                _nav.ProductID = Null.NullInteger;	//Product should not be displayed!
                if (_nav.CategoryID == 0)
                {
                    _nav.CategoryID = Null.NullInteger;
                }

                //Get category and parent category data
                CategoryController categoryController = new CategoryController();
                selectedCategoryID = _nav.CategoryID;
                if (selectedCategoryID != Null.NullInteger)
                {
                    CategoryInfo category = categoryController.GetCategory(selectedCategoryID);
                    parentCategories.Add(category);
                    if (category.CategoryID != category.ParentCategoryID)
                    {
                        while (category.ParentCategoryID != Null.NullInteger)
                        {
                            category = categoryController.GetCategory(category.ParentCategoryID);
                            parentCategories.Add(category);
                            foreach (CategoryInfo cat in parentCategories)
                            {
                                if (cat.CategoryID == category.CategoryID)
                                {
                                    //Cyclical categories found
                                    break;
                                }
                            }
                        }
                    }
                }
                if (parentCategories.Count > 0)
                {
                    parentCategories.Reverse();
                }

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

                _settings = new ModuleSettings(this.ModuleId, this.TabId);
                // Databind to list of categories
                CategoryController controller = new CategoryController();
                ArrayList categoryList = controller.GetCategories(this.PortalId, false, -2);
                MyList.RepeatColumns = int.Parse(_settings.CategoryMenu.ColumnCount);
                MyList.DataSource = categoryList;
                MyList.DataBind();

                //MyList.SelectedIndex = GetSelectedIndex();
            }
            catch(Exception ex)
            {
                if (ex.InnerException != null)
                {
                    Exceptions.ProcessModuleLoadException(this, ex.InnerException);
                }
                else
                {
                    string ErrorSettings = Localization.GetString("ErrorSettings", this.LocalResourceFile);
                    Exceptions.ProcessModuleLoadException(ErrorSettings, this, ex, true);
                }
            }
        }
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 Page_Load(object sender, System.EventArgs e)
        {
            _nav = new AdminNavigation(Request.QueryString);

            if (_nav.CategoryID != Null.NullInteger)
            {
                plhGrid.Visible = false;
                plhForm.Visible = true;

                if (_nav.CategoryID == 0)
                {
                    lblEditTitle.Text = Localization.GetString("AddCategory", this.LocalResourceFile);
                    loadEditControl("CategoryEdit.ascx", _nav.CategoryID);
                }
                else
                {
                    lblEditTitle.Text = Localization.GetString("EditCategory", this.LocalResourceFile);
                    loadEditControl("CategoryEdit.ascx", _nav.CategoryID);
                }
            }
            else
            {
                plhGrid.Visible = true;
                plhForm.Visible = false;

                CategoryController categoryController = new CategoryController();
                ArrayList categoryList = categoryController.GetCategoriesPath(PortalId, false, -1);

                if (categoryList.Count > 0)
                {
                    // Has page index been initialized?
                    if (_nav.PageIndex == Null.NullInteger)
                    {
                        _nav.PageIndex = 0;
                    }

                    // Update the grid
                    grdCategories.PageSize = 20;
                    grdCategories.AllowPaging = true;
                    grdCategories.DataSource = categoryList;
                    grdCategories.CurrentPageIndex = _nav.PageIndex;
                    grdCategories.DataBind();
                }
            }
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    CategoryController categoryController = new CategoryController();
                    ArrayList categoryList = categoryController.GetCategories(this.PortalId, false, -1);
                    bool defaultExists = false;

                    lstDefaultCategory.Items.Add(new ListItem(Localization.GetString("SelectDefaultCategory", this.LocalResourceFile), "-1"));

                    foreach (CategoryInfo categoryInfo in categoryList)
                    {
                        lstDefaultCategory.Items.Add(new ListItem(categoryInfo.CategoryName, categoryInfo.CategoryID.ToString()));

                        if (categoryInfo.CategoryID.ToString() == moduleSettings.General.DefaultCategoryID)
                        {
                            defaultExists = true;
                        }
                    }

                    if (lstDefaultCategory.Items.Count > 1 && Int32.Parse(moduleSettings.General.DefaultCategoryID) > 0 && defaultExists)
                    {
                        lstDefaultCategory.SelectedValue = moduleSettings.General.DefaultCategoryID;
                    }
                }
            }
            catch(Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Beispiel #12
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 #13
0
        private bool RecursionCheckPassed(int CategoryID, int ParentCategoryID)
        {
            //Checks for recursive parent/child categories...
            if (CategoryID == ParentCategoryID)
            {
                return false;
            }

            CategoryController controller = new CategoryController();
            ArrayList categoryTree = new ArrayList();
            categoryTree.Add(CategoryID);
            categoryTree.Add(ParentCategoryID);

            CategoryInfo category = controller.GetCategory(ParentCategoryID);

            while (category.ParentCategoryID > 0)
            {
                foreach (int i in categoryTree)
                {
                    if (i == category.ParentCategoryID)
                    {
                        return false;
                    }
                }
                category = controller.GetCategory(category.ParentCategoryID);
            }
            return true;
        }
Beispiel #14
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;
                                }
                            }
                        }
                    }
                }
        }
Beispiel #15
0
        private void FillCategoryCombo()
        {
            CategoryController controller = new CategoryController();
            ArrayList categoryList = controller.GetCategories(this.PortalId, true, -1);
            cmbCategory.DataSource = categoryList;
            cmbCategory.DataBind();
            cmbCategory.Items.Insert(0, new ListItem("--- " + Localization.GetString("All.Text") + " ---", Null.NullInteger.ToString()));

            cmbCategory.SelectedValue = _nav.CategoryID.ToString();
        }
Beispiel #16
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                // Get the navigation settings
                _nav = new CatalogNavigation(Request.QueryString);
                _nav.ProductID = (int)dataSource;

                // Handle ProductID=0 as Null.NullInteger
                if (_nav.ProductID == 0)
                {
                    _nav.ProductID = Null.NullInteger;
                }

                if (!Page.IsPostBack)
                {
                    // Load category list
                    CategoryController categoryController = new CategoryController();
                    cmbCategory1.DataSource = categoryController.GetCategoriesPath(this.PortalId, true, 4);
                    cmbCategory1.DataBind();
                    cmbCategory2.DataSource = categoryController.GetCategoriesPath(this.PortalId, true, 10);
                    cmbCategory2.DataBind();
                    cmbCategory3.DataSource = categoryController.GetCategoriesPath(this.PortalId, true, 18);
                    cmbCategory3.DataBind();

                    // Set delete confirmation
                    cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");

                    // Are we editing or creating new item?
                    if (_nav.ProductID != Null.NullInteger)
                    {
                        ProductController controller = new ProductController();
                        ProductInfo product = controller.GetProduct(_nav.ProductID);

                        if (product != null)
                        {
                            cmdDelete.Visible = true;
                            //txtManufacturer.Text		    = product.Manufacturer;
                            txtModelName.Text			    = product.ModelName;
                            txtModelNumber.Text			    = product.ModelNumber;
                            txtSummary.Text                 = product.Summary;
                            //txtSummary2.Text                = product.Summary;
                            txtUnitPrice.Text			    = product.UnitCost.ToString("0.00");
                            tbPriceStr.Text                 = product.PriceStr;

                            /*
                            image1.FileFilter = "bmp,png,jpg,jpeg,gif";
                            image1.ShowDatabase = true;
                            image1.ShowFiles = true;
                            image1.ShowLog = false;
                            image1.ShowNewWindow = false;
                            image1.ShowNone = true;
                            image1.ShowSecure = true;
                            image1.ShowTabs = false;
                            image1.ShowTrack = false;
                            image1.ShowUpLoad = true;
                            image1.ShowUrls = true;
                            image1.ShowUsers = false;
                            */
                            /*PrepareImage(image1);

                            if (product.ProductImage.StartsWith("http://"))
                            {
                                image1.UrlType = "U";
                            }
                            else
                            {
                                image1.UrlType = "F";
                            }
                            image1.Url = product.ProductImage;
                            */

                            //cmbCategory.SelectedValue       = product.CategoryID.ToString();
                            cmbCategory1.SelectedValue      = product.CategoryID1.ToString();
                            cmbCategory2.SelectedValue      = product.CategoryID2.ToString();
                            cmbCategory3.SelectedValue      = product.CategoryID3.ToString();
                            txtNumPages.Text                = product.NumPages.ToString();

                            //System.Web.UI.WebControls.Calendar calPublishDate;

                            //calPublishDate.SelectedDate     = product.PublishDate == Null.NullDate ? Null.NullDate : product.PublishDate;
                            ///calPublishDate.SelectedDate     = product.PublishDate;
                            ///calPublishDate.VisibleDate      = product.PublishDate;
                            tbPublishDate.Text              = product.PublishDate.ToString("dd/MM/yyyy");
                            //Response.Write(product.PublishDate.ToString());

                            chkArchived.Checked			    = product.Archived;
                            //chkFeatured.Checked			    = product.Featured;
                            txtDescription.Text = product.Description;
                            txtDescriptionTwo.Text = product.DescriptionTwo;
                            txtDescriptionThree.Text = product.DescriptionThree;
                            tbDescriptionTag.Text = product.DescriptionTag;
                            txtTOC_Html.Text = product.TOC_Html;
                            //txtTOC_Html.Text = RemoveHTML( product.Description );

                            //Response.Write("<br>before {" + product.ProductFile + "}{" + file1.Url + "}");
                            file1 = PrepareFile(file1);
                            if (product.ProductFile == Null.NullString) product.ProductFile = "_no_report_file_available.pdf";
                            SetFileUrl(file1, "products654654/", product.ProductFile);
                            //Response.Write("<br>after {" + product.ProductFile + "}{" + file1.Url + "}");

                            //Response.Write("<br>preview before {" + product.ProductPreview + "}{" + preview1.Url + "}");
                            preview1 = PrepareFile(preview1);
                            if (product.ProductPreview == Null.NullString) product.ProductPreview = "_no_report_file_available.pdf";
                            SetFileUrl(preview1, "documents/", product.ProductPreview);
                            //Response.Write("<br>preview after {" + product.ProductPreview + "}{" + preview1.Url + "}");

                            tbFile1.Text = product.ProductFile;
                            tbPreview1.Text = product.ProductPreview;

                            //txtDescription2.Text            = product.Description;
                            //txtUnitWeight.Text              = product.ProductWeight == Null.NullDecimal ? string.Empty : product.ProductWeight.ToString("0.00");
                            //txtUnitHeight.Text              = product.ProductHeight == Null.NullDecimal ? string.Empty : product.ProductHeight.ToString("0.00");
                            //txtUnitLength.Text              = product.ProductLength == Null.NullDecimal ? string.Empty : product.ProductLength.ToString("0.00");
                            //txtUnitWidth.Text               = product.ProductWidth == Null.NullDecimal ? string.Empty : product.ProductWidth.ToString("0.00");
                            calSaleStartDate.SelectedDate   = product.SaleStartDate == Null.NullDate ? Null.NullDate : product.SaleStartDate;
                            calSaleEndDate.SelectedDate     = product.SaleEndDate == Null.NullDate ? Null.NullDate : product.SaleEndDate;
                            txtSalePrice.Text               = product.SalePrice == Null.NullDecimal ? string.Empty : product.SalePrice.ToString("0.00");

                            //Response.Write("AvailableONlie: " + product.AvailableOnline);
                            chkAvailableOnline.Checked = product.AvailableOnline;

                            if (calSaleStartDate.SelectedDate != Null.NullDate)
                            {
                                calSaleStartDate.VisibleDate = calSaleStartDate.SelectedDate;
                            }

                            if (calSaleEndDate.SelectedDate != Null.NullDate)
                            {
                                calSaleEndDate.VisibleDate = calSaleEndDate.SelectedDate;
                            }

                            Session["ok"] = true;
                        }
                        else
                        {
                            // Handle as new item
                            PrepareNew();
                        }
                    }
                    else
                    {
                        // Handle as new item
                        PrepareNew();
                    }
                }

            }
            catch(Exception ex)
            {
                Response.Write(ex.Message);
                Response.Write(ex.StackTrace);
                Response.Write(ex.InnerException);
                Response.Write(ex.GetBaseException().Message);

                // Exceptions.ProcessModuleLoadException(this, ex);
            }
        }