Пример #1
0
        private void Render()
        {
            StringBuilder writer = new StringBuilder();

            writer.Append("<form method=\"GET\" action=\"" + AppLogic.AdminLinkUrl("phonesearch.aspx") + "\" onsubmit=\"return (validateForm(this) && SearchForm2_Validator(this))\" name=\"SearchForm2\">\n");
            writer.Append("<input type=\"hidden\" name=\"IGD\" id=\"IGD\" value=\"" + m_IGD + "\">");
            writer.Append("<p>" + AppLogic.GetString("admin.phonesearch.SearchInfo", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) + ":</p>\n");
            writer.Append("<input type=\"text\" name=\"SearchTerm\" onkeypress=\"javascript:return WebForm_FireDefaultButton(event, 'btnsearch')\" size=\"25\" maxlength=\"70\" value=\"" + Server.HtmlEncode(CommonLogic.QueryStringCanBeDangerousContent("SearchTerm")) + "\">\n");
            writer.Append("<input type=\"hidden\" name=\"SearchTerm_Vldt\" value=\"[req][blankalert=" + AppLogic.GetString("admin.common.SomethingToSearchForPrompt", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) + "]\">\n");
            writer.Append("&nbsp;<input type=\"submit\" id=\"btnsearch\" value=\"" + AppLogic.GetString("admin.common.Search", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) + "\" name=\"B1\"></td>\n");
            writer.Append("<br/>");
            writer.Append("<br/>");


            String st = CommonLogic.QueryStringCanBeDangerousContent("SearchTerm").Trim();

            if (st.Length != 0)
            {
                String stlike   = "%" + st + "%";
                String stquoted = DB.SQuote(stlike);

                // MATCHING PRODUCTS:
                ProductCollection products = new ProductCollection();
                products.PageSize    = 0;
                products.PageNum     = 1;
                products.SearchMatch = st;
                products.SearchDescriptionAndSummaryFields = false;
                products.PublishedOnly = false;
                products.ExcludePacks  = true;
                DataSet dsProducts  = products.LoadFromDB();
                int     NumProducts = products.NumProducts;

                bool anyFound = false;
                if (NumProducts > 0)
                {
                    anyFound = true;
                    foreach (DataRow row in dsProducts.Tables[0].Rows)
                    {
                        String url = "javascript:window.parent.frames['RightPanel2Frame'].location.href='../showproduct.aspx?IGD=" + m_IGD + "&amp;productid=" + DB.RowFieldInt(row, "ProductID").ToString() + "';javascript:void(0);";

                        writer.Append("<a href=\"" + url + "\">" + AppLogic.MakeProperObjectName(DB.RowFieldByLocale(row, "Name", ThisCustomer.LocaleSetting), DB.RowFieldByLocale(row, "VariantName", ThisCustomer.LocaleSetting), ThisCustomer.LocaleSetting) + "</a>");
                        writer.Append("<br/>");
                        anyFound = true;
                    }
                }
                products.Dispose();
                dsProducts.Dispose();

                if (!anyFound)
                {
                    writer.Append(AppLogic.GetString("admin.common.NoMatchesFound", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) + "\n");
                }
            }
            writer.Append("</form>\n");
            ltContent.Text = writer.ToString();
        }
