コード例 #1
0
    public string ShowComGroup()
    {
        CdymanicViewCom ViewProduct;
        int             currentpage = 0;
        int             size        = 20;
        int             idgroup     = 0;
        string          nameGroup   = "";

        try
        {
            idgroup     = int.Parse(Request.QueryString["id"].ToString());
            currentpage = int.Parse(Request.QueryString["page"].ToString());
            size        = int.Parse(Request.QueryString["size"].ToString());
            if (size > 40 || size < 10)
            {
                size = 20;
            }
        }
        catch
        {
        }
        if (Session["SSComponentGroup"] != null)
        {
            ViewProduct = (CdymanicViewCom)Session["SSComponentGroup"];
            ViewProduct.SetPageSize(size);
            if (idgroup != ViewProduct.GetIdGroup())
            {
                ViewProduct.setIdGroup(idgroup);
                ViewProduct.SetNumComGroup();
            }
            if (currentpage > 0)
            {
                ViewProduct.SetCurrentPage(currentpage);
            }
            else
            {
                ViewProduct.SetCurrentPage();
            }
        }
        else
        {
            ViewProduct = new CdymanicViewCom();
            ViewProduct.SetIdType((int)Application["idtypeproduct"]);
            ViewProduct.setIdGroup(idgroup);
            ViewProduct.SetNumComGroup();
            ViewProduct.SetPageSize(size);
            if (currentpage > 0)
            {
                ViewProduct.SetCurrentPage(currentpage);
            }
            else
            {
                ViewProduct.SetCurrentPage();
            }
            Session["SSComponentGroup"] = ViewProduct;
        }
        nameGroup = ViewProduct.GetNameGroup();
        if (nameGroup.Length > 0)
        {
            tCurrentAccess += " &raquo; " + nameGroup;
        }
        blpro = string.Format(blpro, "<u>" + ViewProduct.GetNumberRecord() + "</u>");
        Component_data product = ViewProduct.ComponentGroupFromTo();
        DataTable      table   = product.Tables[Component_data._table];
        int            numPro  = table.Rows.Count;
        Boolean        iseven  = true;

        if (ViewProduct.GetPages() > 1)
        {
            strpage1 = CreatePage(idgroup, ViewProduct.GetCurrentPage(), ViewProduct.GetPages(), ViewProduct.GetPageSize(), 1);
            strpage2 = CreatePage(idgroup, ViewProduct.GetCurrentPage(), ViewProduct.GetPages(), ViewProduct.GetPageSize(), 2);
        }
        else if (ViewProduct.GetPages() == 1)
        {
            strpage1 = ButtonCompare(true);
            strpage2 = ButtonCompare(false);
        }
        string strProMain = "";

        if (numPro > 0)
        {
            strProMain  = "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
            strProMain += "<tr height='5'><td colspan='3'></td></tr>";
            string id       = "";
            string name     = "";
            string url      = "";
            string price    = "";
            string warranty = "";
            string brand    = "";
            string note     = "";
            for (int i = 0; i < numPro; i++)
            {
                id    = table.Rows[i][Component_data._id].ToString();
                name  = table.Rows[i][Component_data._name].ToString();
                url   = table.Rows[i][Component_data._urlImage].ToString();
                brand = table.Rows[i][Component_data._brand].ToString();
                note  = table.Rows[i][Component_data._note].ToString();
                if (note.Length > 0)
                {
                    note = note.Replace("\"", "''");
                    note = note.Replace('\r', ' ');
                    note = note.Replace('\n', ' ');
                }
                else
                {
                    note = name;
                }
                if (url.Length > 0)
                {
                    url = "image/img_com/" + url;
                }
                else
                {
                    url = "image/common/notimgpro.png";
                }
                price    = table.Rows[i][Component_data._sellingPrice].ToString();
                warranty = table.Rows[i][Component_data._warrantyMonth].ToString();
                if (iseven)
                {
                    strProMain += "<tr><td width='272'>";
                    strProMain += "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
                    strProMain += "<tr><td rowspan='2' width='100'><a href='?menu=dc&id=" + id + "'><img class='border_img' src='" + url + "'/></a></td>";
                    strProMain += "<td colspan='2' valign='top' class='text_title'><a href='?menu=dc&id=" + id + "' onmouseover=\"ShowSpeccom('" + note + "',event);\" onmouseout='OnMOut(event)'>" + name + "</a></td></tr>";
                    strProMain += "<tr><td>" + tbrand + ": <span class='price'>" + brand + "</span><br />" + tprice + ": <span class='price'>" + price + " " + unitPrice + "</span><br />" + twarranty + ": <span class='price'>" + warranty + " " + tmonth + "</span></td>";
                    strProMain += "<td><input type='checkbox' id='c" + id + "' name='cp'/></td></tr>";
                    strProMain += "<tr><td colspan='3' height='29' align='center'><div class='button3' onclick='AddCart(" + id + ",2);'>" + torder + "</div></td></tr>";
                    strProMain += "</table></td>";
                    iseven      = false;
                    if (i + 1 == numPro)
                    {
                        strProMain += "<td class='bg_line4' width='11'></td>";
                        strProMain += "<td width='272'>&nbsp;</td>";
                        strProMain += "</tr>";
                    }
                }
                else
                {
                    strProMain += "<td class='bg_line4' width='11'></td>";
                    strProMain += "<td width='272'>";
                    strProMain += "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
                    strProMain += "<tr><td rowspan='2' width='100'><a href='?menu=dc&id=" + id + "'><img class='border_img' src='" + url + "'/></a></td>";
                    strProMain += "<td colspan='2' valign='top' class='text_title'><a href='?menu=dc&id=" + id + "' onmouseover=\"ShowSpeccom('" + note + "',event);\" onmouseout='OnMOut(event)'>" + name + "</a></td></tr>";
                    strProMain += "<tr><td>" + tbrand + ": <span class='price'>" + brand + "</span><br />" + tprice + ": <span class='price'>" + price + " " + unitPrice + "</span><br />" + twarranty + ": <span class='price'>" + warranty + " " + tmonth + "</span></td>";
                    strProMain += "<td><input type='checkbox' id='c" + id + "' name='cp'/></td></tr>";
                    strProMain += "<tr><td colspan='3' height='29' align='center'><div class='button3' onclick='AddCart(" + id + ",2);'>" + torder + "</div></td></tr>";
                    strProMain += "</table></td></tr>";
                    if (i + 1 < numPro)
                    {
                        strProMain += "<tr><td class='bg_line3'></td><td></td><td class='bg_line3'></td></tr>";
                    }
                    iseven = true;
                }
            }
            strProMain += "<tr height='5'><td colspan='3'></td></tr>";
            strProMain += "</table>";
        }
        else
        {
            strProMain = "Không có sản phẩm nào.";
        }
        return(strProMain);
    }
コード例 #2
0
    public string ShowProductAll()
    {
        CDynamicViewProduct ViewProduct;
        int currentpage = 0;
        int size        = 30;

        try
        {
            currentpage = int.Parse(Request.QueryString["page"].ToString());
            size        = int.Parse(Request.QueryString["size"].ToString());
            if (size > 40 || size < 10)
            {
                size = 30;
            }
        }
        catch
        {
        }
        if (Session["SSProductWillHave"] != null)
        {
            ViewProduct = (CDynamicViewProduct)Session["SSProductWillHave"];
            ViewProduct.SetPageSize(size);
            if (currentpage > 0)
            {
                ViewProduct.SetCurrentPage(currentpage);
            }
            else
            {
                ViewProduct.SetNumWillHave();
                ViewProduct.SetCurrentPage();
            }
        }
        else
        {
            ViewProduct = new CDynamicViewProduct();
            ViewProduct.SetIdType((int)Application["idtypeproduct"]);
            ViewProduct.SetNumWillHave();
            ViewProduct.SetPageSize(size);
            if (currentpage > 0)
            {
                ViewProduct.SetCurrentPage(currentpage);
            }
            else
            {
                ViewProduct.SetCurrentPage();
            }
            Session["SSProductWillHave"] = ViewProduct;
        }
        blpro = string.Format(blpro, "<u>" + ViewProduct.GetNumberRecord() + "</u>");
        Product_data product = ViewProduct.ProductWillHaveFromTo();
        DataTable    table   = product.Tables[Product_data._table];
        int          numPro  = table.Rows.Count;
        Boolean      iseven  = true;

        if (ViewProduct.GetPages() > 1)
        {
            strpage1 = CreatePage(ViewProduct.GetCurrentPage(), ViewProduct.GetPages(), ViewProduct.GetPageSize(), 1);
            strpage2 = CreatePage(ViewProduct.GetCurrentPage(), ViewProduct.GetPages(), ViewProduct.GetPageSize(), 2);
        }
        else if (ViewProduct.GetPages() == 1)
        {
            strpage1 = ButtonCompare(true);
            strpage2 = ButtonCompare(false);
        }
        string strProMain = "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";

        strProMain += "<tr height='5'><td colspan='3'></td></tr>";
        string    id        = "";
        string    name      = "";
        string    url       = "";
        string    price     = "";
        string    warranty  = "";
        Boolean   istest    = false;
        ArrayList list      = new ArrayList();
        string    substring = "";
        float     rate      = (float)Application["ratepromain"];
        float     price1    = 1;
        string    price2    = "";

        if (ViewProduct.GetCurrentPage() == 1)
        {
            istest = true;
        }
        for (int i = 0; i < numPro; i++)
        {
            id   = table.Rows[i][Product_data._id].ToString();
            name = table.Rows[i][Product_data._name].ToString() + " " + table.Rows[i][Product_data._state].ToString();
            url  = table.Rows[i][Product_data._urlImage].ToString();
            string namepro = table.Rows[i][Product_data._name].ToString();
            namepro = namepro.Replace("/", "");
            namepro = namepro.Replace("#", "");
            if (url.Length > 0)
            {
                url = "image/img_pro/" + url;
            }
            else
            {
                url = "image/common/notimgpro.png";
            }
            price2   = table.Rows[i][Product_data._price].ToString();
            price1   = float.Parse(table.Rows[i][Product_data._price].ToString());
            price1   = price1 * rate;
            price    = price1.ToString("N").Split('.')[0];
            warranty = table.Rows[i][Product_data._WarrantyMonth].ToString();
            if (istest == true && price.Equals("0"))
            {
                substring  = "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
                substring += "<tr><td rowspan='2' width='88' align='center' valign='top'>";
                if (table.Rows[i][Product_data._ispromotion].ToString().Length > 0)
                {
                    substring += "<img src='image/common/khuyenmai.gif' style='cursor:pointer;' onmouseover='showDivMessage(2," + id + "," + i + ",event);' onmouseout='OnMOut(event)'/><br />";
                }
                substring += "<a href='" + namepro + "-dp-" + id + ".html'><img class='img1' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)' src='" + url + "'/></a></td>";
                substring += "<td colspan='2' valign='top' class='text_title'><a href='" + namepro + "-dp-" + id + ".html' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)'>" + name + "</a></td></tr>";
                substring += "<tr><td valign='middle' width='165' height='48'>" + tprice + ": <span class='price'>";
                substring += tupdate + "</span><br />";
                substring += twarranty + ": <span class='price'>" + warranty + " " + tmonth + "</span>";
                substring += "</td><td width='25' align='right'><input type='checkbox' id='c" + id + "' name='cp'/></td></tr>";
                //strProMain += "<tr><td colspan='3' align='center' height='32'><div class='button3' onclick='AddCart(" + id + ",1);'>" + torder + "</div></td></tr>";
                substring += "</table>";
                list.Add(substring);
                continue;
            }
            if (iseven)
            {
                strProMain += "<tr><td width='278'>";
                strProMain += "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
                strProMain += "<tr><td rowspan='2' width='88' align='center' valign='top'>";
                if (table.Rows[i][Product_data._ispromotion].ToString().Length > 0)
                {
                    strProMain += "<img src='image/common/khuyenmai.gif' style='cursor:pointer;' onmouseover='showDivMessage(2," + id + "," + i + ",event);' onmouseout='OnMOut(event)'/><br />";
                }
                strProMain += "<a href='" + namepro + "-dp-" + id + ".html'><img class='img1' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)' src='" + url + "'/></a></td>";
                strProMain += "<td colspan='2' valign='top' class='text_title'><a href='" + namepro + "-dp-" + id + ".html' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)'>" + name + "</a></td></tr>";
                strProMain += "<tr><td valign='middle' width='165' height='48'>" + tprice + ": <span class='price'>";
                if (price.Equals("0"))
                {
                    strProMain += tupdate + "</span><br />";
                }
                else
                {
                    if (unitPrice.Equals("$"))
                    {
                        strProMain += price + " VND</span><br />";
                        strProMain += "<font color='#FFFFFF'>" + tprice + ": </font><span class='price'>" + price2 + "</span><br />";
                    }
                    else if (unitPrice.Equals("$$"))
                    {
                        strProMain += price + " VND</span><br />";
                        strProMain += "<font color='#FFFFFF'>" + tprice + ": </font><span class='price'>" + price2 + " USD</span><br />";
                    }
                    else
                    {
                        strProMain += price + " " + unitPrice + "</span><br />";
                    }
                }
                strProMain += "<span class='tvat'>" + strMVAT + "</span><br />";
                strProMain += twarranty + ": <span class='price'>" + warranty + " " + tmonth + "</span>";
                strProMain += "</td><td width='25' align='right'><input type='checkbox' id='c" + id + "' name='cp'/></td></tr>";
                //strProMain += "<tr><td colspan='3' align='center' height='32'><div class='button3' onclick='AddCart(" + id + ",1);'>" + torder + "</div></td></tr>";
                strProMain += "</table></td>";
                strProMain += "<td class='bg_line4'></td>";
                iseven      = false;
                if (i + 1 == numPro)
                {
                    if (list.Count == 0)
                    {
                        strProMain += "<td width='278'>&nbsp;</td>";
                        strProMain += "</tr>";
                    }
                }
            }
            else
            {
                strProMain += "<td width='278'>";
                strProMain += "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
                strProMain += "<tr><td rowspan='2' width='88' align='center' valign='top'>";
                if (table.Rows[i][Product_data._ispromotion].ToString().Length > 0)
                {
                    strProMain += "<img src='image/common/khuyenmai.gif' style='cursor:pointer;' onmouseover='showDivMessage(2," + id + "," + i + ",event);' onmouseout='OnMOut(event)'/><br />";
                }
                strProMain += "<a href='" + namepro + "-dp-" + id + ".html'><img class='img1' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)' src='" + url + "'/></a></td>";
                strProMain += "<td colspan='2' valign='top' class='text_title'><a href='" + namepro + "-dp-" + id + ".html' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)'>" + name + "</a></td></tr>";
                strProMain += "<tr><td valign='middle' width='165' height='48'>" + tprice + ": <span class='price'>";
                if (price.Equals("0"))
                {
                    strProMain += tupdate + "</span><br />";
                }
                else
                {
                    if (unitPrice.Equals("$"))
                    {
                        strProMain += price + " VND</span><br />";
                        strProMain += "<font color='#FFFFFF'>" + tprice + ": </font><span class='price'>" + price2 + "</span><br />";
                    }
                    else if (unitPrice.Equals("$$"))
                    {
                        strProMain += price + " VND</span><br />";
                        strProMain += "<font color='#FFFFFF'>" + tprice + ": </font><span class='price'>" + price2 + " USD</span><br />";
                    }
                    else
                    {
                        strProMain += price + " " + unitPrice + "</span><br />";
                    }
                }
                strProMain += "<span class='tvat'>" + strMVAT + "</span><br />";
                strProMain += twarranty + ": <span class='price'>" + warranty + " " + tmonth + "</span>";
                strProMain += "</td><td width='25' align='right'><input type='checkbox' id='c" + id + "' name='cp'/></td></tr>";
                //strProMain += "<tr><td colspan='3' align='center' height='32'><div class='button3' onclick='AddCart(" + id + ",1);'>" + torder + "</div></td></tr>";
                strProMain += "</table></td></tr>";
                if (i + 1 < numPro)
                {
                    strProMain += "<tr><td class='bg_line3'></td><td></td><td class='bg_line3'></td></tr>";
                }
                iseven = true;
            }
        }
        int numpro = list.Count;

        for (int i = 0; i < numpro; i++)
        {
            if (iseven)
            {
                strProMain += "<tr><td width='278'>";
                strProMain += list[i].ToString();
                strProMain += "</td><td class='bg_line4'></td>";
                iseven      = false;
                if (i + 1 == numpro)
                {
                    strProMain += "<td width='278'>&nbsp;</td>";
                    strProMain += "</tr>";
                }
            }
            else
            {
                strProMain += "<td width='278'>";
                strProMain += list[i].ToString();
                strProMain += "</td></tr>";
                if (i + 1 < numPro)
                {
                    strProMain += "<tr><td class='bg_line3'></td><td></td><td class='bg_line3'></td></tr>";
                }
                iseven = true;
            }
        }
        strProMain += "<tr height='5'><td colspan='3'></td></tr>";
        strProMain += "</table>";
        return(strProMain);
    }