Пример #2
0
        protected void LoadBody()
        {
            Int32 mappingCount = DB.GetSqlN("select count(*) as N from Product" + this.m_EntitySpecs.m_EntityName + " where " + m_EntitySpecs.m_EntityName + "Id = " + this.EntityID.ToString());

            ProductCollection products = new ProductCollection(m_EntitySpecs.m_EntityName, EntityID);

            products.PageSize          = 0;
            products.PageNum           = 1;
            products.PublishedOnly     = false;
            products.ReturnAllVariants = false;

            DataSet dsProducts = new DataSet();

            if (mappingCount > 0)
            {
                dsProducts = products.LoadFromDB();
            }

            int NumProducts = products.NumProducts;

            if (NumProducts > 1000)
            {
                ltBody.Text += ("<p><b>" + AppLogic.GetString("admin.common.ImportExcession", SkinID, LocaleSetting) + "</b></p>");
            }
            else if (NumProducts > 0)
            {
                ltBody.Text += ("<script type=\"text/javascript\">\n");
                ltBody.Text += ("function Form_Validator(theForm)\n");
                ltBody.Text += ("{\n");
                ltBody.Text += ("submitonce(theForm);\n");
                ltBody.Text += ("return (true);\n");
                ltBody.Text += ("}\n");
                ltBody.Text += ("</script>\n");

                ltBody.Text += ("<form id=\"Form1\" name=\"Form1\" method=\"POST\" action=\"" + AppLogic.AdminLinkUrl("entityBulkSE.aspx") + "?entityid=" + EntityID.ToString() + "&entityname=" + m_EntitySpecs.m_EntityName + "\" onsubmit=\"alert('" + AppLogic.GetString("admin.entityBulkSE.Patient", SkinID, LocaleSetting) + "');return (validateForm(document.forms[0]) && Form_Validator(document.forms[0]))\" onReset=\"return confirm('" + AppLogic.GetString("admin.common.ResetAllFieldsPrompt", SkinID, LocaleSetting) + "');\">\n");
                ltBody.Text += ("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">\n");
                ltBody.Text += ("<table border=\"0\" cellpadding=\"0\" border=\"0\" cellspacing=\"0\" width=\"100%\">\n");
                ltBody.Text += ("<tr><td colspan=\"5\" align=\"right\"><input type=\"submit\" value=\"" + AppLogic.GetString("admin.entityBulkSE.SearchEngineUpdate", SkinID, LocaleSetting) + "\" name=\"Submit\" class=\"normalButtons\"></td></tr>\n");
                ltBody.Text += ("<tr class=\"table-header\">\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.ProductID", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.VariantID", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.ProductName", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.VariantName", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("<td align=\"left\"><b>" + AppLogic.GetString("admin.common.ProductFields", SkinID, LocaleSetting) + "</b></td>\n");

                ltBody.Text += ("</tr>\n");
                int LastProductID = 0;



                int rowcount = dsProducts.Tables[0].Rows.Count;

                for (int i = 0; i < rowcount; i++)
                {
                    DataRow row = dsProducts.Tables[0].Rows[i];

                    int ThisProductID = DB.RowFieldInt(row, "ProductID");
                    int ThisVariantID = DB.RowFieldInt(row, "VariantID");

                    if (i % 2 == 0)
                    {
                        ltBody.Text += ("<tr class=\"table-row2\">\n");
                    }
                    else
                    {
                        ltBody.Text += ("<tr class=\"table-alternatingrow2\">\n");
                    }
                    ltBody.Text += ("<td align=\"left\" valign=\"top\">");
                    ltBody.Text += (ThisProductID.ToString());
                    ltBody.Text += ("</td>");
                    ltBody.Text += ("<td align=\"left\" valign=\"top\">");
                    ltBody.Text += (ThisVariantID.ToString());
                    ltBody.Text += ("</td>");
                    ltBody.Text += ("<td align=\"left\" valign=\"top\">");
                    bool showlinks = false;
                    if (showlinks)
                    {
                        ltBody.Text += ("<a href=\"" + AppLogic.AdminLinkUrl("entityeditproducts.aspx") + "?iden=" + ThisProductID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">");
                    }
                    ltBody.Text += (DB.RowFieldByLocale(row, "Name", LocaleSetting));
                    if (showlinks)
                    {
                        ltBody.Text += ("</a>");
                    }
                    ltBody.Text += ("</td>\n");
                    ltBody.Text += ("<td align=\"left\" valign=\"top\">");
                    if (showlinks)
                    {
                        ltBody.Text += ("<a href=\"" + AppLogic.AdminLinkUrl("entityeditproductvariant.aspx") + "?iden=" + ThisProductID.ToString() + "&variantid=" + ThisVariantID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">");
                    }
                    ltBody.Text += (DB.RowFieldByLocale(row, "VariantName", LocaleSetting));
                    if (showlinks)
                    {
                        ltBody.Text += ("</a>");
                    }
                    ltBody.Text += ("</td>\n");
                    ltBody.Text += ("<td align=\"left\" valign=\"top\">");
                    ltBody.Text += ("<div align=\"left\">");
                    ltBody.Text += ("<b>" + AppLogic.GetString("admin.topic.setitle", SkinID, LocaleSetting) + "</b><br/>");
                    ltBody.Text += ("<input maxLength=\"100\" name=\"SETitle_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" id=\"SETitle_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + XmlCommon.GetLocaleEntry(DB.RowField(row, "SETitle"), ThisCustomer.ThisCustomerSession.Session("entityUserLocale"), false) + "\" class=\"singleLongest\" /><br/>");
                    ltBody.Text += ("<b>" + AppLogic.GetString("admin.topic.sekeywords", SkinID, LocaleSetting) + "</b><br/>");
                    ltBody.Text += ("<input maxLength=\"255\" name=\"SEKeywords_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" id=\"SEKeywords" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + XmlCommon.GetLocaleEntry(DB.RowField(row, "SEKeywords"), ThisCustomer.ThisCustomerSession.Session("entityUserLocale"), false) + "\" class=\"singleLongest\" /><br/>");
                    ltBody.Text += ("<b>" + AppLogic.GetString("admin.topic.sedescription", SkinID, LocaleSetting) + "</b><br/>");
                    ltBody.Text += ("<input maxLength=\"255\" name=\"SEDescription_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" id=\"SEDescription" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + XmlCommon.GetLocaleEntry(DB.RowField(row, "SEDescription"), ThisCustomer.ThisCustomerSession.Session("entityUserLocale"), false) + "\" class=\"singleLongest\" /><br/>");
                    ltBody.Text += ("<b>" + AppLogic.GetString("admin.entityBulkSE.SearchEngineNoScript", SkinID, LocaleSetting) + ":</b><br/>");
                    ltBody.Text += ("<textarea name=\"SENoScript_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" id=\"SENoScript" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" class=\"multiLong\">" + XmlCommon.GetLocaleEntry(DB.RowField(row, "SENoScript"), ThisCustomer.ThisCustomerSession.Session("entityUserLocale"), false) + "</textarea><br/>");

                    ltBody.Text  += ("</div>");
                    ltBody.Text  += ("</td>\n");
                    ltBody.Text  += ("</tr>\n");
                    LastProductID = ThisProductID;
                }
                ltBody.Text += ("<tr><td colspan=\"5\" align=\"right\"><input type=\"submit\" value=\"" + AppLogic.GetString("admin.entityBulkSE.SearchEngineUpdate", SkinID, LocaleSetting) + "\" name=\"Submit\" class=\"normalButtons\"></td></tr>\n");
                ltBody.Text += ("</table>\n");

                ltBody.Text += ("</form>\n");
            }
            else
            {
                ltBody.Text += ("<p><b>" + AppLogic.GetString("admin.common.NoProductsFound", SkinID, LocaleSetting) + "</b></p>");
            }
            dsProducts.Dispose();
            products.Dispose();
        }
Пример #3
0
        protected void Page_Load(Object sender, EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = 0;
            Response.AddHeader("pragma", "no-cache");

            Page.Form.DefaultButton = btnSubmit.UniqueID;
            Page.Form.DefaultFocus  = txtSearchTerm.ClientID;

            if (!IsPostBack)
            {
                txtSearchTerm.Text = CommonLogic.QueryStringCanBeDangerousContent("SearchTerm");
            }

            SectionTitle = "Search";

            StringBuilder contents = new StringBuilder();

            EntityHelper CategoryHelper     = AppLogic.LookupHelper(EntityHelpers, "Category");
            EntityHelper SectionHelper      = AppLogic.LookupHelper(EntityHelpers, "Section");
            EntityHelper ManufacturerHelper = AppLogic.LookupHelper(EntityHelpers, "Manufacturer");

            String st = CommonLogic.QueryStringCanBeDangerousContent("SearchTerm").Trim();

            if (st.Length != 0)
            {
                String stlike   = "%" + st + "%";
                String stquoted = DB.SQuote(stlike);


                // MATCHING CATEGORIES:
                bool anyFound = false;

                contents.Append("<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n");
                contents.Append("<tr><td style=\"filter:progid:DXImageTransform.Microsoft.Gradient(startColorStr='#FFFFFF', endColorStr='#6487DB', gradientType='1')\"><b>" + AppLogic.GetString("AppConfig.CategoryPromptPlural", SkinID, LocaleSetting).ToUpperInvariant() + " MATCHING: '" + st.ToUpperInvariant() + "'</b></font></td></tr>\n");

                using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
                {
                    con.Open();
                    using (IDataReader rs = DB.GetRS("select * from Category  with (NOLOCK)  where Category.name like " + stquoted + " and Deleted=0 order by DisplayOrder,Name", con))
                    {
                        while (rs.Read())
                        {
                            contents.Append("<tr><td>" + CategoryHelper.GetEntityBreadcrumb(DB.RSFieldInt(rs, "CategoryID"), LocaleSetting) + "</td></tr>");
                            anyFound = true;
                        }
                    }
                }

                if (!anyFound)
                {
                    contents.Append("<tr><td>No matches found</td></tr>\n");
                }
                contents.Append("<tr><td>&nbsp;</td></tr>\n");
                contents.Append("</table>\n");

                // MATCHING SECTIONS:
                anyFound = false;

                contents.Append("<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n");
                contents.Append("<tr><td style=\"filter:progid:DXImageTransform.Microsoft.Gradient(startColorStr='#FFFFFF', endColorStr='#6487DB', gradientType='1')\"><b>" + AppLogic.GetString("AppConfig.SectionPromptPlural", SkinID, LocaleSetting).ToUpperInvariant() + " MATCHING: '" + st.ToUpperInvariant() + "'</b></font></td></tr>\n");

                using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
                {
                    con.Open();
                    using (IDataReader rs = DB.GetRS("select * from [Section]  with (NOLOCK)  where Name like " + stquoted + " and Published=1 and Deleted=0 order by DisplayOrder,Name", con))
                    {
                        while (rs.Read())
                        {
                            contents.Append("<tr><td>" + SectionHelper.GetEntityBreadcrumb(DB.RSFieldInt(rs, "SectionID"), LocaleSetting) + "</td></tr>");
                            anyFound = true;
                        }
                    }
                }

                if (!anyFound)
                {
                    contents.Append("<tr><td>No matches found</td></tr>\n");
                }
                contents.Append("<tr><td>&nbsp;</td></tr>\n");
                contents.Append("</table>\n");

                // MATCHING MANUFACTURERS:
                anyFound = false;

                contents.Append("<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n");
                contents.Append("<tr><td style=\"filter:progid:DXImageTransform.Microsoft.Gradient(startColorStr='#FFFFFF', endColorStr='#6487DB', gradientType='1')\"><b>MANUFACTURERS MATCHING: '" + st.ToUpperInvariant() + "'</b></font></td></tr>\n");

                using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
                {
                    con.Open();
                    using (IDataReader rs = DB.GetRS("select * from Manufacturer  with (NOLOCK)  where Name like " + stquoted + " and Deleted=0", con))
                    {
                        while (rs.Read())
                        {
                            contents.Append("<tr><td><a href=\"newentities.aspx?entityname=manufacturer&manufacturerid=" + DB.RSFieldInt(rs, "ManufacturerID").ToString() + "\">" + CommonLogic.HighlightTerm(DB.RSFieldByLocale(rs, "Name", LocaleSetting), st) + "</a></td></tr>\n");
                            anyFound = true;
                        }
                    }
                }

                if (!anyFound)
                {
                    contents.Append("<tr><td>No matches found</td></tr>\n");
                }
                contents.Append("<tr><td>&nbsp;</td></tr>\n");
                contents.Append("</table>\n");


                // MATCHING PRODUCTS:
                ProductCollection products = new ProductCollection();
                products.PageSize    = 0;
                products.PageNum     = 1;
                products.SearchMatch = st;
                products.SearchDescriptionAndSummaryFields = false;
                products.PublishedOnly = false;
                DataSet dsProducts  = products.LoadFromDB(true);
                int     NumProducts = products.NumProducts;

                anyFound = false;
                if (NumProducts > 0)
                {
                    anyFound = true;
                    contents.Append("  <table border=\"0\" cellpadding=\"0\" border=\"0\" cellspacing=\"1\" width=\"100%\">\n");
                    contents.Append("<tr><td colspan=\"4\" style=\"filter:progid:DXImageTransform.Microsoft.Gradient(startColorStr='#FFFFFF', endColorStr='#6487DB', gradientType='1')\"><b>PRODUCTS MATCHING: '" + st.ToUpperInvariant() + "'</b></font></td></tr>\n");
                    contents.Append("    <tr>\n");
                    contents.Append("      <td align=\"left\"><b>" + AppLogic.GetString("search.aspx.6", SkinID, LocaleSetting) + "</b></td>\n");
                    contents.Append("      <td align=\"center\"><b>" + AppLogic.GetString("search.aspx.7", SkinID, LocaleSetting) + "</b></td>\n");
                    contents.Append("      <td align=\"center\"><b>" + AppLogic.GetString("AppConfig.CategoryPromptSingular", SkinID, LocaleSetting) + "</b></td>\n");
                    contents.Append("      <td align=\"center\"><b>" + AppLogic.GetString("search.aspx.8", SkinID, LocaleSetting) + "</b></td>\n");
                    contents.Append("    </tr>\n");
                    foreach (DataRow row in dsProducts.Tables[0].Rows)
                    {
                        String url = "newentities.aspx?productid=" + DB.RowFieldInt(row, "ProductID").ToString();
                        contents.Append("<tr>");
                        contents.Append("<td valign=\"middle\" align=\"left\" >");
                        contents.Append("<a href=\"" + url + "\">" + AppLogic.MakeProperObjectName(DB.RowFieldByLocale(row, "Name", LocaleSetting), DB.RowFieldByLocale(row, "VariantName", LocaleSetting), LocaleSetting) + "</a>");
                        // QuickEdit
                        contents.Append("</td>");
                        contents.Append("<td align=\"center\">" + CommonLogic.HighlightTerm(AppLogic.MakeProperProductSKU(DB.RowField(row, "SKU"), DB.RowField(row, "SKUSuffix"), "", ""), st) + "</td>");
                        String Cats = CategoryHelper.GetObjectEntities(DB.RowFieldInt(row, "ProductID"), false);
                        if (Cats.Length != 0)
                        {
                            String[] CatIDs = Cats.Split(',');
                            contents.Append("<td align=\"center\">");
                            bool firstCat = true;
                            foreach (String s in CatIDs)
                            {
                                if (!firstCat)
                                {
                                    contents.Append(", ");
                                }
                                contents.Append("<a href=\"newentities.aspx?entityname=category&categoryid=" + s + "\"\">" + CategoryHelper.GetEntityName(Localization.ParseUSInt(s), LocaleSetting).Trim() + "</a>");
                                firstCat = false;
                            }
                            contents.Append("</td>\n");
                        }
                        else
                        {
                            contents.Append("<td align=\"center\">");
                            contents.Append("&nbsp;");
                            contents.Append("</td>\n");
                        }
                        contents.Append("<td align=\"center\"><a href=\"newentities.aspx?entityname=manufacturer&manufacturerid=" + DB.RowFieldInt(row, "ManufacturerID").ToString() + "\">" + CommonLogic.HighlightTerm(ManufacturerHelper.GetEntityName(DB.RowFieldInt(row, "ManufacturerID"), LocaleSetting), st) + "</a></td>");
                        contents.Append("</tr>\n");
                        anyFound = true;
                    }
                    contents.Append("</table>\n");
                }
                products.Dispose();
                dsProducts.Dispose();

                if (!anyFound)
                {
                    contents.Append("<tr><td colspan=\"4\">No matches found</td></tr>\n");
                }
                contents.Append("<tr><td colspan=\"4\">&nbsp;</td></tr>\n");
                contents.Append("</table>\n");
                ltContents.Text = contents.ToString();
            }
            Page.Form.DefaultButton = btnSubmit.UniqueID;
        }
Пример #4
0
        protected void LoadBody()
        {
            StringBuilder tmpS = new StringBuilder(4096);

            tmpS.Append("<div style=\"width: 100%; border-top: solid 1px #d2d2d2; padding-top: 3px; margin-top: 5px;\">");

            Int32 mappingCount = DB.GetSqlN("select count(*) as N from Product" + this.m_EntitySpecs.m_EntityName + " where " + m_EntitySpecs.m_EntityName + "Id = " + this.EntityID.ToString());

            ProductCollection products = new ProductCollection(m_EntitySpecs.m_EntityName, EntityID);

            products.PageSize          = 0;
            products.PageNum           = 1;
            products.PublishedOnly     = false;
            products.ReturnAllVariants = true;

            DataSet dsProducts = new DataSet();

            if (mappingCount > 0)
            {
                dsProducts = products.LoadFromDB();
            }

            int NumProducts = products.NumProducts;

            if (NumProducts > 1000)
            {
                tmpS.Append("<p><b>" + AppLogic.GetString("admin.common.ImportExcession", SkinID, LocaleSetting) + "</b></p>");
            }
            else if (NumProducts > 0)
            {
                tmpS.Append("<script type=\"text/javascript\">\n");
                tmpS.Append("function Form_Validator(theForm)\n");
                tmpS.Append("{\n");
                tmpS.Append("submitonce(theForm);\n");
                tmpS.Append("return (true);\n");
                tmpS.Append("}\n");
                tmpS.Append("</script>\n");

                tmpS.Append("<form id=\"Form1\" name=\"Form1\" method=\"POST\" action=\"" + AppLogic.AdminLinkUrl("entityBulkPrices.aspx") + "?entityid=" + EntityID.ToString() + "&entityname=" + m_EntitySpecs.m_EntityName + "\" onsubmit=\"alert('" + AppLogic.GetString("admin.entityBulkPrices.Patient", SkinID, LocaleSetting) + "');return (validateForm(document.forms[0]) && Form_Validator(document.forms[0]))\" onReset=\"return confirm('" + AppLogic.GetString("admin.common.ResetAllFieldsPrompt", SkinID, LocaleSetting) + "');\">\n");
                tmpS.Append("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">\n");
                tmpS.Append("<table border=\"0\" cellpadding=\"0\" border=\"0\" cellspacing=\"0\" width=\"100%\">\n");
                tmpS.Append("<tr><td colspan=\"8\" align=\"right\"><input type=\"submit\" value=\"" + AppLogic.GetString("admin.entityBulkPrices.PricesUpdate", SkinID, LocaleSetting) + "\" name=\"Submit\" class=\"normalButtons\"></td></tr>\n");
                tmpS.Append("<tr class=\"table-header\">\n");
                tmpS.Append("<td><b>" + AppLogic.GetString("admin.common.ProductID", SkinID, LocaleSetting) + "</b></td>\n");
                tmpS.Append("<td><b>" + AppLogic.GetString("admin.common.VariantID", SkinID, LocaleSetting) + "</b></td>\n");
                tmpS.Append("<td><b>" + AppLogic.GetString("admin.common.ProductName", SkinID, LocaleSetting) + "</b></td>\n");
                tmpS.Append("<td><b>" + AppLogic.GetString("admin.common.VariantName", SkinID, LocaleSetting) + "</b></td>\n");
                tmpS.Append("<td align=\"center\"><b>" + AppLogic.GetString("admin.common.Price", SkinID, LocaleSetting) + "</b><br/><small>" + AppLogic.GetString("admin.entityBulkPrices.Format", SkinID, LocaleSetting) + "</small></td>\n");
                tmpS.Append("<td align=\"center\"><b>" + AppLogic.GetString("admin.common.SalePrice", SkinID, LocaleSetting) + "</b><br/><small>" + AppLogic.GetString("admin.entityBulkPrices.Format", SkinID, LocaleSetting) + "</small></td>\n");
                tmpS.Append("<td align=\"center\"><b>" + AppLogic.GetString("admin.common.MSRP", SkinID, LocaleSetting) + "</b><br/><small>" + AppLogic.GetString("admin.entityBulkPrices.Format", SkinID, LocaleSetting) + "</small></td>\n");
                tmpS.Append("<td align=\"center\"><b>" + AppLogic.GetString("admin.common.Cost", SkinID, LocaleSetting) + "</b><br/><small>" + AppLogic.GetString("admin.entityBulkPrices.Format", SkinID, LocaleSetting) + "</small></td>\n");
                tmpS.Append("</tr>\n");
                int LastProductID = 0;


                int rowcount = dsProducts.Tables[0].Rows.Count;

                for (int i = 0; i < rowcount; i++)
                {
                    DataRow row = dsProducts.Tables[0].Rows[i];

                    int ThisProductID = DB.RowFieldInt(row, "ProductID");
                    int ThisVariantID = DB.RowFieldInt(row, "VariantID");

                    if (i % 2 == 0)
                    {
                        tmpS.Append("<tr class=\"table-row2\">\n");
                    }
                    else
                    {
                        tmpS.Append("<tr class=\"table-alternatingrow2\">\n");
                    }
                    tmpS.Append("<td align=\"left\" valign=\"middle\">");
                    tmpS.Append(ThisProductID.ToString());
                    tmpS.Append("</td>");
                    tmpS.Append("<td align=\"left\" valign=\"middle\">");
                    tmpS.Append(ThisVariantID.ToString());
                    tmpS.Append("</td>");
                    tmpS.Append("<td align=\"left\" valign=\"middle\">");
                    bool showlinks = false;
                    if (showlinks)
                    {
                        tmpS.Append("<a target=\"entityBody\" href=\"" + AppLogic.AdminLinkUrl("entityeditproducts.aspx") + "?iden=" + ThisProductID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">");
                    }
                    tmpS.Append(DB.RowFieldByLocale(row, "Name", cust.LocaleSetting));
                    if (showlinks)
                    {
                        tmpS.Append("</a>");
                    }
                    tmpS.Append("</td>\n");
                    tmpS.Append("<td align=\"left\" valign=\"middle\">");
                    if (showlinks)
                    {
                        tmpS.Append("<a target=\"entityBody\" href=\"" + AppLogic.AdminLinkUrl("entityeditproductvariant.aspx") + "?iden=" + ThisProductID.ToString() + "&variantid=" + ThisVariantID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">");
                    }
                    tmpS.Append(DB.RowFieldByLocale(row, "VariantName", cust.LocaleSetting));
                    if (showlinks)
                    {
                        tmpS.Append("</a>");
                    }
                    tmpS.Append("</td>\n");
                    tmpS.Append("<td align=\"center\" valign=\"middle\">");
                    tmpS.Append("<input maxLength=\"10\" size=\"10\" class=\"default\" name=\"Price_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + Localization.CurrencyStringForDBWithoutExchangeRate(DB.RowFieldDecimal(row, "Price")) + "\">");
                    tmpS.Append("<input type=\"hidden\" name=\"Price_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "_vldt\" value=\"[req][number][blankalert=" + AppLogic.GetString("admin.common.VariantPricePrompt", SkinID, LocaleSetting) + "][invalidalert=" + AppLogic.GetString("admin.common.ValidDollarAmountPrompt", SkinID, LocaleSetting) + "]\">\n");
                    tmpS.Append("</td>");
                    tmpS.Append("<td align=\"center\" valign=\"middle\">");
                    tmpS.Append("<input maxLength=\"10\" size=\"10\" class=\"default\" name=\"SalePrice_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + CommonLogic.IIF(DB.RowFieldDecimal(row, "SalePrice") != System.Decimal.Zero, Localization.CurrencyStringForDBWithoutExchangeRate(DB.RowFieldDecimal(row, "SalePrice")), "") + "\">\n");
                    tmpS.Append("<input type=\"hidden\" name=\"SalePrice_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "_vldt\" value=\"[number][invalidalert=" + AppLogic.GetString("admin.common.ValidDollarAmountPrompt", SkinID, LocaleSetting) + "]\">\n");
                    tmpS.Append("</td>");
                    tmpS.Append("<td align=\"center\" valign=\"middle\">");
                    tmpS.Append("<input maxLength=\"10\" size=\"10\" class=\"default\" name=\"MSRP_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + CommonLogic.IIF(DB.RowFieldDecimal(row, "MSRP") != System.Decimal.Zero, Localization.CurrencyStringForDBWithoutExchangeRate(DB.RowFieldDecimal(row, "MSRP")), "") + "\">\n");
                    tmpS.Append("<input type=\"hidden\" name=\"MSRP_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "_vldt\" value=\"[number][invalidalert=" + AppLogic.GetString("admin.commmon.ValidDollarAmountPrompt", SkinID, LocaleSetting) + "]\">\n");
                    tmpS.Append("</td>");
                    tmpS.Append("<td align=\"center\" valign=\"middle\">");
                    tmpS.Append("<input maxLength=\"10\" size=\"10\" class=\"default\" name=\"Cost_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + CommonLogic.IIF(DB.RowFieldDecimal(row, "Cost") != System.Decimal.Zero, Localization.CurrencyStringForDBWithoutExchangeRate(DB.RowFieldDecimal(row, "Cost")), "") + "\">\n");
                    tmpS.Append("<input type=\"hidden\" name=\"Cost_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "_vldt\" value=\"[number][invalidalert=" + AppLogic.GetString("admin.common.ValidDollarAmountPrompt", SkinID, LocaleSetting) + "]\">\n");
                    tmpS.Append("</td>\n");

                    tmpS.Append("</tr>\n");
                    LastProductID = ThisProductID;
                }
                tmpS.Append("<tr><td colspan=\"8\" align=\"right\"><input type=\"submit\" value=\"" + AppLogic.GetString("admin.entityBulkPrices.PricesUpdate", SkinID, LocaleSetting) + "\" name=\"Submit\" class=\"normalButtons\"></td></tr>\n");
                tmpS.Append("</table>\n");
                tmpS.Append("</form>\n");
            }
            else
            {
                tmpS.Append("<p><b>" + AppLogic.GetString("admin.common.NoProductsFound", SkinID, LocaleSetting) + "</b></p>");
            }
            dsProducts.Dispose();
            products.Dispose();

            tmpS.Append("</div>");
            ltBody.Text = tmpS.ToString();
        }
Пример #5
0
        private void RenderHtml()
        {
            StringBuilder writer                = new StringBuilder();
            int           CategoryFilterID      = CommonLogic.QueryStringUSInt("CategoryFilterID");
            int           SectionFilterID       = CommonLogic.QueryStringUSInt("SectionFilterID");
            int           ProductTypeFilterID   = CommonLogic.QueryStringUSInt("ProductTypeFilterID");
            int           ManufacturerFilterID  = CommonLogic.QueryStringUSInt("ManufacturerFilterID");
            int           DistributorFilterID   = CommonLogic.QueryStringUSInt("DistributorFilterID");
            int           GenreFilterID         = CommonLogic.QueryStringUSInt("GenreFilterID");
            int           VectorFilterID        = CommonLogic.QueryStringUSInt("VectorFilterID");
            int           AffiliateFilterID     = CommonLogic.QueryStringUSInt("AffiliateFilterID");
            int           CustomerLevelFilterID = CommonLogic.QueryStringUSInt("CustomerLevelFilterID");

            String ENCleaned = CommonLogic.QueryStringCanBeDangerousContent("EntityName").Trim();

            // kludge for now, during conversion to properly entity/object setup:
            if (ENCleaned.Equals("CATEGORY", StringComparison.InvariantCultureIgnoreCase))
            {
                CategoryFilterID      = CommonLogic.QueryStringUSInt("EntityFilterID");
                SectionFilterID       = 0;
                ProductTypeFilterID   = 0;
                ManufacturerFilterID  = 0;
                DistributorFilterID   = 0;
                GenreFilterID         = 0;
                VectorFilterID        = 0;
                AffiliateFilterID     = 0;
                CustomerLevelFilterID = 0;
            }
            if (ENCleaned.Equals("SECTION", StringComparison.InvariantCultureIgnoreCase))
            {
                CategoryFilterID      = 0;
                SectionFilterID       = CommonLogic.QueryStringUSInt("EntityFilterID");
                ProductTypeFilterID   = 0;
                ManufacturerFilterID  = 0;
                DistributorFilterID   = 0;
                GenreFilterID         = 0;
                VectorFilterID        = 0;
                AffiliateFilterID     = 0;
                CustomerLevelFilterID = 0;
            }
            if (ENCleaned.Equals("MANUFACTURER", StringComparison.InvariantCultureIgnoreCase))
            {
                CategoryFilterID      = 0;
                SectionFilterID       = 0;
                ProductTypeFilterID   = 0;
                ManufacturerFilterID  = CommonLogic.QueryStringUSInt("EntityFilterID");
                DistributorFilterID   = 0;
                GenreFilterID         = 0;
                VectorFilterID        = 0;
                AffiliateFilterID     = 0;
                CustomerLevelFilterID = 0;
            }
            if (ENCleaned.Equals("DISTRIBUTOR", StringComparison.InvariantCultureIgnoreCase))
            {
                CategoryFilterID      = 0;
                SectionFilterID       = 0;
                ProductTypeFilterID   = 0;
                ManufacturerFilterID  = 0;
                DistributorFilterID   = CommonLogic.QueryStringUSInt("EntityFilterID");
                GenreFilterID         = 0;
                VectorFilterID        = 0;
                AffiliateFilterID     = 0;
                CustomerLevelFilterID = 0;
            }
            if (ENCleaned.Equals("GENRE", StringComparison.InvariantCultureIgnoreCase))
            {
                CategoryFilterID      = 0;
                SectionFilterID       = 0;
                ProductTypeFilterID   = 0;
                ManufacturerFilterID  = 0;
                DistributorFilterID   = 0;
                GenreFilterID         = CommonLogic.QueryStringUSInt("EntityFilterID");
                VectorFilterID        = 0;
                AffiliateFilterID     = 0;
                CustomerLevelFilterID = 0;
            }

            if (ENCleaned.Equals("VECTOR", StringComparison.InvariantCultureIgnoreCase))
            {
                CategoryFilterID      = 0;
                SectionFilterID       = 0;
                ProductTypeFilterID   = 0;
                ManufacturerFilterID  = 0;
                DistributorFilterID   = 0;
                GenreFilterID         = 0;
                VectorFilterID        = CommonLogic.QueryStringUSInt("EntityFilterID");
                AffiliateFilterID     = 0;
                CustomerLevelFilterID = 0;
            }
            if (ENCleaned.Equals("AFFILIATE", StringComparison.InvariantCultureIgnoreCase))
            {
                CategoryFilterID      = 0;
                SectionFilterID       = 0;
                ProductTypeFilterID   = 0;
                ManufacturerFilterID  = 0;
                DistributorFilterID   = 0;
                GenreFilterID         = 0;
                VectorFilterID        = 0;
                AffiliateFilterID     = CommonLogic.QueryStringUSInt("EntityFilterID");
                CustomerLevelFilterID = 0;
            }
            if (ENCleaned.Equals("CUSTOMERLEVEL", StringComparison.InvariantCultureIgnoreCase))
            {
                CategoryFilterID      = 0;
                SectionFilterID       = 0;
                ProductTypeFilterID   = 0;
                ManufacturerFilterID  = 0;
                DistributorFilterID   = 0;
                GenreFilterID         = 0;
                VectorFilterID        = 0;
                AffiliateFilterID     = 0;
                CustomerLevelFilterID = CommonLogic.QueryStringUSInt("EntityFilterID");
            }
            // end kludge


            if (CommonLogic.QueryStringCanBeDangerousContent("CategoryFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    CategoryFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminCategoryFilterID), Profile.AdminCategoryFilterID, "0"));
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("SectionFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    SectionFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminSectionFilterID), Profile.AdminSectionFilterID, "0"));
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("ManufacturerFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    ManufacturerFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminManufacturerFilterID), Profile.AdminManufacturerFilterID, "0"));
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("DistributorFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    DistributorFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminDistributorFilterID), Profile.AdminDistributorFilterID, "0"));
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("GenreFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    GenreFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminGenreFilterID), Profile.AdminGenreFilterID, "0"));
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("VectorFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    VectorFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminVectorFilterID), Profile.AdminVectorFilterID, "0"));
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("AffiliateFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    AffiliateFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminAffiliateFilterID), Profile.AdminAffiliateFilterID, "0"));
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("CustomerLevelFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    CustomerLevelFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminCustomerLevelFilterID), Profile.AdminCustomerLevelFilterID, "0"));
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("ProductTypeFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    ProductTypeFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminProductTypeFilterID), Profile.AdminProductTypeFilterID, "0"));
                }
                if (ProductTypeFilterID != 0 && !AppLogic.ProductTypeHasVisibleProducts(ProductTypeFilterID))
                {
                    ProductTypeFilterID = 0;
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length != 0)
            {
                CategoryFilterID      = 0;
                SectionFilterID       = 0;
                ManufacturerFilterID  = 0;
                DistributorFilterID   = 0;
                GenreFilterID         = 0;
                VectorFilterID        = 0;
                AffiliateFilterID     = 0;
                CustomerLevelFilterID = 0;
                ProductTypeFilterID   = 0;
            }

            Profile.AdminCategoryFilterID      = CategoryFilterID.ToString();
            Profile.AdminSectionFilterID       = SectionFilterID.ToString();
            Profile.AdminManufacturerFilterID  = ManufacturerFilterID.ToString();
            Profile.AdminDistributorFilterID   = DistributorFilterID.ToString();
            Profile.AdminGenreFilterID         = GenreFilterID.ToString();
            Profile.AdminVectorFilterID        = VectorFilterID.ToString();
            Profile.AdminAffiliateFilterID     = AffiliateFilterID.ToString();
            Profile.AdminCustomerLevelFilterID = CustomerLevelFilterID.ToString();
            Profile.AdminProductTypeFilterID   = ProductTypeFilterID.ToString();

            EntityHelper CategoryHelper      = AppLogic.LookupHelper(EntityHelpers, "Category");
            EntityHelper SectionHelper       = AppLogic.LookupHelper(EntityHelpers, "Section");
            EntityHelper ManufacturerHelper  = AppLogic.LookupHelper(EntityHelpers, "Manufacturer");
            EntityHelper DistributorHelper   = AppLogic.LookupHelper(EntityHelpers, "Distributor");
            EntityHelper GenreHelper         = AppLogic.LookupHelper(EntityHelpers, "Genre");
            EntityHelper VectorHelper        = AppLogic.LookupHelper(EntityHelpers, "VECTOR");
            EntityHelper AffiliateHelper     = AppLogic.LookupHelper(EntityHelpers, "Affiliate");
            EntityHelper CustomerLevelHelper = AppLogic.LookupHelper(EntityHelpers, "CustomerLevel");

            if (CommonLogic.QueryStringCanBeDangerousContent("DeleteID").Length != 0)
            {
                int DeleteID = CommonLogic.QueryStringUSInt("DeleteID");
                DB.ExecuteSQL("delete from ShoppingCart where productid=" + DeleteID.ToString());
                DB.ExecuteSQL("delete from kitcart where productid=" + DeleteID.ToString());
                DB.ExecuteSQL("update Product set deleted=1 where ProductID=" + DeleteID.ToString());
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("NukeID").Length != 0)
            {
                int DeleteID = CommonLogic.QueryStringUSInt("NukeID");
                DB.ExecuteLongTimeSQL("aspdnsf_NukeProduct " + DeleteID.ToString(), 120);
            }
            //writer.Append("</form>");
            writer.Append("<form id=\"FilterForm\" style=\"height:26px;padding:2px 5px;\" name=\"FilterForm\" method=\"GET\" action=\"" + AppLogic.AdminLinkUrl("salepricescontent.aspx") + "\">\n");
            writer.Append("<a href=\"" + AppLogic.AdminLinkUrl("salepricescontent.aspx") + "?resetfilters=true&categoryfilterid=0&sectionfilterid=0&producttypefilterid=0&manufacturerfilterid=0&distributorfilterid=0&genreid=0&Vectorid=0&affiliatefilterid=0&customerlevelfilterid=0\">RESET FILTERS</a>&nbsp;&nbsp;&nbsp;&nbsp;");

            String CatSel = CategoryHelper.GetEntitySelectList(0, String.Empty, 0, LocaleSetting, false);

            // mark current Category:
            CatSel = CatSel.Replace("<option value=\"" + CategoryFilterID.ToString() + "\">", "<option value=\"" + CategoryFilterID.ToString() + "\" selected>");
            if (CategoryHelper.m_TblMgr.NumRootLevelNodes > 0)
            {
                writer.Append(AppLogic.GetString("AppConfig.CategoryPromptSingular", SkinID, LocaleSetting) + ": ");
                writer.Append("<select onChange=\"document.FilterForm.submit()\" style=\"font-size: 9px;\" size=\"1\" name=\"CategoryFilterID\">\n");
                writer.Append("<OPTION VALUE=\"0\" " + CommonLogic.IIF(CategoryFilterID == 0, " selected ", "") + ">All " + AppLogic.GetString("AppConfig.CategoryPromptPlural", SkinID, LocaleSetting) + "</option>\n");
                writer.Append(CatSel);
                writer.Append("</select>\n");
                writer.Append("&nbsp;&nbsp;");
            }

            String SecSel = SectionHelper.GetEntitySelectList(0, String.Empty, 0, LocaleSetting, false);

            if (SectionHelper.m_TblMgr.NumRootLevelNodes > 0)
            {
                SecSel = SecSel.Replace("<option value=\"" + SectionFilterID.ToString() + "\">", "<option value=\"" + SectionFilterID.ToString() + "\" selected>");
                writer.Append(AppLogic.GetString("AppConfig.SectionPromptSingular", SkinID, LocaleSetting) + ": ");
                writer.Append("<select onChange=\"document.FilterForm.submit()\" style=\"font-size: 9px;\" size=\"1\" name=\"SectionFilterID\">\n");
                writer.Append("<OPTION VALUE=\"0\" " + CommonLogic.IIF(SectionFilterID == 0, " selected ", "") + ">All " + AppLogic.GetString("AppConfig.SectionPromptPlural", SkinID, LocaleSetting) + "</option>\n");
                writer.Append(SecSel);
                writer.Append("</select>\n");
                writer.Append("&nbsp;&nbsp;");
            }

            String MfgSel = ManufacturerHelper.GetEntitySelectList(0, String.Empty, 0, LocaleSetting, false);

            if (ManufacturerHelper.m_TblMgr.NumRootLevelNodes > 0)
            {
                MfgSel = MfgSel.Replace("<option value=\"" + ManufacturerFilterID.ToString() + "\">", "<option value=\"" + ManufacturerFilterID.ToString() + "\" selected>");
                writer.Append("Manufacturer: <select size=\"1\" name=\"ManufacturerFilterID\" onChange=\"document.FilterForm.submit();\">\n");
                writer.Append("<OPTION VALUE=\"0\" " + CommonLogic.IIF(ManufacturerFilterID == 0, " selected ", "") + ">All Manufacturers</option>\n");
                writer.Append(MfgSel);
                writer.Append("</select>\n");
                writer.Append("&nbsp;&nbsp;");
            }

            string sqlCount = "select count(*) as N from ProductType with (NOLOCK)";
            string sqlProd  = string.Empty;

            sqlProd = "select * from ProductType   with (NOLOCK)  order by DisplayOrder,Name";

            using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
            {
                con.Open();
                using (IDataReader rs = DB.GetRS(sqlCount + ";" + sqlProd, con))
                {
                    if (rs.Read() && DB.RSFieldInt(rs, "N") > 0)
                    {
                        if (rs.NextResult())
                        {
                            writer.Append("Product Type: <select size=\"1\" name=\"ProductTypeFilterID\" onChange=\"document.FilterForm.submit();\">\n");
                            writer.Append("<OPTION VALUE=\"0\" " + CommonLogic.IIF(ProductTypeFilterID == 0, " selected ", "") + ">All Product Types</option>\n");
                            while (rs.Read())
                            {
                                writer.Append("<option value=\"" + DB.RSFieldInt(rs, "ProductTypeID").ToString() + "\"");
                                if (DB.RSFieldInt(rs, "ProductTypeID") == ProductTypeFilterID)
                                {
                                    writer.Append(" selected");
                                }
                                writer.Append(">" + DB.RSFieldByLocale(rs, "Name", LocaleSetting) + "</option>");
                            }
                        }

                        writer.Append("</select>\n");
                    }
                }
            }

            writer.Append("</form>\n");

            int PageSize = AppLogic.AppConfigUSInt("Admin_ProductPageSize");

            if (PageSize == 0)
            {
                PageSize = 50;
            }
            int PageNum = CommonLogic.QueryStringUSInt("PageNum");

            if (PageNum == 0)
            {
                PageNum = 1;
            }
            bool ShowAll = (CommonLogic.QueryStringCanBeDangerousContent("show").Equals("ALL", StringComparison.InvariantCultureIgnoreCase));

            if (ShowAll)
            {
                PageSize = 0;
                PageNum  = 1;
            }

            ProductCollection products = new ProductCollection();

            products.PageSize          = PageSize;
            products.PageNum           = PageNum;
            products.CategoryID        = CategoryFilterID;
            products.SectionID         = SectionFilterID;
            products.ManufacturerID    = ManufacturerFilterID;
            products.DistributorID     = DistributorFilterID;
            products.GenreID           = GenreFilterID;
            products.VectorID          = VectorFilterID;
            products.AffiliateID       = AffiliateFilterID;
            products.CustomerLevelID   = CustomerLevelFilterID;
            products.ProductTypeID     = ProductTypeFilterID;
            products.PublishedOnly     = false;
            products.OnSaleOnly        = true;
            products.ReturnAllVariants = true;
            DataSet dsProducts = products.LoadFromDB();

            String QueryParms = "categoryfilterid=" + CategoryFilterID.ToString() + "&sectionfilterid=" + SectionFilterID.ToString() + "&manufacturerfilterid=" + ManufacturerFilterID.ToString() + "&distributorfilterid=" + DistributorFilterID.ToString() + "&genrefilterid=" + GenreFilterID.ToString() + "&Vectorfilterid=" + VectorFilterID.ToString() + "&affiliatefilterid=" + AffiliateFilterID.ToString() + "&customerlevelfilterid=" + CustomerLevelFilterID.ToString() + "&producttypefilterid=" + ProductTypeFilterID.ToString();

            int NumPages = products.NumPages;

            // ---------------------------------------------------
            // Append paging info:
            // ---------------------------------------------------
            if (NumPages > 1 || ShowAll)
            {
                writer.Append("<p class=\"PageNumber\" align=\"left\">");
                writer.Append("<p class=\"PageNumber\" align=\"left\">");
                if (CommonLogic.QueryStringCanBeDangerousContent("show") == "all")
                {
                    writer.Append("Click <a class=\"PageNumber\" href=\"" + AppLogic.AdminLinkUrl("salepricescontent.aspx") + "?" + QueryParms + "&pagenum=1\">here</a> to turn paging back on.");
                }
                else
                {
                    writer.Append("Page: ");
                    for (int u = 1; u <= NumPages; u++)
                    {
                        if (u == PageNum)
                        {
                            writer.Append(u.ToString() + " ");
                        }
                        else
                        {
                            writer.Append("<a class=\"PageNumber\" href=\"" + AppLogic.AdminLinkUrl("salepricescontent.aspx") + "?" + QueryParms + "&pagenum=" + u.ToString() + "\">" + u.ToString() + "</a> ");
                        }
                    }
                    writer.Append(" <a class=\"PageNumber\" href=\"" + AppLogic.AdminLinkUrl("salepricescontent.aspx") + "?" + QueryParms + "&show=all\">all</a>");
                }
                writer.Append("</p>\n");
            }

            writer.Append("<script type=\"text/javascript\">\n");
            writer.Append("function PriceForm_Validator(theForm)\n");
            writer.Append("{\n");
            writer.Append("submitonce(theForm);\n");
            writer.Append("return (true);\n");
            writer.Append("}\n");
            writer.Append("</script>\n");

            writer.Append("<form id=\"PriceForm\" name=\"PriceForm\" method=\"POST\" style=\"height:auto;\" action=\"" + AppLogic.AdminLinkUrl("salepricescontent.aspx") + "?categoryfilterfilterid=" + CategoryFilterID.ToString() + "&manufacturerFilterID=" + ManufacturerFilterID.ToString() + "&distributorFilterID=" + DistributorFilterID.ToString() + "&genreFilterID=" + GenreFilterID.ToString() + "&distributorFilterID=" + VectorFilterID.ToString() + "&VectorFilterID=" + AffiliateFilterID.ToString() + "&customerlevelFilterID=" + CustomerLevelFilterID.ToString() + "&producttypefilterid=" + ProductTypeFilterID.ToString() + "&pagenum=" + PageNum.ToString() + "\" onsubmit=\"return (validateForm(this) && PriceForm_Validator(this))\" >\n");
            writer.Append("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">\n");
            writer.Append("  <table border=\"0\" cellpadding=\"0\" border=\"0\" cellspacing=\"0\" width=\"100%\">\n");
            writer.Append("    <tr class=\"table-header\">\n");
            writer.Append("      <td align=\"left\" valign=\"middle\">Product ID</td>\n");
            writer.Append("      <td align=\"left\" valign=\"middle\">Variant ID</td>\n");
            writer.Append("      <td align=\"left\" valign=\"middle\">Product</td>\n");
            writer.Append("      <td align=\"left\" valign=\"middle\">SKU</td>\n");
            writer.Append("      <td align=\"left\" valign=\"middle\">Price</td>\n");
            writer.Append("      <td align=\"left\" valign=\"middle\">SalePrice</td>\n");
            writer.Append("    </tr>\n");
            foreach (DataRow row in dsProducts.Tables[0].Rows)
            {
                writer.Append("<tr class=\"table-row\">\n");
                writer.Append("<td align=\"left\" valign=\"middle\">" + DB.RowFieldInt(row, "ProductID").ToString() + "</td>\n");
                writer.Append("<td align=\"left\" valign=\"middle\">" + DB.RowFieldInt(row, "VariantID").ToString() + "</td>\n");
                writer.Append("<td align=\"left\" valign=\"middle\">");

                String Image1URL = AppLogic.LookupImage("Product", DB.RowFieldInt(row, "ProductID"), "icon", SkinID, LocaleSetting);
                if (Image1URL.Length != 0)
                {
                    writer.Append("<img src=\"" + Image1URL + "\" height=\"25\" border=\"0\" align=\"absmiddle\">");
                }
                writer.Append(DB.RowFieldByLocale(row, "Name", LocaleSetting));
                if (DB.RowField(row, "VName").Length != 0)
                {
                    writer.Append(" - ");
                }
                writer.Append(DB.RowField(row, "VName"));

                writer.Append("</td>\n");
                writer.Append("<td align=\"left\" valign=\"middle\">" + DB.RowField(row, "SKU") + DB.RowField(row, "SKUSuffix") + "</td>\n");
                writer.Append("<td align=\"left\" valign=\"middle\">");
                writer.Append("<input name=\"XPrice_" + DB.RowFieldInt(row, "VariantID").ToString() + "\" type=\"text\" size=\"10\" value=\"" + Localization.CurrencyStringForDBWithoutExchangeRate(DB.RowFieldDecimal(row, "Price")) + "\">");
                writer.Append("<input name=\"XPrice_" + DB.RowFieldInt(row, "VariantID").ToString() + "_vldt\" type=\"hidden\" value=\"[number][invalidalert=please enter a valid dollar amount]\">");
                writer.Append("</td>\n");
                writer.Append("<td align=\"left\" valign=\"middle\">");
                writer.Append("<input name=\"YPrice_" + DB.RowFieldInt(row, "VariantID").ToString() + "\" type=\"text\" size=\"10\" value=\"" + CommonLogic.IIF(DB.RowFieldDecimal(row, "SalePrice") != System.Decimal.Zero, Localization.CurrencyStringForDBWithoutExchangeRate(DB.RowFieldDecimal(row, "SalePrice")), "") + "\">");
                writer.Append("<input name=\"YPrice_" + DB.RowFieldInt(row, "VariantID").ToString() + "_vldt\" type=\"hidden\" value=\"[number][invalidalert=please enter a valid dollar amount]\">");
                writer.Append("</td>\n");
                writer.Append("</tr>\n");
            }
            products.Dispose();
            writer.Append("</table>\n");
            writer.Append("<p align=\"right\"><input class=\"normalbuttons\" type=\"submit\" value=\"Update\" name=\"Submit\"></p>\n");
            writer.Append("</form>\n");
            ltContent.Text = writer.ToString();
            dsProducts.Dispose();
        }
Пример #6
0
        protected void LoadBody()
        {
            StringBuilder tmpS = new StringBuilder(4096);

            tmpS.Append("<div style=\"width: 100%; border-top: solid 1px #d2d2d2; padding-top: 3px; margin-top: 5px;\">");

            Int32 mappingCount = DB.GetSqlN("select count(*) as N from Product" + this.m_EntitySpecs.m_EntityName + " where " + m_EntitySpecs.m_EntityName + "Id = " + this.EntityID.ToString());

            ProductCollection products = new ProductCollection(EntityName, EntityID);

            products.PageSize          = 0;
            products.PageNum           = 1;
            products.PublishedOnly     = false;
            products.ReturnAllVariants = true;
            DataSet dsProducts = new DataSet();

            if (mappingCount > 0)
            {
                dsProducts = products.LoadFromDB();
            }

            int NumProducts = products.NumProducts;

            if (NumProducts > 1000)
            {
                tmpS.Append("<p><b>" + AppLogic.GetString("admin.common.ImportExcession", SkinID, LocaleSetting) + "</b></p>");
            }
            else if (NumProducts > 0)
            {
                tmpS.Append("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">\n");
                tmpS.Append("<table border=\"0\" cellpadding=\"0\" border=\"0\" cellspacing=\"0\" width=\"100%\">\n");
                //tmpS.Append("<tr><td colspan=\"5\" align=\"right\"><input type=\"submit\" value=\"" + AppLogic.GetString("admin.entityBulkInventory.InventoryUpdate", SkinID, LocaleSetting) + "\" class=\"normalButtons\" name=\"Submit\"></td></tr>");
                tmpS.Append("<tr class=\"table-header\">\n");
                tmpS.Append("<td><b>ProductID</b></td>\n");
                tmpS.Append("<td><b>VariantID</b></td>\n");
                tmpS.Append("<td><b>Product Name</b></td>\n");
                tmpS.Append("<td><b>Variant Name</b></td>\n");
                tmpS.Append("<td><b>Inventory</b></td>\n");
                tmpS.Append("</tr>\n");

                int rowcount = dsProducts.Tables[0].Rows.Count;

                for (int i = 0; i < rowcount; i++)
                {
                    DataRow row = dsProducts.Tables[0].Rows[i];

                    int ThisProductID = DB.RowFieldInt(row, "ProductID");
                    int ThisVariantID = DB.RowFieldInt(row, "VariantID");

                    if (i % 2 == 0)
                    {
                        tmpS.Append("<tr class=\"table-row2\">\n");
                    }
                    else
                    {
                        tmpS.Append("<tr class=\"table-alternatingrow2\">\n");
                    }
                    tmpS.Append("<td align=\"left\" valign=\"middle\">");
                    tmpS.Append(ThisProductID.ToString());
                    tmpS.Append("</td>");
                    tmpS.Append("<td align=\"left\" valign=\"middle\">");
                    tmpS.Append(ThisVariantID.ToString());
                    tmpS.Append("</td>");
                    tmpS.Append("<td align=\"left\" valign=\"middle\">");
                    bool showlinks = false;
                    if (showlinks)
                    {
                        tmpS.Append("<a target=\"entityBody\" href=\"" + AppLogic.AdminLinkUrl("entityeditproducts.aspx") + "?iden=" + ThisProductID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">");
                    }
                    tmpS.Append(DB.RowFieldByLocale(row, "Name", cust.LocaleSetting));
                    if (showlinks)
                    {
                        tmpS.Append("</a>");
                    }
                    tmpS.Append("</td>\n");
                    tmpS.Append("<td align=\"left\" valign=\"middle\">");
                    if (showlinks)
                    {
                        tmpS.Append("<a target=\"entityBody\" href=\"" + AppLogic.AdminLinkUrl("entityeditproductvariant.aspx") + "?iden=" + ThisProductID.ToString() + "&variantid=" + ThisVariantID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">");
                    }
                    tmpS.Append(DB.RowFieldByLocale(row, "VariantName", cust.LocaleSetting));
                    if (showlinks)
                    {
                        tmpS.Append("</a>");
                    }
                    tmpS.Append("</td>\n");
                    tmpS.Append("<td align=\"left\" valign=\"middle\">");
                    String s = AppLogic.GetInventoryTable(ThisProductID, ThisVariantID, true, SkinID, false, true);
                    tmpS.Append(s);
                    tmpS.Append("</td>\n");
                    tmpS.Append("</tr>\n");
                }
                //tmpS.Append("<tr><td colspan=\"5\" align=\"right\"><input type=\"submit\" value=\"" + AppLogic.GetString("admin.entityBulkInventory.InventoryUpdate", SkinID, LocaleSetting) + "\" class=\"normalButtons\" name=\"Submit\"></td></tr>");
                tmpS.Append("</table>\n");
            }
            else
            {
                tmpS.Append("<p><b>" + AppLogic.GetString("admin.common.NoProductsFound", SkinID, LocaleSetting) + "</b></p>");
            }
            dsProducts.Dispose();
            products.Dispose();

            tmpS.Append("</div>");
            ltBody.Text = tmpS.ToString();
        }
Пример #7
0
        private void Render()
        {
            StringBuilder writer                = new StringBuilder();
            int           CategoryFilterID      = CommonLogic.QueryStringUSInt("CategoryFilterID");
            int           SectionFilterID       = CommonLogic.QueryStringUSInt("SectionFilterID");
            int           ProductTypeFilterID   = CommonLogic.QueryStringUSInt("ProductTypeFilterID");
            int           ManufacturerFilterID  = CommonLogic.QueryStringUSInt("ManufacturerFilterID");
            int           DistributorFilterID   = CommonLogic.QueryStringUSInt("DistributorFilterID");
            int           GenreFilterID         = CommonLogic.QueryStringUSInt("GenreFilterID");
            int           VectorFilterID        = CommonLogic.QueryStringUSInt("VectorFilterID");
            int           AffiliateFilterID     = CommonLogic.QueryStringUSInt("AffiliateFilterID");
            int           CustomerLevelFilterID = CommonLogic.QueryStringUSInt("CustomerLevelFilterID");
            String        ENCleaned             = CommonLogic.QueryStringCanBeDangerousContent("EntityName").Trim();

            // kludge for now, during conversion to properly entity/object setup:
            if (ENCleaned.Equals("CATEGORY", StringComparison.InvariantCultureIgnoreCase))
            {
                CategoryFilterID      = CommonLogic.QueryStringUSInt("EntityFilterID");
                SectionFilterID       = 0;
                ProductTypeFilterID   = 0;
                ManufacturerFilterID  = 0;
                DistributorFilterID   = 0;
                GenreFilterID         = 0;
                VectorFilterID        = 0;
                AffiliateFilterID     = 0;
                CustomerLevelFilterID = 0;
            }
            if (ENCleaned.Equals("SECTION", StringComparison.InvariantCultureIgnoreCase))
            {
                CategoryFilterID      = 0;
                SectionFilterID       = CommonLogic.QueryStringUSInt("EntityFilterID");
                ProductTypeFilterID   = 0;
                ManufacturerFilterID  = 0;
                DistributorFilterID   = 0;
                GenreFilterID         = 0;
                VectorFilterID        = 0;
                AffiliateFilterID     = 0;
                CustomerLevelFilterID = 0;
            }
            if (ENCleaned.Equals("MANUFACTURER", StringComparison.InvariantCultureIgnoreCase))
            {
                CategoryFilterID      = 0;
                SectionFilterID       = 0;
                ProductTypeFilterID   = 0;
                ManufacturerFilterID  = CommonLogic.QueryStringUSInt("EntityFilterID");
                DistributorFilterID   = 0;
                GenreFilterID         = 0;
                VectorFilterID        = 0;
                AffiliateFilterID     = 0;
                CustomerLevelFilterID = 0;
            }
            if (ENCleaned.Equals("DISTRIBUTOR", StringComparison.InvariantCultureIgnoreCase))
            {
                CategoryFilterID      = 0;
                SectionFilterID       = 0;
                ProductTypeFilterID   = 0;
                ManufacturerFilterID  = 0;
                DistributorFilterID   = CommonLogic.QueryStringUSInt("EntityFilterID");
                GenreFilterID         = 0;
                VectorFilterID        = 0;
                AffiliateFilterID     = 0;
                CustomerLevelFilterID = 0;
            }
            if (ENCleaned.Equals("GENRE", StringComparison.InvariantCultureIgnoreCase))
            {
                CategoryFilterID      = 0;
                SectionFilterID       = 0;
                ProductTypeFilterID   = 0;
                ManufacturerFilterID  = 0;
                DistributorFilterID   = 0;
                GenreFilterID         = CommonLogic.QueryStringUSInt("EntityFilterID");
                VectorFilterID        = 0;
                AffiliateFilterID     = 0;
                CustomerLevelFilterID = 0;
            }
            if (ENCleaned.Equals("VECTOR", StringComparison.InvariantCultureIgnoreCase))
            {
                CategoryFilterID      = 0;
                SectionFilterID       = 0;
                ProductTypeFilterID   = 0;
                ManufacturerFilterID  = 0;
                DistributorFilterID   = 0;
                GenreFilterID         = 0;
                VectorFilterID        = CommonLogic.QueryStringUSInt("EntityFilterID");
                AffiliateFilterID     = 0;
                CustomerLevelFilterID = 0;
            }
            if (ENCleaned.Equals("AFFILIATE", StringComparison.InvariantCultureIgnoreCase))
            {
                CategoryFilterID      = 0;
                SectionFilterID       = 0;
                ProductTypeFilterID   = 0;
                ManufacturerFilterID  = 0;
                DistributorFilterID   = 0;
                GenreFilterID         = 0;
                VectorFilterID        = 0;
                AffiliateFilterID     = CommonLogic.QueryStringUSInt("EntityFilterID");
                CustomerLevelFilterID = 0;
            }
            if (ENCleaned.Equals("CUSTOMERLEVEL", StringComparison.InvariantCultureIgnoreCase))
            {
                CategoryFilterID      = 0;
                SectionFilterID       = 0;
                ProductTypeFilterID   = 0;
                ManufacturerFilterID  = 0;
                DistributorFilterID   = 0;
                GenreFilterID         = 0;
                VectorFilterID        = 0;
                AffiliateFilterID     = 0;
                CustomerLevelFilterID = CommonLogic.QueryStringUSInt("EntityFilterID");
            }
            // end kludge


            if (CommonLogic.QueryStringCanBeDangerousContent("CategoryFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    CategoryFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminCategoryFilterID), Profile.AdminCategoryFilterID, "0"));
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("SectionFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    SectionFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminSectionFilterID), Profile.AdminSectionFilterID, "0"));
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("ManufacturerFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    ManufacturerFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminManufacturerFilterID), Profile.AdminManufacturerFilterID, "0"));
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("DistributorFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    DistributorFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminDistributorFilterID), Profile.AdminDistributorFilterID, "0"));
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("GenreFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    GenreFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminGenreFilterID), Profile.AdminGenreFilterID, "0"));
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("VectorFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    VectorFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminVectorFilterID), Profile.AdminVectorFilterID, "0"));
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("AffiliateFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    AffiliateFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminAffiliateFilterID), Profile.AdminAffiliateFilterID, "0"));
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("CustomerLevelFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    CustomerLevelFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminCustomerLevelFilterID), Profile.AdminCustomerLevelFilterID, "0"));
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("ProductTypeFilterID").Length == 0 && CommonLogic.QueryStringCanBeDangerousContent("EntityFilterID").Length == 0)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length == 0)
                {
                    ProductTypeFilterID = Convert.ToInt32(CommonLogic.IIF(CommonLogic.IsInteger(Profile.AdminProductTypeFilterID), Profile.AdminProductTypeFilterID, "0"));
                }
                if (ProductTypeFilterID != 0 && !AppLogic.ProductTypeHasVisibleProducts(ProductTypeFilterID))
                {
                    ProductTypeFilterID = 0;
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilter").Length != 0)
            {
                CategoryFilterID      = 0;
                SectionFilterID       = 0;
                ManufacturerFilterID  = 0;
                DistributorFilterID   = 0;
                GenreFilterID         = 0;
                VectorFilterID        = 0;
                AffiliateFilterID     = 0;
                CustomerLevelFilterID = 0;
                ProductTypeFilterID   = 0;
            }

            Profile.AdminCategoryFilterID      = CategoryFilterID.ToString();
            Profile.AdminSectionFilterID       = SectionFilterID.ToString();
            Profile.AdminManufacturerFilterID  = ManufacturerFilterID.ToString();
            Profile.AdminDistributorFilterID   = DistributorFilterID.ToString();
            Profile.AdminGenreFilterID         = GenreFilterID.ToString();
            Profile.AdminVectorFilterID        = VectorFilterID.ToString();
            Profile.AdminAffiliateFilterID     = AffiliateFilterID.ToString();
            Profile.AdminCustomerLevelFilterID = CustomerLevelFilterID.ToString();
            Profile.AdminProductTypeFilterID   = ProductTypeFilterID.ToString();

            EntityHelper CategoryHelper      = AppLogic.LookupHelper(EntityHelpers, "Category");
            EntityHelper SectionHelper       = AppLogic.LookupHelper(EntityHelpers, "Section");
            EntityHelper ManufacturerHelper  = AppLogic.LookupHelper(EntityHelpers, "Manufacturer");
            EntityHelper DistributorHelper   = AppLogic.LookupHelper(EntityHelpers, "Distributor");
            EntityHelper GenreHelper         = AppLogic.LookupHelper(EntityHelpers, "Genre");
            EntityHelper VectorHelper        = AppLogic.LookupHelper(EntityHelpers, "VECTOR");
            EntityHelper AffiliateHelper     = AppLogic.LookupHelper(EntityHelpers, "Affiliate");
            EntityHelper CustomerLevelHelper = AppLogic.LookupHelper(EntityHelpers, "CustomerLevel");

            if (CommonLogic.QueryStringCanBeDangerousContent("DeleteID").Length != 0)
            {
                int DeleteID = CommonLogic.QueryStringUSInt("DeleteID");
                DB.ExecuteSQL("delete from ShoppingCart where productid=" + DeleteID.ToString());
                DB.ExecuteSQL("delete from kitcart where productid=" + DeleteID.ToString());
                DB.ExecuteSQL("delete from customcart where productid=" + DeleteID.ToString());
                DB.ExecuteSQL("update Product set deleted=1 where ProductID=" + DeleteID.ToString());

                /* Modified by : mark
                 * Date : 11.16.2006
                 * No : 108
                 * Remove all Entity mappings for this product
                 */
                DB.ExecuteSQL("delete from ProductAffiliate where productid=" + DeleteID.ToString());
                DB.ExecuteSQL("delete from ProductCategory where productid=" + DeleteID.ToString());
                DB.ExecuteSQL("delete from ProductCustomerLevel where productid=" + DeleteID.ToString());
                DB.ExecuteSQL("delete from ProductDistributor where productid=" + DeleteID.ToString());
                DB.ExecuteSQL("delete from ProductGenre where productid=" + DeleteID.ToString());
                DB.ExecuteSQL("delete from ProductVector where productid=" + DeleteID.ToString());
                DB.ExecuteSQL("delete from ProductLocaleSetting where productid=" + DeleteID.ToString());
                DB.ExecuteSQL("delete from ProductManufacturer where productid=" + DeleteID.ToString());
                DB.ExecuteSQL("delete from ProductSection where productid=" + DeleteID.ToString());
                /******* end modification ****************/
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("NukeID").Length != 0)
            {
                int DeleteID = CommonLogic.QueryStringUSInt("NukeID");
                DB.ExecuteLongTimeSQL("aspdnsf_NukeProduct " + DeleteID.ToString(), 120);
            }

            writer.Append("<form id=\"FilterForm\" name=\"FilterForm\" method=\"GET\" action=\"" + AppLogic.AdminLinkUrl("products.aspx") + "\">\n");
            writer.Append("<a href=\"" + AppLogic.AdminLinkUrl("products.aspx") + "?resetfilters=true&categoryfilterid=0&sectionfilterid=0&producttypefilterid=0&manufacturerfilterid=0&distributorfilterid=0&genreid=0&Vectorid=0&affiliatefilterid=0&customerlevelfilterid=0\">" + AppLogic.GetString("admin.common.ResetFiltersUC", SkinID, LocaleSetting) + "</a>&nbsp;&nbsp;&nbsp;&nbsp;");

            String CatSel = CategoryHelper.GetEntitySelectList(0, String.Empty, 0, LocaleSetting, false);

            // mark current Category:
            CatSel = CatSel.Replace("<option value=\"" + CategoryFilterID.ToString() + "\">", "<option value=\"" + CategoryFilterID.ToString() + "\" selected>");
            if (CategoryHelper.m_TblMgr.NumRootLevelNodes > 0)
            {
                writer.Append(AppLogic.GetString("AppConfig.CategoryPromptSingular", SkinID, LocaleSetting) + ": ");
                writer.Append("<select onChange=\"document.FilterForm.submit()\" style=\"font-size: 9px;\" size=\"1\" name=\"CategoryFilterID\">\n");
                writer.Append("<OPTION VALUE=\"0\" " + CommonLogic.IIF(CategoryFilterID == 0, " selected ", "") + ">" + AppLogic.GetString("admin.common.AllCategories", SkinID, LocaleSetting) + "</option>\n");
                writer.Append(CatSel);
                writer.Append("</select>\n");
                writer.Append("&nbsp;&nbsp;");
            }

            String SecSel = SectionHelper.GetEntitySelectList(0, String.Empty, 0, LocaleSetting, false);

            if (SectionHelper.m_TblMgr.NumRootLevelNodes > 0)
            {
                SecSel = SecSel.Replace("<option value=\"" + SectionFilterID.ToString() + "\">", "<option value=\"" + SectionFilterID.ToString() + "\" selected>");
                writer.Append(AppLogic.GetString("AppConfig.SectionPromptSingular", SkinID, LocaleSetting) + ": ");
                writer.Append("<select onChange=\"document.FilterForm.submit()\" style=\"font-size: 9px;\" size=\"1\" name=\"SectionFilterID\">\n");
                writer.Append("<OPTION VALUE=\"0\" " + CommonLogic.IIF(SectionFilterID == 0, " selected ", "") + ">" + AppLogic.GetString("admin.common.AllSections", SkinID, LocaleSetting) + "</option>\n");
                writer.Append(SecSel);
                writer.Append("</select>\n");
                writer.Append("&nbsp;&nbsp;");
            }

            String MfgSel = ManufacturerHelper.GetEntitySelectList(0, String.Empty, 0, LocaleSetting, false);

            if (ManufacturerHelper.m_TblMgr.NumRootLevelNodes > 0)
            {
                MfgSel = MfgSel.Replace("<option value=\"" + ManufacturerFilterID.ToString() + "\">", "<option value=\"" + ManufacturerFilterID.ToString() + "\" selected>");
                writer.Append(AppLogic.GetString("admin.common.Manufacturer", SkinID, LocaleSetting) + " <select size=\"1\" name=\"ManufacturerFilterID\" onChange=\"document.FilterForm.submit();\">\n");
                writer.Append("<OPTION VALUE=\"0\" " + CommonLogic.IIF(ManufacturerFilterID == 0, " selected ", "") + ">" + AppLogic.GetString("admin.common.AllManufacturers", SkinID, LocaleSetting) + "</option>\n");
                writer.Append(MfgSel);
                writer.Append("</select>\n");
                writer.Append("&nbsp;&nbsp;");
            }

            string prodTypeSql = string.Empty;

            if (AppLogic.ProductIsMLExpress())
            {
                prodTypeSql = "select count(*) as N from ProductType   with (NOLOCK); select * from ProductType   with (NOLOCK) where [name] not like '%pack%' and [name] not like '%kit%' and [name] not like '%gift card%' order by DisplayOrder,Name";
            }
            else
            {
                prodTypeSql = "select count(*) as N from ProductType   with (NOLOCK); select * from ProductType   with (NOLOCK)  order by DisplayOrder,Name";
            }

            using (SqlConnection dbconn = new SqlConnection(DB.GetDBConn()))
            {
                dbconn.Open();
                using (IDataReader rs = DB.GetRS(prodTypeSql, dbconn))
                {
                    if (rs.Read() && DB.RSFieldInt(rs, "N") > 0)
                    {
                        writer.Append(AppLogic.GetString("admin.common.ProductType", SkinID, LocaleSetting) + " <select size=\"1\" name=\"ProductTypeFilterID\" onChange=\"document.FilterForm.submit();\">\n");
                        writer.Append("<OPTION VALUE=\"0\" " + CommonLogic.IIF(ProductTypeFilterID == 0, " selected ", "") + ">" + AppLogic.GetString("admin.common.AllProductTypes", SkinID, LocaleSetting) + "</option>\n");
                        if (rs.NextResult())
                        {
                            while (rs.Read())
                            {
                                writer.Append("<option value=\"" + DB.RSFieldInt(rs, "ProductTypeID").ToString() + "\"");
                                if (DB.RSFieldInt(rs, "ProductTypeID") == ProductTypeFilterID)
                                {
                                    writer.Append(" selected");
                                }
                                writer.Append(">" + DB.RSFieldByLocale(rs, "Name", LocaleSetting) + "</option>");
                            }
                        }
                        writer.Append("</select>\n");
                    }
                }
            }



            writer.Append("</form>\n");

            int PageSize = AppLogic.AppConfigUSInt("Admin_ProductPageSize");

            if (PageSize == 0)
            {
                PageSize = 50;
            }
            int PageNum = CommonLogic.QueryStringUSInt("PageNum");

            if (PageNum == 0)
            {
                PageNum = 1;
            }
            bool ShowAll = (CommonLogic.QueryStringCanBeDangerousContent("show").Equals("ALL", StringComparison.InvariantCultureIgnoreCase));

            if (ShowAll)
            {
                PageSize = 0;
                PageNum  = 1;
            }

            ProductCollection products = new ProductCollection();

            products.PageSize        = PageSize;
            products.PageNum         = PageNum;
            products.CategoryID      = CategoryFilterID;
            products.SectionID       = SectionFilterID;
            products.ManufacturerID  = ManufacturerFilterID;
            products.DistributorID   = DistributorFilterID;
            products.GenreID         = GenreFilterID;
            products.VectorID        = VectorFilterID;
            products.AffiliateID     = AffiliateFilterID;
            products.CustomerLevelID = CustomerLevelFilterID;
            products.ProductTypeID   = ProductTypeFilterID;
            products.PublishedOnly   = false;
            DataSet dsProducts = products.LoadFromDB(true);

            String QueryParms = "categoryfilterid=" + CategoryFilterID.ToString() + "&sectionfilterid=" + SectionFilterID.ToString() + "&manufacturerfilterid=" + ManufacturerFilterID.ToString() + "&distributorfilterid=" + DistributorFilterID.ToString() + "&genrefilterid=" + GenreFilterID.ToString() + "&Vectorfilterid=" + VectorFilterID.ToString() + "&affiliatefilterid=" + AffiliateFilterID.ToString() + "&customerlevelfilterid=" + CustomerLevelFilterID.ToString() + "&producttypefilterid=" + ProductTypeFilterID.ToString();

            int NumPages = products.NumPages;

            // ---------------------------------------------------
            // Append paging info:
            // ---------------------------------------------------
            if (NumPages > 1 || ShowAll)
            {
                writer.Append("<p class=\"PageNumber\" align=\"left\">");
                writer.Append("<p class=\"PageNumber\" align=\"left\">");
                if (CommonLogic.QueryStringCanBeDangerousContent("show") == "all")
                {
                    writer.Append(String.Format(AppLogic.GetString("admin.common.Clickheretoturnpagingbackon", SkinID, LocaleSetting), "<a class=\"PageNumber\" href=\"" + AppLogic.AdminLinkUrl("products.aspx") + "?" + QueryParms + "&pagenum=1\">", "</a>"));
                }
                else
                {
                    writer.Append(AppLogic.GetString("admin.common.Page", SkinID, LocaleSetting) + ":");
                    for (int u = 1; u <= NumPages; u++)
                    {
                        if (u == PageNum)
                        {
                            writer.Append(u.ToString() + " ");
                        }
                        else
                        {
                            writer.Append("<a class=\"PageNumber\" href=\"" + AppLogic.AdminLinkUrl("products.aspx") + "?" + QueryParms + "&pagenum=" + u.ToString() + "\">" + u.ToString() + "</a> ");
                        }
                    }
                    writer.Append(" <a class=\"PageNumber\" href=\"" + AppLogic.AdminLinkUrl("products.aspx") + "?" + QueryParms + "&show=all\">" + AppLogic.GetString("admin.common.All", SkinID, LocaleSetting) + "</a>");
                }
                writer.Append("</p>\n");
            }

            writer.Append("<form id=\"Form1\" name=\"Form1\" method=\"POST\" action=\"" + AppLogic.AdminLinkUrl("products.aspx") + "?categoryfilterfilterid=" + CategoryFilterID.ToString() + "&manufacturerFilterID=" + ManufacturerFilterID.ToString() + "&distributorFilterID=" + DistributorFilterID.ToString() + "&genreFilterID=" + GenreFilterID.ToString() + "&VectorFilterID=" + VectorFilterID.ToString() + "&affiliateFilterID=" + AffiliateFilterID.ToString() + "&customerlevelFilterID=" + CustomerLevelFilterID.ToString() + "&producttypefilterid=" + ProductTypeFilterID.ToString() + "\">\n");
            writer.Append("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">\n");
            if (AppLogic.ProductIsMLExpress() && AppLogic.MaxProductsExceeded())
            {
                writer.Append("<font class=\"errorMsg\">" + AppLogic.GetString("admin.entityProduct.ErrorMsg", SkinID, LocaleSetting) + "</font>");
                writer.Append("<p align=\"left\"><input class=\"normalButtonsDisabled\" type=\"button\" value=\"" + AppLogic.GetString("admin.products.AddNew", SkinID, LocaleSetting) + "\" name=\"AddNew\"  disabled=\"disabled\"></p>");
            }
            else
            {
                writer.Append("<p align=\"left\"><input class=\"normalButtons\" type=\"button\" value=\"" + AppLogic.GetString("admin.products.AddNew", SkinID, LocaleSetting) + "\" name=\"AddNew\" onClick=\"self.location='" + AppLogic.AdminLinkUrl("editProduct.aspx") + "?categoryfilterid=" + CategoryFilterID.ToString() + "&sectionfilterid=" + SectionFilterID.ToString() + "&manufacturerfilterID=" + ManufacturerFilterID.ToString() + "&producttypefilterid=" + ProductTypeFilterID.ToString() + "';\"></p>");
            }
            writer.Append("  <table border=\"0\" cellpadding=\"0\" border=\"0\" cellspacing=\"0\" width=\"100%\">");
            writer.Append("    <tr class=\"table-header\">\n");
            writer.Append("</td>");
            writer.Append("      <td align=\"center\" valign=\"middle\">" + AppLogic.GetString("admin.common.ID", SkinID, LocaleSetting) + "</td>\n");
            writer.Append("      <td align=\"left\" valign=\"middle\">" + AppLogic.GetString("admin.common.Product", SkinID, LocaleSetting) + "</td>\n");
            writer.Append("      <td align=\"left\" valign=\"middle\">" + AppLogic.GetString("admin.common.SKU", SkinID, LocaleSetting) + "</td>\n");
            writer.Append("      <td align=\"left\" valign=\"middle\">" + AppLogic.GetString("admin.common.MfgPartNo", SkinID, LocaleSetting) + "</td>\n");
            writer.Append("      <td align=\"left\" valign=\"middle\">" + AppLogic.GetString("admin.common.Inventory", SkinID, LocaleSetting) + "</td>\n");
            writer.Append("      <td align=\"center\" valign=\"middle\">" + AppLogic.GetString("admin.common.Edit", SkinID, LocaleSetting) + "</td>\n");
            writer.Append("      <td align=\"center\" valign=\"middle\">" + AppLogic.GetString("admin.common.Clone", SkinID, LocaleSetting) + "</td>\n");
            writer.Append("      <td align=\"center\" valign=\"middle\">" + AppLogic.GetString("admin.common.Variants", SkinID, LocaleSetting) + "</td>\n");
            if (!AppLogic.ProductIsMLExpress())
            {
                writer.Append("      <td align=\"center\" valign=\"middle\">" + AppLogic.GetString("admin.common.Ratings", SkinID, LocaleSetting) + "</td>\n");
            }
            writer.Append("      <td align=\"center\" valign=\"middle\">" + AppLogic.GetString("admin.common.SoftDelete", SkinID, LocaleSetting) + "</td>\n");
            writer.Append("      <td align=\"center\" valign=\"middle\">" + AppLogic.GetString("admin.common.Nuke", SkinID, LocaleSetting) + "</td>\n");
            writer.Append("    </tr>\n");


            string style;
            int    counter = 0;

            foreach (DataRow row in dsProducts.Tables[0].Rows)
            {
                if (counter % 2 == 0)
                {
                    style = "\"table-row2\"";
                }
                else
                {
                    style = "\"table-alternatingrow2\"";
                }
                writer.Append("    <tr class=" + style + ">\n");
                writer.Append("      <td align=\"center\" valign=\"middle\">" + DB.RowFieldInt(row, "ProductID").ToString() + "</td>\n");
                writer.Append("      <td align=\"left\" valign=\"middle\">");

                String Image1URL = AppLogic.LookupImage("Product", DB.RowFieldInt(row, "ProductID"), "icon", SkinID, LocaleSetting);
                writer.Append("<a href=\"" + AppLogic.AdminLinkUrl("editProduct.aspx") + "?Productid=" + DB.RowFieldInt(row, "ProductID").ToString() + "&categoryfilterid=" + CategoryFilterID.ToString() + "&sectionFilterID=" + SectionFilterID.ToString() + "&manufacturerfilterid=" + ManufacturerFilterID.ToString() + "&producttypefilterid=" + ProductTypeFilterID.ToString() + "\">");
                writer.Append("<img src=\"" + Image1URL + "\" height=\"25\" border=\"0\" align=\"absmiddle\">");
                writer.Append("</a>&nbsp;\n");
                writer.Append("<a href=\"" + AppLogic.AdminLinkUrl("editProduct.aspx") + "?Productid=" + DB.RowFieldInt(row, "ProductID").ToString() + "&categoryfilterid=" + CategoryFilterID.ToString() + "&sectionFilterID=" + SectionFilterID.ToString() + "&manufacturerfilterid=" + ManufacturerFilterID.ToString() + "&producttypefilterid=" + ProductTypeFilterID.ToString() + "\">");
                writer.Append(DB.RowFieldByLocale(row, "Name", LocaleSetting));
                writer.Append("</a>");

                writer.Append("</td>\n");
                writer.Append("<td align=\"left\" valign=\"middle\">" + DB.RowField(row, "SKU") + "</td>\n");
                writer.Append("<td align=\"left\" valign=\"middle\">" + DB.RowField(row, "ManufacturerPartNumber") + "</td>\n");
                writer.Append("<td align=\"left\" valign=\"middle\">");
                if (DB.RowFieldBool(row, "IsSystem"))
                {
                    writer.Append("System<br/>Product"); // this type of product can only be deleted in the db!
                }
                else
                {
                    if (AppLogic.ProductTracksInventoryBySizeAndColor(DB.RowFieldInt(row, "ProductID")))
                    {
                        writer.Append("<a href=\"" + AppLogic.AdminLinkUrl("editinventory.aspx") + "?productid=" + DB.RowFieldInt(row, "ProductID").ToString() + "\">" + AppLogic.GetString("admin.common.Inventory", SkinID, LocaleSetting) + "</a>\n");
                    }
                    else
                    {
                        writer.Append(DB.RowFieldInt(row, "Inventory").ToString());
                    }
                }
                writer.Append("</td>");

                writer.Append("<td align=\"center\" valign=\"middle\">");
                if (DB.RowFieldBool(row, "IsSystem"))
                {
                    writer.Append("System<br/>Product"); // this type of product can only be deleted in the db!
                }
                else
                {
                    writer.Append("<input class=\"normalButtons\"  type=\"button\" value=\"Edit\" name=\"Edit_" + DB.RowFieldInt(row, "ProductID").ToString() + "\" onClick=\"self.location='" + AppLogic.AdminLinkUrl("editProduct.aspx") + "?Productid=" + DB.RowFieldInt(row, "ProductID").ToString() + "&categoryfilterid=" + CategoryFilterID.ToString() + "&sectionfilterID=" + SectionFilterID.ToString() + "&manufacturerfilterid=" + ManufacturerFilterID.ToString() + "&producttypefilterid=" + ProductTypeFilterID.ToString() + "'\">\n");
                }
                writer.Append("</td>");

                writer.Append("<td align=\"center\" valign=\"middle\">");
                if (DB.RowFieldBool(row, "IsSystem"))
                {
                    writer.Append(AppLogic.GetString("admin.common.System-Product", SkinID, LocaleSetting)); // this type of product can only be deleted in the db!
                }
                else
                {
                    if (!AppLogic.ProductIsMLExpress() || !AppLogic.MaxProductsExceeded())
                    {
                        writer.Append("<input class=\"normalButtons\" type=\"button\" value=\"" + AppLogic.GetString("admin.common.Clone", SkinID, LocaleSetting) + "\" name=\"Clone_" + DB.RowFieldInt(row, "ProductID").ToString() + "\" onClick=\"if(confirm('" + AppLogic.GetString("admin.entityProducts.CloneQuestion", SkinID, LocaleSetting) + "')) {self.location='" + AppLogic.AdminLinkUrl("cloneproduct.aspx") + "?productid=" + DB.RowFieldInt(row, "ProductID").ToString() + "&categoryfilterid=" + CategoryFilterID.ToString() + "&sectionfilterID=" + SectionFilterID.ToString() + "&manufacturerfilterid=" + ManufacturerFilterID.ToString() + "&producttypefilterid=" + ProductTypeFilterID.ToString() + "';}\">\n");
                    }
                    else
                    {
                        writer.Append("<input class=\"normalButtonsDisabled\" type=\"button\" value=\"" + AppLogic.GetString("admin.common.Clone", SkinID, LocaleSetting) + "\" name=\"Clone_" + DB.RowFieldInt(row, "ProductID").ToString() + " disabled=\"disabled\" \">\n");
                    }
                }
                writer.Append("</td>");

                writer.Append("<td align=\"center\" valign=\"middle\">");
                if (DB.RowFieldBool(row, "IsSystem"))
                {
                    writer.Append(AppLogic.GetString("admin.common.System-Product", SkinID, LocaleSetting)); // this type of product can only be deleted in the db!
                }
                else
                {
                    int NumVariants = DB.GetSqlN("select count(*) as N from productvariant   with (NOLOCK)  where deleted=0 and productid=" + DB.RowFieldInt(row, "ProductID").ToString());
                    writer.Append("<input class=\"normalButtons\" type=\"button\" value=\"" + String.Format(AppLogic.GetString("admin.products.Variants", SkinID, LocaleSetting), NumVariants.ToString()) + "\" name=\"Variants_" + DB.RowFieldInt(row, "ProductID").ToString() + "\" onClick=\"self.location='" + CommonLogic.IIF(NumVariants == 1, "" + AppLogic.AdminLinkUrl("variants.aspx") + "?Productid=" + DB.RowFieldInt(row, "ProductID").ToString(), "" + AppLogic.AdminLinkUrl("variants.aspx") + "?Productid=" + DB.RowFieldInt(row, "ProductID").ToString()) + "'\">\n");
                }
                writer.Append("</td>");
                if (!AppLogic.ProductIsMLExpress())
                {
                    writer.Append("<td align=\"center\" valign=\"middle\">");
                    if (DB.RowFieldBool(row, "IsSystem"))
                    {
                        writer.Append(AppLogic.GetString("admin.common.System-Product", SkinID, LocaleSetting)); // this type of product can only be deleted in the db!
                    }
                    else
                    {
                        int NumRatings = DB.GetSqlN("select count(*) as N from rating   with (NOLOCK)  where productid=" + DB.RowFieldInt(row, "ProductID").ToString());
                        writer.Append("<input class=\"normalButtons\" type=\"button\" value=\"" + String.Format(AppLogic.GetString("admin.entityProducts.Ratings", SkinID, LocaleSetting), NumRatings.ToString()) + "\" name=\"Ratings_" + DB.RowFieldInt(row, "ProductID").ToString() + "\" onClick=\"self.location='" + AppLogic.AdminLinkUrl("productratings.aspx") + "?Productid=" + DB.RowFieldInt(row, "ProductID").ToString() + "'\">\n");
                    }

                    writer.Append("</td>");
                }
                writer.Append("<td align=\"center\" valign=\"middle\">");
                if (DB.RowFieldBool(row, "IsSystem"))
                {
                    writer.Append(AppLogic.GetString("admin.common.System-Product", SkinID, LocaleSetting)); // this type of product can only be deleted in the db!
                }
                else
                {
                    if (DB.GetSqlN("select count(*) N from ShoppingCart with (NOLOCK) where VariantID=" + DB.RowFieldInt(row, "VariantID").ToString() + " and CartType=" + ((int)CartTypeEnum.RecurringCart).ToString()) > 0)
                    {
                        //product is in recurring order. cannot be deleted
                        writer.Append("<input disabled  type=\"image\" src=\"Skins/Skin_1/images/disabledButton.jpg\" alt=\"" + AppLogic.GetString("admin.common.DeleteNAInfoRecurring", SkinID, LocaleSetting) + "\" value='" + AppLogic.GetString("admin.common.DeleteNA", SkinID, LocaleSetting) + "' /> ");
                    }
                    else
                    {
                        //product is not in any recurring order. can be deleted
                        writer.Append("<input class=\"normalButtons\" type=\"button\" value=\"" + AppLogic.GetString("admin.common.Delete", SkinID, LocaleSetting) + "\" name=\"Delete_" + DB.RowFieldInt(row, "ProductID").ToString() + "\" onClick=\"DeleteProduct(" + DB.RowFieldInt(row, "ProductID").ToString() + ")\">");
                    }
                }
                writer.Append("</td>");

                writer.Append("<td align=\"center\" valign=\"middle\">");
                if (DB.RowFieldBool(row, "IsSystem"))
                {
                    writer.Append(AppLogic.GetString("admin.common.System-Product", SkinID, LocaleSetting)); // this type of product can only be deleted in the db!
                }
                else
                {
                    writer.Append("<input class=\"normalButtons\" type=\"button\" value=\"" + AppLogic.GetString("admin.common.Nuke", SkinID, LocaleSetting) + "\" name=\"Nuke_" + DB.RowFieldInt(row, "ProductID").ToString() + "\" onClick=\"NukeProduct(" + DB.RowFieldInt(row, "ProductID").ToString() + ")\">");
                }
                writer.Append("</td>");
                writer.Append("</tr>\n");
                counter++;
            }
            products.Dispose();
            writer.Append("<tr class=\"table-footer\">\n");
            writer.Append("      <td align=\"left\" valign=\"top\" colspan=\"13\"></td>\n");
            writer.Append("</tr>\n");
            writer.Append("  </table>\n");
            if (AppLogic.ProductIsMLExpress() && AppLogic.MaxProductsExceeded())
            {
                writer.Append("<p align=\"left\"><input class=\"normalButtonsDisabled\" type=\"button\" value=\"" + AppLogic.GetString("admin.products.AddNew", SkinID, LocaleSetting) + "\" name=\"AddNew\"  disabled=\"disabled\"></p>");
            }
            else
            {
                writer.Append("<p align=\"left\"><input class=\"normalButtons\" type=\"button\" value=\"" + AppLogic.GetString("admin.products.AddNew", SkinID, LocaleSetting) + "\" name=\"AddNew\" onClick=\"self.location='" + AppLogic.AdminLinkUrl("editProduct.aspx") + "?categoryfilterid=" + CategoryFilterID.ToString() + "&sectionfilterid=" + SectionFilterID.ToString() + "&manufacturerfilterid=" + ManufacturerFilterID.ToString() + "&producttypefilterid=" + ProductTypeFilterID.ToString() + "';\"></p>");
            }
            writer.Append("</form>\n");


            if (NumPages > 1 || ShowAll)
            {
                writer.Append("<p class=\"PageNumber\" align=\"left\">");
                writer.Append("<p class=\"PageNumber\" align=\"left\">");
                if (CommonLogic.QueryStringCanBeDangerousContent("show") == "all")
                {
                    writer.Append(String.Format(AppLogic.GetString("admin.common.Clickheretoturnpagingbackon", SkinID, LocaleSetting), "<a class=\"PageNumber\" href=\"" + AppLogic.AdminLinkUrl("products.aspx") + "?" + QueryParms + "&pagenum=1\">", "</a>"));
                }
                else
                {
                    writer.Append(AppLogic.GetString("admin.common.Page", SkinID, LocaleSetting) + ": ");
                    for (int u = 1; u <= NumPages; u++)
                    {
                        if (u == PageNum)
                        {
                            writer.Append(u.ToString() + " ");
                        }
                        else
                        {
                            writer.Append("<a class=\"PageNumber\" href=\"" + AppLogic.AdminLinkUrl("products.aspx") + "?" + QueryParms + "&pagenum=" + u.ToString() + "\">" + u.ToString() + "</a> ");
                        }
                    }
                    writer.Append(" <a class=\"PageNumber\" href=\"" + AppLogic.AdminLinkUrl("products.aspx") + "?" + QueryParms + "&show=all\">" + AppLogic.GetString("admin.common.All", SkinID, LocaleSetting) + "</a>");
                }
                writer.Append("</p>\n");
            }

            writer.Append("<script type=\"text/javascript\">\n");
            writer.Append("function DeleteProduct(id)\n");
            writer.Append("{\n");
            writer.Append("  if(confirm('" + String.Format(AppLogic.GetString("admin.common.SoftDeleteProductsQuestion", SkinID, LocaleSetting), "'+ id +'") + "'\n");
            writer.Append("  {\n");
            writer.Append("      self.location = '" + AppLogic.AdminLinkUrl("products.aspx") + "?deleteid=' + id;\n");
            writer.Append("  }\n");
            writer.Append("}\n");

            writer.Append("function NukeProduct(id)\n");
            writer.Append("{\n");
            writer.Append("  if(confirm(" + String.Format(AppLogic.GetString("admin.common.NukeProductQuestion", SkinID, LocaleSetting), "'+ id +'") + "'\n");
            writer.Append("  {\n");
            writer.Append("      self.location = '" + AppLogic.AdminLinkUrl("products.aspx") + "?nukeid=' + id;\n");
            writer.Append("  }\n");
            writer.Append("}\n");

            writer.Append("</SCRIPT>\n");
            dsProducts.Dispose();
            ltContent.Text = writer.ToString();
        }
Пример #8
0
        protected void LoadBody(string locale)
        {
            ltBody.Text = String.Empty;
            var mappingCount = DB.GetSqlN("select count(*) as N from Product" + this.m_EntitySpecs.m_EntityName + " where " + m_EntitySpecs.m_EntityName + "Id = " + this.EntityID.ToString());

            var products = new ProductCollection(m_EntitySpecs.m_EntityName, EntityID);

            products.PageSize          = 0;
            products.PageNum           = 1;
            products.PublishedOnly     = false;
            products.ReturnAllVariants = false;

            var dsProducts = new DataSet();

            if (mappingCount > 0)
            {
                dsProducts = products.LoadFromDB();
            }

            var NumProducts = products.NumProducts;

            if (NumProducts > 1000)
            {
                AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.common.ImportExcession", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                MainBody.Visible = false;
            }
            else if (NumProducts > 0)
            {
                ltBody.Text += ("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">\n");
                ltBody.Text += ("<table class=\"table\">\n");
                ltBody.Text += ("<tr>\n");
                ltBody.Text += ("<td>" + AppLogic.GetString("admin.common.ProductID", SkinID, locale) + "</td>\n");
                ltBody.Text += ("<td>" + AppLogic.GetString("admin.common.VariantID", SkinID, locale) + "</td>\n");
                ltBody.Text += ("<td>" + AppLogic.GetString("admin.common.ProductName", SkinID, locale) + "</td>\n");
                ltBody.Text += ("<td>" + AppLogic.GetString("admin.common.VariantName", SkinID, locale) + "</td>\n");
                ltBody.Text += ("<td>" + AppLogic.GetString("admin.common.ProductFields", SkinID, locale) + "</td>\n");

                ltBody.Text += ("</tr>\n");
                var LastProductID = 0;

                var rowcount = dsProducts.Tables[0].Rows.Count;

                for (int i = 0; i < rowcount; i++)
                {
                    var row = dsProducts.Tables[0].Rows[i];

                    var ThisProductID = DB.RowFieldInt(row, "ProductID");
                    var ThisVariantID = DB.RowFieldInt(row, "VariantID");

                    if (i % 2 == 0)
                    {
                        ltBody.Text += ("<tr>\n");
                    }
                    else
                    {
                        ltBody.Text += ("<tr>\n");
                    }

                    ltBody.Text += ("<td>");
                    ltBody.Text += (ThisProductID.ToString());
                    ltBody.Text += ("</td>");
                    ltBody.Text += ("<td>");
                    ltBody.Text += (ThisVariantID.ToString());
                    ltBody.Text += ("</td>");
                    ltBody.Text += ("<td>");

                    bool showlinks = false;
                    if (showlinks)
                    {
                        ltBody.Text += ("<a href=\"" + AppLogic.AdminLinkUrl("product.aspx") + "?productid=" + ThisProductID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">");
                    }

                    ltBody.Text += (DB.RowFieldByLocale(row, "Name", locale));

                    if (showlinks)
                    {
                        ltBody.Text += ("</a>");
                    }

                    ltBody.Text += ("</td>\n");
                    ltBody.Text += ("<td>");

                    if (showlinks)
                    {
                        ltBody.Text += ("<a href=\"" + AppLogic.AdminLinkUrl("variant.aspx") + "?productid=" + ThisProductID.ToString() + "&variantid=" + ThisVariantID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">");
                    }

                    ltBody.Text += (DB.RowFieldByLocale(row, "VariantName", locale));

                    if (showlinks)
                    {
                        ltBody.Text += ("</a>");
                    }

                    ltBody.Text += ("</td>\n");
                    ltBody.Text += ("<td>");
                    ltBody.Text += ("<div>");
                    ltBody.Text += ("" + AppLogic.GetString("admin.topic.setitle", SkinID, locale) + "<br/>");
                    ltBody.Text += ("<input maxLength=\"100\" name=\"SETitle_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" id=\"SETitle_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + XmlCommon.GetLocaleEntry(DB.RowField(row, "SETitle"), SelectedLocale.Name, false) + "\" class=\"singleLongest\" /><br/>");
                    ltBody.Text += ("" + AppLogic.GetString("admin.topic.sekeywords", SkinID, locale) + "<br/>");
                    ltBody.Text += ("<input maxLength=\"255\" name=\"SEKeywords_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" id=\"SEKeywords" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + XmlCommon.GetLocaleEntry(DB.RowField(row, "SEKeywords"), SelectedLocale.Name, false) + "\" class=\"singleLongest\" /><br/>");
                    ltBody.Text += ("" + AppLogic.GetString("admin.topic.sedescription", SkinID, locale) + "<br/>");
                    ltBody.Text += ("<input maxLength=\"255\" name=\"SEDescription_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" id=\"SEDescription" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + XmlCommon.GetLocaleEntry(DB.RowField(row, "SEDescription"), SelectedLocale.Name, false) + "\" class=\"singleLongest\" /><br/>");

                    ltBody.Text  += ("</div>");
                    ltBody.Text  += ("</td>\n");
                    ltBody.Text  += ("</tr>\n");
                    LastProductID = ThisProductID;
                }
                ltBody.Text += ("</table>\n");
            }
            else
            {
                AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.common.NoProductsFound", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                MainBody.Visible = false;
            }
            dsProducts.Dispose();
            products.Dispose();
        }
        protected void LoadBody()
        {
            ltBody.Text  = "<form method=\"post\" action=\"entityBulkDownloadFiles.aspx?entityname=" + EntityName + "&EntityID=" + EntityID + "\">";
            ltBody.Text += "<div style=\"width: 100%; border-top: solid 1px #d2d2d2; padding-top: 3px; margin-top: 5px;\">";
            ltBody.Text += ("<input type=\"hidden\" name=\"EntityName\" value=\"" + EntityName + "\">\n");
            ltBody.Text += ("<input type=\"hidden\" name=\"EntityID\" value=\"" + EntityID + "\">\n");

            ProductCollection products = new ProductCollection(m_EntitySpecs.m_EntityName, EntityID);

            products.PageSize          = 0;
            products.PageNum           = 1;
            products.PublishedOnly     = false;
            products.ReturnAllVariants = true;

            Int32 mappingCount = DB.GetSqlN("select count(*) as N from Product" + this.m_EntitySpecs.m_EntityName + " where " + m_EntitySpecs.m_EntityName + "Id = " + this.EntityID.ToString());

            DataSet dsProducts = new DataSet();

            if (mappingCount > 0)
            {
                dsProducts = products.LoadFromDB();
            }

            int NumProducts = products.NumProducts;

            if (NumProducts > 1000)
            {
                ltBody.Text += ("<p><b>" + AppLogic.GetString("admin.common.ImportExcession", SkinID, LocaleSetting) + "</b></p>");
            }
            else if (NumProducts > 0)
            {
                ltBody.Text += ("<script type=\"text/javascript\">\n");
                ltBody.Text += ("function Form_Validator(theForm)\n");
                ltBody.Text += ("{\n");
                ltBody.Text += ("submitonce(theForm);\n");
                ltBody.Text += ("return (true);\n");
                ltBody.Text += ("}\n");
                ltBody.Text += ("</script>\n");

                ltBody.Text += ("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">\n");
                ltBody.Text += ("<table border=\"0\" cellpadding=\"0\" border=\"0\" cellspacing=\"0\" width=\"100%\">\n");
                ltBody.Text += ("<tr class=\"table-header\">\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.ProductID", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.VariantID", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.ProductName", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.VariantName", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("<td align=\"left\"><b>" + AppLogic.GetString("admin.common.DownloadFile", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("</tr>\n");
                int LastProductID = 0;


                int rowcount = dsProducts.Tables[0].Rows.Count;

                for (int i = 0; i < rowcount; i++)
                {
                    DataRow row = dsProducts.Tables[0].Rows[i];

                    if (DB.RowFieldBool(row, "IsDownload"))
                    {
                        int ThisProductID = DB.RowFieldInt(row, "ProductID");
                        int ThisVariantID = DB.RowFieldInt(row, "VariantID");

                        if (i % 2 == 0)
                        {
                            ltBody.Text += ("<tr class=\"table-row2\">\n");
                        }
                        else
                        {
                            ltBody.Text += ("<tr class=\"table-alternatingrow2\">\n");
                        }
                        ltBody.Text += ("<td align=\"left\" valign=\"middle\">");
                        ltBody.Text += (ThisProductID.ToString());
                        ltBody.Text += ("</td>");
                        ltBody.Text += ("<td align=\"left\" valign=\"middle\">");
                        ltBody.Text += (ThisVariantID.ToString());
                        ltBody.Text += ("</td>");
                        ltBody.Text += ("<td align=\"left\" valign=\"middle\">");
                        bool showlinks = false;
                        if (showlinks)
                        {
                            ltBody.Text += ("<a target=\"entityBody\" href=\"" + AppLogic.AdminLinkUrl("entityeditproducts.aspx") + "?iden=" + ThisProductID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">");
                        }
                        ltBody.Text += (DB.RowFieldByLocale(row, "Name", cust.LocaleSetting));
                        if (showlinks)
                        {
                            ltBody.Text += ("</a>");
                        }
                        ltBody.Text += ("</td>\n");
                        ltBody.Text += ("<td align=\"left\" valign=\"middle\">");
                        if (showlinks)
                        {
                            ltBody.Text += ("<a target=\"entityBody\" href=\"" + AppLogic.AdminLinkUrl("entityeditproductvariant.aspx") + "?iden=" + ThisProductID.ToString() + "&variantid=" + ThisVariantID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">");
                        }
                        ltBody.Text += (DB.RowFieldByLocale(row, "VariantName", cust.LocaleSetting));
                        if (showlinks)
                        {
                            ltBody.Text += ("</a>");
                        }
                        ltBody.Text  += ("</td>\n");
                        ltBody.Text  += ("<td align=\"left\" valign=\"middle\">");
                        ltBody.Text  += ("<input maxLength=\"1000\" class=\"singleNormal\" onkeypress=\"javascript:return WebForm_FireDefaultButton(event, 'btnsubmit')\" name=\"DownloadLocation_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + DB.RowField(row, "DownloadLocation") + "\">\n");
                        ltBody.Text  += ("</td>\n");
                        ltBody.Text  += ("</tr>\n");
                        LastProductID = ThisProductID;
                    }
                }
                if (LastProductID == 0)
                {
                    ltBody.Text += ("</table>\n");
                    ltBody.Text += ("<p align=\"left\"><b>" + AppLogic.GetString("admin.common.NoDownloadProductsFound", SkinID, LocaleSetting) + "</b></p>");
                }
                else
                {
                    ltBody.Text += ("<tr><td colspan=\"5\" align=\"right\"><input type=\"submit\" id=\"btnsubmit\" value=\"" + AppLogic.GetString("admin.entityBulkDownloadFiles.DownloadUpdate", SkinID, LocaleSetting) + "\" name=\"Submit\" class=\"normalButtons\"></td></tr>\n");
                    ltBody.Text += ("</table>\n");
                }
            }
            else
            {
                ltBody.Text += ("<p><b>" + AppLogic.GetString("admin.common.NoProductsFound", SkinID, LocaleSetting) + "</b></p>");
            }
            dsProducts.Dispose();
            products.Dispose();

            ltBody.Text += ("</div>");
            ltBody.Text += ("</form>");
        }
Пример #10
0
        protected void LoadBody(string locale)
        {
            var body         = new StringBuilder(4096);
            var mappingCount = DB.GetSqlN("select count(*) as N from Product" + this.m_EntitySpecs.m_EntityName + " where " + m_EntitySpecs.m_EntityName + "Id = " + this.EntityID.ToString());
            var products     = new ProductCollection(m_EntitySpecs.m_EntityName, EntityID);

            products.PageSize          = 0;
            products.PageNum           = 1;
            products.PublishedOnly     = false;
            products.ReturnAllVariants = true;

            var dsProducts = new DataSet();

            if (mappingCount > 0)
            {
                dsProducts = products.LoadFromDB();
            }

            var NumProducts = products.NumProducts;

            if (NumProducts > 1000)
            {
                AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.common.ImportExcession", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                MainBody.Visible = false;
            }
            else if (NumProducts > 0)
            {
                body.Append("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">\n");
                body.Append("<table class=\"table\">\n");
                body.Append("<tr class=\"table-header\">\n");
                body.Append("<td><b>" + AppLogic.GetString("admin.common.ProductID", SkinID, LocaleSetting) + "</b></td>\n");
                body.Append("<td><b>" + AppLogic.GetString("admin.common.VariantID", SkinID, LocaleSetting) + "</b></td>\n");
                body.Append("<td><b>" + AppLogic.GetString("admin.common.ProductName", SkinID, LocaleSetting) + "</b></td>\n");
                body.Append("<td><b>" + AppLogic.GetString("admin.common.VariantName", SkinID, LocaleSetting) + "</b></td>\n");
                body.Append("<td align=\"center\"><b>" + AppLogic.GetString("admin.common.Price", SkinID, LocaleSetting) + "</b><br/><small>" + AppLogic.GetString("admin.entityBulkPrices.Format", SkinID, LocaleSetting) + "</small></td>\n");
                body.Append("<td align=\"center\"><b>" + AppLogic.GetString("admin.common.SalePrice", SkinID, LocaleSetting) + "</b><br/><small>" + AppLogic.GetString("admin.entityBulkPrices.Format", SkinID, LocaleSetting) + "</small></td>\n");
                body.Append("<td align=\"center\"><b>" + AppLogic.GetString("admin.common.MSRP", SkinID, LocaleSetting) + "</b><br/><small>" + AppLogic.GetString("admin.entityBulkPrices.Format", SkinID, LocaleSetting) + "</small></td>\n");
                body.Append("<td align=\"center\"><b>" + AppLogic.GetString("admin.common.Cost", SkinID, LocaleSetting) + "</b><br/><small>" + AppLogic.GetString("admin.entityBulkPrices.Format", SkinID, LocaleSetting) + "</small></td>\n");
                body.Append("</tr>\n");

                var LastProductID = 0;
                var rowcount      = dsProducts.Tables[0].Rows.Count;
                for (var i = 0; i < rowcount; i++)
                {
                    var row = dsProducts.Tables[0].Rows[i];

                    var ThisProductID = DB.RowFieldInt(row, "ProductID");
                    var ThisVariantID = DB.RowFieldInt(row, "VariantID");

                    if (i % 2 == 0)
                    {
                        body.Append("<tr class=\"table-row2\">\n");
                    }
                    else
                    {
                        body.Append("<tr class=\"table-alternatingrow2\">\n");
                    }

                    body.Append("<td align=\"left\" valign=\"middle\">");
                    body.Append(ThisProductID.ToString());
                    body.Append("</td>");
                    body.Append("<td align=\"left\" valign=\"middle\">");
                    body.Append(ThisVariantID.ToString());
                    body.Append("</td>");
                    body.Append("<td align=\"left\" valign=\"middle\">");

                    bool showlinks = false;
                    if (showlinks)
                    {
                        body.Append("<a target=\"entityBody\" href=\"" + AppLogic.AdminLinkUrl("product.aspx") + "?productid=" + ThisProductID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">");
                    }

                    body.Append(DB.RowFieldByLocale(row, "Name", locale));
                    if (showlinks)
                    {
                        body.Append("</a>");
                    }

                    body.Append("</td>\n");
                    body.Append("<td align=\"left\" valign=\"middle\">");

                    if (showlinks)
                    {
                        body.Append("<a target=\"entityBody\" href=\"" + AppLogic.AdminLinkUrl("variant.aspx") + "?productid=" + ThisProductID.ToString() + "&variantid=" + ThisVariantID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">");
                    }

                    body.Append(DB.RowFieldByLocale(row, "VariantName", locale));

                    if (showlinks)
                    {
                        body.Append("</a>");
                    }

                    body.Append("</td>\n");
                    body.Append("<td align=\"center\" valign=\"middle\">");
                    body.Append("<input maxLength=\"10\" size=\"10\" class=\"default\" name=\"Price_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + Localization.CurrencyStringForDBWithoutExchangeRate(DB.RowFieldDecimal(row, "Price")) + "\">");
                    body.Append("<input type=\"hidden\" name=\"Price_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "_vldt\" value=\"[req][number][blankalert=" + AppLogic.GetString("admin.common.VariantPricePrompt", SkinID, LocaleSetting) + "][invalidalert=" + AppLogic.GetString("admin.common.ValidDollarAmountPrompt", SkinID, LocaleSetting) + "]\">\n");
                    body.Append("</td>");
                    body.Append("<td align=\"center\" valign=\"middle\">");
                    body.Append("<input maxLength=\"10\" size=\"10\" class=\"default\" name=\"SalePrice_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + CommonLogic.IIF(DB.RowFieldDecimal(row, "SalePrice") != System.Decimal.Zero, Localization.CurrencyStringForDBWithoutExchangeRate(DB.RowFieldDecimal(row, "SalePrice")), "") + "\">\n");
                    body.Append("<input type=\"hidden\" name=\"SalePrice_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "_vldt\" value=\"[number][invalidalert=" + AppLogic.GetString("admin.common.ValidDollarAmountPrompt", SkinID, LocaleSetting) + "]\">\n");
                    body.Append("</td>");
                    body.Append("<td align=\"center\" valign=\"middle\">");
                    body.Append("<input maxLength=\"10\" size=\"10\" class=\"default\" name=\"MSRP_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + CommonLogic.IIF(DB.RowFieldDecimal(row, "MSRP") != System.Decimal.Zero, Localization.CurrencyStringForDBWithoutExchangeRate(DB.RowFieldDecimal(row, "MSRP")), "") + "\">\n");
                    body.Append("<input type=\"hidden\" name=\"MSRP_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "_vldt\" value=\"[number][invalidalert=" + AppLogic.GetString("admin.commmon.ValidDollarAmountPrompt", SkinID, LocaleSetting) + "]\">\n");
                    body.Append("</td>");
                    body.Append("<td align=\"center\" valign=\"middle\">");
                    body.Append("<input maxLength=\"10\" size=\"10\" class=\"default\" name=\"Cost_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + CommonLogic.IIF(DB.RowFieldDecimal(row, "Cost") != System.Decimal.Zero, Localization.CurrencyStringForDBWithoutExchangeRate(DB.RowFieldDecimal(row, "Cost")), "") + "\">\n");
                    body.Append("<input type=\"hidden\" name=\"Cost_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "_vldt\" value=\"[number][invalidalert=" + AppLogic.GetString("admin.common.ValidDollarAmountPrompt", SkinID, LocaleSetting) + "]\">\n");
                    body.Append("</td>\n");
                    body.Append("</tr>\n");

                    LastProductID = ThisProductID;
                }
                body.Append("</table>\n");
            }
            else
            {
                AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.common.NoProductsFound", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                MainBody.Visible = false;
            }

            dsProducts.Dispose();
            products.Dispose();

            ltBody.Text = body.ToString();
        }
        protected void LoadBody(string locale)
        {
            var tmpS = new StringBuilder(4096);

            var mappingCount = DB.GetSqlN("select count(*) as N from Product" + this.EntitySpecs.m_EntityName + " where " + EntitySpecs.m_EntityName + "Id = " + this.EntityId.ToString());

            var products = new ProductCollection(EntityName, EntityId);

            products.PageSize          = 0;
            products.PageNum           = 1;
            products.PublishedOnly     = false;
            products.ReturnAllVariants = true;

            var dsProducts = new DataSet();

            if (mappingCount > 0)
            {
                dsProducts = products.LoadFromDB();
            }

            int NumProducts = products.NumProducts;

            if (NumProducts > 1000)
            {
                AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.common.ImportExcession", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                MainBody.Visible = false;
            }
            else if (NumProducts > 0)
            {
                tmpS.Append("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">\n");
                tmpS.Append("<table class=\"table\">\n");
                tmpS.Append("<tr class=\"table-header\">\n");
                tmpS.Append("<td><b>ProductID</b></td>\n");
                tmpS.Append("<td><b>VariantID</b></td>\n");
                tmpS.Append("<td><b>Product Name</b></td>\n");
                tmpS.Append("<td><b>Variant Name</b></td>\n");
                tmpS.Append("<td><b>Inventory</b></td>\n");
                tmpS.Append("</tr>\n");

                int rowcount = dsProducts.Tables[0].Rows.Count;

                for (var i = 0; i < rowcount; i++)
                {
                    var row = dsProducts.Tables[0].Rows[i];

                    var ThisProductID = DB.RowFieldInt(row, "ProductID");
                    var ThisVariantID = DB.RowFieldInt(row, "VariantID");

                    if (i % 2 == 0)
                    {
                        tmpS.Append("<tr>\n");
                    }
                    else
                    {
                        tmpS.Append("<tr>\n");
                    }
                    tmpS.Append("<td>");
                    tmpS.Append(ThisProductID.ToString());
                    tmpS.Append("</td>");
                    tmpS.Append("<td>");
                    tmpS.Append(ThisVariantID.ToString());
                    tmpS.Append("</td>");
                    tmpS.Append("<td>");

                    bool showlinks = false;
                    if (showlinks)
                    {
                        tmpS.Append("<a target=\"entityBody\" href=\"" + AppLogic.AdminLinkUrl("product.aspx") + "?productid=" + ThisProductID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityId.ToString() + "\">");
                    }

                    tmpS.Append(DB.RowFieldByLocale(row, "Name", locale));

                    if (showlinks)
                    {
                        tmpS.Append("</a>");
                    }

                    tmpS.Append("</td>\n");
                    tmpS.Append("<td>");

                    if (showlinks)
                    {
                        tmpS.Append("<a target=\"entityBody\" href=\"" + AppLogic.AdminLinkUrl("variant.aspx") + "?productid=" + ThisProductID.ToString() + "&variantid=" + ThisVariantID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityId.ToString() + "\">");
                    }

                    tmpS.Append(DB.RowFieldByLocale(row, "VariantName", locale));

                    if (showlinks)
                    {
                        tmpS.Append("</a>");
                    }

                    tmpS.Append("</td>\n");
                    tmpS.Append("<td>");

                    var inventoryTable = AppLogic.GetInventoryTable(ThisProductID, ThisVariantID, true, SkinID, false, true);
                    tmpS.Append(inventoryTable);
                    tmpS.Append("</td>\n");
                    tmpS.Append("</tr>\n");
                }
                tmpS.Append("</table>\n");
            }
            else
            {
                MainBody.Visible = false;
                AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.common.NoProductsFound", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
            }

            dsProducts.Dispose();
            products.Dispose();

            ltBody.Text = tmpS.ToString();
        }
        protected void LoadBody(string locale)
        {
            ltBody.Text  = ("<input type=\"hidden\" name=\"EntityName\" value=\"" + EntityName + "\">\n");
            ltBody.Text += ("<input type=\"hidden\" name=\"EntityID\" value=\"" + EntityID + "\">\n");

            var products = new ProductCollection(m_EntitySpecs.m_EntityName, EntityID);

            products.PageSize          = 0;
            products.PageNum           = 1;
            products.PublishedOnly     = false;
            products.ReturnAllVariants = true;

            var mappingCount = DB.GetSqlN("select count(*) as N from Product" + this.m_EntitySpecs.m_EntityName + " where " + m_EntitySpecs.m_EntityName + "Id = " + this.EntityID.ToString());

            var dsProducts = new DataSet();

            if (mappingCount > 0)
            {
                dsProducts = products.LoadFromDB();
            }

            var NumProducts = products.NumProducts;

            if (NumProducts > 1000)
            {
                MainBody.Visible = false;
                AlertMessage.PushAlertMessage(AppLogic.GetString("admin.common.ImportExcession", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
            }
            else if (NumProducts > 0)
            {
                ltBody.Text += ("<script type=\"text/javascript\">\n");
                ltBody.Text += ("function Form_Validator(theForm)\n");
                ltBody.Text += ("{\n");
                ltBody.Text += ("submitonce(theForm);\n");
                ltBody.Text += ("return (true);\n");
                ltBody.Text += ("}\n");
                ltBody.Text += ("</script>\n");

                ltBody.Text += ("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">\n");
                ltBody.Text += ("<table class=\"table\">\n");
                ltBody.Text += ("<tr class=\"table-header\">\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.ProductID", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.VariantID", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.ProductName", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.VariantName", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.DownloadFile", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("</tr>\n");

                var LastProductID = 0;
                var rowcount      = dsProducts.Tables[0].Rows.Count;

                for (var i = 0; i < rowcount; i++)
                {
                    var row = dsProducts.Tables[0].Rows[i];

                    if (DB.RowFieldBool(row, "IsDownload"))
                    {
                        var ThisProductID = DB.RowFieldInt(row, "ProductID");
                        var ThisVariantID = DB.RowFieldInt(row, "VariantID");

                        if (i % 2 == 0)
                        {
                            ltBody.Text += ("<tr class=\"table-row2\">\n");
                        }
                        else
                        {
                            ltBody.Text += ("<tr class=\"table-alternatingrow2\">\n");
                        }

                        ltBody.Text += ("<td>");
                        ltBody.Text += (ThisProductID.ToString());
                        ltBody.Text += ("</td>");
                        ltBody.Text += ("<td>");
                        ltBody.Text += (ThisVariantID.ToString());
                        ltBody.Text += ("</td>");
                        ltBody.Text += ("<td>");

                        bool showlinks = false;
                        if (showlinks)
                        {
                            ltBody.Text += ("<a target=\"entityBody\" href=\"" + AppLogic.AdminLinkUrl("product.aspx") + "?productid=" + ThisProductID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">");
                        }

                        ltBody.Text += (DB.RowFieldByLocale(row, "Name", locale));

                        if (showlinks)
                        {
                            ltBody.Text += ("</a>");
                        }

                        ltBody.Text += ("</td>\n");
                        ltBody.Text += ("<td>");

                        if (showlinks)
                        {
                            ltBody.Text += ("<a target=\"entityBody\" href=\"" + AppLogic.AdminLinkUrl("variant.aspx") + "?productid=" + ThisProductID.ToString() + "&variantid=" + ThisVariantID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">");
                        }

                        ltBody.Text += (DB.RowFieldByLocale(row, "VariantName", locale));

                        if (showlinks)
                        {
                            ltBody.Text += ("</a>");
                        }

                        ltBody.Text += ("</td>\n");
                        ltBody.Text += ("<td>");
                        ltBody.Text += ("<input maxLength=\"1000\" class=\"singleNormal\" onkeypress=\"javascript:return WebForm_FireDefaultButton(event, 'btnsubmit')\" name=\"DownloadLocation_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + DB.RowField(row, "DownloadLocation") + "\">\n");
                        ltBody.Text += ("</td>\n");
                        ltBody.Text += ("</tr>\n");

                        LastProductID = ThisProductID;
                    }
                }

                if (LastProductID == 0)
                {
                    MainBody.Visible = false;
                    AlertMessage.PushAlertMessage(AppLogic.GetString("admin.common.NoDownloadProductsFound", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                }

                ltBody.Text += ("</table>\n");
            }
            else
            {
                MainBody.Visible = false;
                AlertMessage.PushAlertMessage(AppLogic.GetString("admin.common.NoProductsFound", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
            }

            dsProducts.Dispose();
            products.Dispose();
        }
Пример #13
0
        protected void Page_Load(Object sender, EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = 0;
            Response.AddHeader("pragma", "no-cache");

            StringBuilder contents = new StringBuilder();

            EntityHelper CategoryHelper     = AppLogic.LookupHelper(null, "Category");
            EntityHelper SectionHelper      = AppLogic.LookupHelper(null, "Section");
            EntityHelper ManufacturerHelper = AppLogic.LookupHelper(null, "Manufacturer");

            String searchTerm = CommonLogic.QueryStringCanBeDangerousContent("SearchTerm").Trim();

            if (searchTerm.Length != 0)
            {
                String stlike   = "%" + searchTerm + "%";
                String stquoted = DB.SQuote(stlike);


                // MATCHING CATEGORIES:
                bool anyFound = false;

                contents.Append("<div class=\"white-ui-box\">\n");
                contents.Append("<a class=\"btn btn-default btn-sm pull-right\" href=\"entities.aspx?entityname=category\">" + AppLogic.GetString("admin.menu.Categories", SkinID, LocaleSetting) + "</a>\n");
                contents.Append("<h3>" + AppLogic.GetString("AppConfig.CategoryPromptPlural", SkinID, LocaleSetting) + " Matching: '" + searchTerm + "'</h3>\n");
                contents.Append("<table class=\"table\">\n");

                using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
                {
                    con.Open();
                    using (IDataReader rs = DB.GetRS(String.Format("select CategoryID from Category with (NOLOCK)  where Category.name like {0} order by DisplayOrder,Name", stquoted), con))
                    {
                        while (rs.Read())
                        {
                            contents.Append("<tr><td>" + CategoryHelper.GetEntityBreadcrumb(DB.RSFieldInt(rs, "CategoryID"), LocaleSetting) + "</td></tr>");
                            anyFound = true;
                        }
                    }
                }

                if (!anyFound)
                {
                    contents.Append("<tr><td>No matches found</td></tr>\n");
                }
                contents.Append("</table>\n");
                contents.Append("</div>\n");

                // MATCHING SECTIONS:
                anyFound = false;

                contents.Append("<div class=\"white-ui-box\">\n");
                contents.Append("<a class=\"btn btn-default btn-sm pull-right\" href=\"entities.aspx?entityname=section\">" + AppLogic.GetString("admin.menu.Sections", SkinID, LocaleSetting) + "</a>\n");
                contents.Append("<h3>" + AppLogic.GetString("AppConfig.SectionPromptPlural", SkinID, LocaleSetting) + " Matching: '" + searchTerm + "'</h3>\n");
                contents.Append("<table class=\"table\">\n");

                using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
                {
                    con.Open();
                    using (IDataReader rs = DB.GetRS(String.Format("select SectionID from [Section]  with (NOLOCK)  where Name like {0} order by DisplayOrder,Name", stquoted), con))
                    {
                        while (rs.Read())
                        {
                            contents.Append("<tr><td>" + SectionHelper.GetEntityBreadcrumb(DB.RSFieldInt(rs, "SectionID"), LocaleSetting) + "</td></tr>");
                            anyFound = true;
                        }
                    }
                }

                if (!anyFound)
                {
                    contents.Append("<tr><td>No matches found</td></tr>\n");
                }
                contents.Append("</table>\n");
                contents.Append("</div>\n");

                // MATCHING MANUFACTURERS:
                anyFound = false;

                contents.Append("<div class=\"white-ui-box\">\n");
                contents.Append("<a class=\"btn btn-default btn-sm pull-right\" href=\"entities.aspx?entityname=manufacturer\">" + AppLogic.GetString("admin.menu.Manufacturers", SkinID, LocaleSetting) + "</a>\n");
                contents.Append("<h3>" + AppLogic.GetString("AppConfig.ManufacturerPromptPlural", SkinID, LocaleSetting) + " Matching: '" + searchTerm + "'</h3>\n");
                contents.Append("<table class=\"table\">\n");

                using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
                {
                    con.Open();
                    using (IDataReader rs = DB.GetRS(String.Format("select Name, ManufacturerID from Manufacturer  with (NOLOCK)  where Name like {0} order by DisplayOrder,Name", stquoted), con))
                    {
                        while (rs.Read())
                        {
                            contents.Append("<tr><td><a href=\"entity.aspx?entityname=manufacturer&entityid=" + DB.RSFieldInt(rs, "ManufacturerID").ToString() + "\">" + CommonLogic.HighlightTerm(DB.RSFieldByLocale(rs, "Name", LocaleSetting), searchTerm) + "</a></td></tr>\n");
                            anyFound = true;
                        }
                    }
                }

                if (!anyFound)
                {
                    contents.Append("<tr><td>No matches found</td></tr>\n");
                }
                contents.Append("</table>\n");
                contents.Append("</div>\n");
                litEntityResults.Text = contents.ToString();

                contents.Clear();
                // MATCHING PRODUCTS:
                ProductCollection products = new ProductCollection();
                products.PageSize    = 0;
                products.PageNum     = 1;
                products.SearchMatch = searchTerm;
                products.SearchDescriptionAndSummaryFields = false;
                products.PublishedOnly = false;
                DataSet dsProducts  = products.LoadFromDB();
                int     NumProducts = products.NumProducts;

                contents.Append("<div class=\"white-ui-box\">\n");
                contents.Append("<a class=\"btn btn-default btn-sm pull-right\" href=\"products.aspx\">" + AppLogic.GetString("admin.menu.ProductMgr", SkinID, LocaleSetting) + "</a>\n");
                contents.Append("<h3>" + AppLogic.GetString("admin.common.products", SkinID, LocaleSetting) + " Matching: '" + searchTerm + "'</h3>\n");
                contents.Append("<table class=\"table\">\n");
                if (NumProducts > 0)
                {
                    contents.Append("    <tr>\n");
                    contents.Append("      <th>" + AppLogic.GetString("search.aspx.6", SkinID, LocaleSetting) + "</th>\n");
                    contents.Append("      <th>" + AppLogic.GetString("search.aspx.7", SkinID, LocaleSetting) + "</th>\n");
                    contents.Append("      <th>" + AppLogic.GetString("AppConfig.CategoryPromptSingular", SkinID, LocaleSetting) + "</th>\n");
                    contents.Append("      <th>" + AppLogic.GetString("search.aspx.8", SkinID, LocaleSetting) + "</th>\n");
                    contents.Append("    </tr>\n");
                    foreach (DataRow row in dsProducts.Tables[0].Rows)
                    {
                        String url = String.Format("product.aspx?productid={0}&entityname=category", DB.RowFieldInt(row, "ProductID"));
                        contents.Append("<tr>");
                        contents.Append("<td>");
                        contents.Append("<a href=\"" + url + "\">" + AppLogic.MakeProperObjectName(DB.RowFieldByLocale(row, "Name", LocaleSetting), DB.RowFieldByLocale(row, "VariantName", LocaleSetting), LocaleSetting) + "</a>");
                        // QuickEdit
                        contents.Append("</td>");
                        contents.Append("<td>" + CommonLogic.HighlightTerm(AppLogic.MakeProperProductSKU(DB.RowField(row, "SKU"), DB.RowField(row, "SKUSuffix"), "", ""), searchTerm) + "</td>");
                        String Cats = CategoryHelper.GetObjectEntities(DB.RowFieldInt(row, "ProductID"), false);
                        if (Cats.Length != 0)
                        {
                            String[] CatIDs = Cats.Split(',');
                            contents.Append("<td>");
                            bool firstCat = true;
                            foreach (String s in CatIDs)
                            {
                                if (!firstCat)
                                {
                                    contents.Append(", ");
                                }
                                contents.Append("<a href=\"entity.aspx?entityname=category&entityid=" + s + "\">" + CategoryHelper.GetEntityName(Localization.ParseUSInt(s), LocaleSetting).Trim() + "</a>");
                                firstCat = false;
                            }
                            contents.Append("</td>\n");
                        }
                        else
                        {
                            contents.Append("<td>");
                            contents.Append("&nbsp;");
                            contents.Append("</td>\n");
                        }
                        contents.Append("<td><a href=\"entity.aspx?entityname=manufacturer&entityid=" + DB.RowFieldInt(row, "ManufacturerID").ToString() + "\">" + CommonLogic.HighlightTerm(ManufacturerHelper.GetEntityName(DB.RowFieldInt(row, "ManufacturerID"), LocaleSetting), searchTerm) + "</a></td>");
                        contents.Append("</tr>\n");
                        anyFound = true;
                    }
                }
                else
                {
                    contents.Append("<tr><td colspan=\"4\">No matches found</td></tr>\n");
                }
                contents.Append("</table>\n");
                contents.Append("</div>\n");
                products.Dispose();
                dsProducts.Dispose();

                litProductResults.Text = contents.ToString();
            }
        }