コード例 #3
0
    public string ShowProductWithBrand()
    {
        CDynamicViewProduct ViewProduct;
        int    currentpage = 0;
        int    size        = 30;
        int    idBrand     = 0;
        string nameBrand   = "";

        try
        {
            idBrand     = int.Parse(Request.QueryString["brand"].ToString());
            currentpage = int.Parse(Request.QueryString["page"].ToString());
            size        = int.Parse(Request.QueryString["size"].ToString());
            if (size > 40 || size < 10)
            {
                size = 30;
            }
        }
        catch
        {
        }
        if (Session["SSMobileBrand"] != null)
        {
            ViewProduct = (CDynamicViewProduct)Session["SSMobileBrand"];
            ViewProduct.SetPageSize(size);
            if (idBrand != ViewProduct.GetIdBrand())
            {
                ViewProduct.SetIdBrand(idBrand);
                ViewProduct.SetNumProductWithBrand();
            }
            if (currentpage > 0)
            {
                ViewProduct.SetCurrentPage(currentpage);
            }
            else
            {
                ViewProduct.SetNumProductWithBrand();
                ViewProduct.SetCurrentPage();
            }
        }
        else
        {
            ViewProduct = new CDynamicViewProduct();
            ViewProduct.SetIdType((int)Application["idtypemobile"]);
            ViewProduct.SetIdBrand(idBrand);
            ViewProduct.SetNumProductWithBrand();
            ViewProduct.SetPageSize(size);
            if (currentpage > 0)
            {
                ViewProduct.SetCurrentPage(currentpage);
            }
            else
            {
                ViewProduct.SetCurrentPage();
            }
            Session["SSMobileBrand"] = ViewProduct;
        }
        nameBrand = ViewProduct.GetNameBrand();
        if (nameBrand.Length > 0)
        {
            tCurrentAccess += " &raquo; " + nameBrand;
        }
        blpro = string.Format(blpro, "<u>" + ViewProduct.GetNumberRecord() + "</u>");
        Product_data product = ViewProduct.ProductWithBrandFromTo();
        DataTable    table   = product.Tables[Product_data._table];
        int          numPro  = table.Rows.Count;
        Boolean      iseven  = true;

        if (ViewProduct.GetPages() > 1)
        {
            strpage1 = CreatePage(idBrand, ViewProduct.GetCurrentPage(), ViewProduct.GetPages(), ViewProduct.GetPageSize(), 1);
            strpage2 = CreatePage(idBrand, ViewProduct.GetCurrentPage(), ViewProduct.GetPages(), ViewProduct.GetPageSize(), 2);
        }
        else if (ViewProduct.GetPages() == 1)
        {
            strpage1 = ButtonCompare(true);
            strpage2 = ButtonCompare(false);
        }
        string strProMain = "";

        if (numPro > 0)
        {
            strAdvertise = GetAdvertiseWithBrand(idBrand.ToString());
            strProMain   = "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
            string    id        = "";
            string    name      = "";
            string    url       = "";
            string    price     = "";
            string    warranty  = "";
            float     rate      = (float)Application["ratepromobi"];
            float     price1    = 1;
            Boolean   istest    = false;
            ArrayList list      = new ArrayList();
            string    substring = "";
            string    madein    = "";
            string    isSpec    = "";
            if (ViewProduct.GetCurrentPage() == 1)
            {
                istest = true;
            }
            for (int i = 0; i < numPro; i++)
            {
                id   = table.Rows[i][Product_data._id].ToString();
                name = table.Rows[i][Product_data._name].ToString() + " " + table.Rows[i][Product_data._state].ToString();
                url  = table.Rows[i][Product_data._urlImage].ToString();
                if (url.Length > 0)
                {
                    url = "image/img_pro/" + url;
                }
                else
                {
                    url = "image/common/notimgpro.png";
                }
                //price = table.Rows[i][Product_data._price].ToString();
                price1   = float.Parse(table.Rows[i][Product_data._price].ToString());
                price1   = price1 * rate;
                price    = price1.ToString("N").Split('.')[0];
                warranty = table.Rows[i][Product_data._WarrantyMonth].ToString();
                madein   = table.Rows[i][Product_data._shortnote].ToString();
                isSpec   = table.Rows[i][Product_data._ispec].ToString();
                if (istest == true && price.Equals("0"))
                {
                    substring  = "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
                    substring += "<tr><td rowspan='2' width='95' align='center'>";
                    substring += "<a href='?menu=dp&id=" + id + "'><img class='img2' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)' src='" + url + "'/></a></td>";
                    substring += "<td class='txt2' colspan='2'><a href='?menu=dp&id=" + id + "' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)'>" + name + "</a></td></tr>";
                    substring += "<tr valign='top'><td width='159'>" + tprice + ": <span class='txt4'>";
                    substring += tupdate + "</span><br />";
                    substring += twarranty + ": <span class='txt4'>" + warranty + " " + tmonth + "</span><br />";
                    if (table.Rows[i][Product_data._ispromotion].ToString().Length > 0)
                    {
                        substring += "<img src='image/common/khuyenmai.gif' style='cursor:pointer;' onmouseover='showDivMessage(2," + id + "," + i + ",event);' onmouseout='OnMOut(event)'/><br />";
                    }
                    substring += "</td><td width='25'><input type='checkbox' id='c" + id + "' name='cp'/></td></tr>";
                    substring += "</table>";
                    list.Add(substring);
                    continue;
                }
                if (iseven)
                {
                    if (isSpec.Equals("1"))
                    {
                        strProMain += "<tr><td width='279' class='bgcl8'>";
                    }
                    else
                    {
                        strProMain += "<tr><td width='279'>";
                    }
                    strProMain += "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
                    strProMain += "<tr><td rowspan='2' width='95' align='center'>";
                    strProMain += "<a href='?menu=dp&id=" + id + "'><img class='img2' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)' src='" + url + "'/></a></td>";
                    strProMain += "<td class='txt2' colspan='2'><a href='?menu=dp&id=" + id + "' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)'>" + name + "</a></td></tr>";
                    strProMain += "<tr valign='top'><td width='159'>" + tprice + ": <span class='txt4'>";
                    if (price.Equals("0"))
                    {
                        strProMain += tupdate + "</span><br />";
                    }
                    else
                    {
                        strProMain += price + " " + unitPrice + "</span><br />";
                    }
                    strProMain += twarranty + ": <span class='txt4'>" + warranty + " " + tmonth + "</span><br />";
                    if (table.Rows[i][Product_data._ispromotion].ToString().Length > 0)
                    {
                        strProMain += "<img src='image/common/khuyenmai.gif' style='cursor:pointer;' onmouseover='showDivMessage(2," + id + "," + i + ",event);' onmouseout='OnMOut(event)'/><br />";
                    }
                    strProMain += "</td><td width='25'><input type='checkbox' id='c" + id + "' name='cp'/></td></tr>";
                    //strProMain += "<tr><td colspan='3' align='center' height='32'><div class='button3' onclick='AddCart(" + id + ",1);'>" + torder + "</div></td></tr>";
                    strProMain += "</table></td>";
                    strProMain += "<td class='line2'></td>";
                    iseven      = false;
                    if (i + 1 == numPro)
                    {
                        if (list.Count == 0)
                        {
                            strProMain += "<td width='279'>&nbsp;</td>";
                            strProMain += "</tr>";
                        }
                    }
                }
                else
                {
                    if (isSpec.Equals("1"))
                    {
                        strProMain += "<td width='279' class='bgcl8'>";
                    }
                    else
                    {
                        strProMain += "<td width='279'>";
                    }
                    strProMain += "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
                    strProMain += "<tr><td rowspan='2' width='95' align='center'>";
                    strProMain += "<a href='?menu=dp&id=" + id + "'><img class='img2' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)' src='" + url + "'/></a></td>";
                    strProMain += "<td class='txt2' colspan='2'><a href='?menu=dp&id=" + id + "' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)'>" + name + "</a></td></tr>";
                    strProMain += "<tr valign='top'><td width='159'>" + tprice + ": <span class='txt4'>";
                    if (price.Equals("0"))
                    {
                        strProMain += tupdate + "</span><br />";
                    }
                    else
                    {
                        strProMain += price + " " + unitPrice + "</span><br />";
                    }
                    strProMain += twarranty + ": <span class='txt4'>" + warranty + " " + tmonth + "</span><br />";
                    if (table.Rows[i][Product_data._ispromotion].ToString().Length > 0)
                    {
                        strProMain += "<img src='image/common/khuyenmai.gif' style='cursor:pointer;' onmouseover='showDivMessage(2," + id + "," + i + ",event);' onmouseout='OnMOut(event)'/><br />";
                    }
                    strProMain += "</td><td width='25'><input type='checkbox' id='c" + id + "' name='cp'/></td></tr>";
                    //strProMain += "<tr><td colspan='3' align='center' height='32'><div class='button3' onclick='AddCart(" + id + ",1);'>" + torder + "</div></td></tr>";
                    strProMain += "</table></td></tr>";
                    if (i + 1 < numPro)
                    {
                        strProMain += "<tr><td class='line1'></td><td></td><td class='line1'></td></tr>";
                    }
                    iseven = true;
                }
            }
            int numpro = list.Count;
            for (int i = 0; i < numpro; i++)
            {
                if (iseven)
                {
                    strProMain += "<tr><td width='279'>";
                    strProMain += list[i].ToString();
                    strProMain += "</td><td class='line2'></td>";
                    iseven      = false;
                    if (i + 1 == numpro)
                    {
                        strProMain += "<td width='279'>&nbsp;</td>";
                        strProMain += "</tr>";
                    }
                }
                else
                {
                    strProMain += "<td width='279'>";
                    strProMain += list[i].ToString();
                    strProMain += "</td></tr>";
                    if (i + 1 < numPro)
                    {
                        strProMain += "<tr><td class='line1'></td><td></td><td class='line1'></td></tr>";
                    }
                    iseven = true;
                }
            }
            strProMain += "</table>";
        }
        else
        {
            strProMain = tnotpro;
        }
        return(strProMain);
    }
コード例 #4
0
    public string ShowProductAll()
    {
        CDynamicViewProduct ViewProduct;
        int currentpage = 0;
        int size        = 20;

        try
        {
            currentpage = int.Parse(Request.QueryString["page"].ToString());
            size        = int.Parse(Request.QueryString["size"].ToString());
            if (size > 40 || size < 10)
            {
                size = 20;
            }
        }
        catch
        {
        }
        if (Session["SSProductOther"] != null)
        {
            ViewProduct = (CDynamicViewProduct)Session["SSProductOther"];
            ViewProduct.SetPageSize(size);
            if (currentpage > 0)
            {
                ViewProduct.SetCurrentPage(currentpage);
            }
            else
            {
                ViewProduct.SetNumberOther();
                ViewProduct.SetCurrentPage();
            }
        }
        else
        {
            ViewProduct  = new CDynamicViewProduct();
            string where = "where producttypeid not in (" + Application["idtypeproduct"].ToString() + "," + Application["apppda"].ToString() + ") and cansales=1";
            ViewProduct.SetWhere(where);
            ViewProduct.SetNumberOther();
            ViewProduct.SetPageSize(size);
            if (currentpage > 0)
            {
                ViewProduct.SetCurrentPage(currentpage);
            }
            else
            {
                ViewProduct.SetCurrentPage();
            }
            Session["SSProductOther"] = ViewProduct;
        }
        blpro = string.Format(blpro, "<u>" + ViewProduct.GetNumberRecord() + "</u>");
        DataSet   product = ViewProduct.ProductOtherFromTo();
        DataTable table   = product.Tables[0];
        int       numPro  = table.Rows.Count;

        if (ViewProduct.GetPages() > 1)
        {
            strpage1 = CreatePage(ViewProduct.GetCurrentPage(), ViewProduct.GetPages(), ViewProduct.GetPageSize(), 1);
            strpage2 = CreatePage(ViewProduct.GetCurrentPage(), ViewProduct.GetPages(), ViewProduct.GetPageSize(), 2);
        }
        string strProMain = "";

        if (numPro > 0)
        {
            string id       = "";
            string name     = "";
            string url      = "";
            string price    = "";
            string warranty = "";
            string note     = "";
            string brand    = "";
            strProMain = "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
            for (int i = 0; i < numPro; i++)
            {
                id   = table.Rows[i]["Id"].ToString();
                name = table.Rows[i]["Name"].ToString();
                url  = table.Rows[i]["UrlImage"].ToString();
                note = table.Rows[i]["Note"].ToString();
                if (url.Length > 0)
                {
                    url = "image/img_pro/" + url;
                }
                else
                {
                    url = "image/common/notimgpro.png";
                }
                price       = table.Rows[i]["SellingPrice"].ToString();
                warranty    = table.Rows[i]["WarrantyMonth"].ToString();
                brand       = table.Rows[i]["brand"].ToString();
                strProMain += "<tr><td width='300'>";
                strProMain += "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
                strProMain += "<tr><td rowspan='2' width='80' align='center'><a href='?menu=dother&id=" + id + "'><img class='img1' src='" + url + "'/></a></td>";
                strProMain += "<td class='text_title'><a href='?menu=dother&id=" + id + "'>" + name + "</a></td></tr>";
                strProMain += "<tr><td>" + tbrand + ": <span class='price'>" + brand + "</span><br />" + tprice + ": <span class='price'>" + price + " " + table.Rows[i]["currency"].ToString() + "</span><br />" + twarranty + ": <span class='price'>" + warranty + " " + tmonth + "</span>";
                if (table.Rows[i]["promotion"].ToString().Length > 0)
                {
                    strProMain += "<br /><img src='image/common/khuyenmai.gif' style='cursor:pointer;' onmouseover='showDivMessage(2," + id + "," + i + ",event);' onmouseout='OnMOut(event)'/>";
                }
                strProMain += "</td></tr>";
                strProMain += "<tr><td colspan='2' align='center'><div class='button3' onclick='AddCart(" + id + ",4);'>" + torder + "</div></td></tr>";
                strProMain += "</table></td>";
                strProMain += "<td>" + note + "</td></tr>";
                if (i < numPro - 1)
                {
                    strProMain += "<tr><td colspan='2' class='bg_line3'></td></tr>";
                }
            }
            strProMain += "</table>";
        }
        return(strProMain);
    }