private void LoadData()
    {
        string html = "";
        string Lang = Globals.GetLang();

        MyTool.Product obj = new MyTool.Product();
        if (_isAgentCat)
        {
            _agentCatID = Globals.AgentCatID;
        }
        DataSet ds = obj.GetTopHotProduct("ProductCat", _agentCatID, _nTop, Lang);

        divContent.InnerHtml = ProductListHtmlHelper.GetHtmlString(ds, Lang, 0, ds.Tables[0].Rows.Count, 150, _imageHeight);

        /*for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         * {
         *  //detailUrl = "ProductDetail.aspx?ID=" + DataObject.GetString(ds, i, "ID") + "&CatID=" + DataObject.GetString(ds, i, "GroupID") + "&Lang=" + Lang;
         *  string detailUrl = Globals.GetUploadsUrl() + DataObject.GetString(ds, i, "Anh");
         *  html += "<div class=\"product-item\">";
         *  //html += "<a href=\"" + detailUrl + "\" class=\"product-name\">" + DataObject.GetString(ds, i, "TenGoi") + "</a>";
         *  html += "<a href=\"" + detailUrl + "\" class=\"product-image\" onclick=\"return hs.expand(this)\">";
         *  if (Globals.IsFileExistent(DataObject.GetString(ds, i, "Anh")))
         *      html += "<img width=\"" + _imageWidth + "\" height=\"" + _imageHeight + "\" src=\"Thumbnail.ashx?width=" + _imageWidth + "&height=" + _imageHeight + "&ImgFilePath=" + Globals.GetUploadsUrl() + DataObject.GetString(ds, i, "Anh") + "\" />";
         *  else
         *      html += "<img width=\"" + _imageWidth + "\" height=\"" + _imageHeight + "\" src=\"" + Globals.DefaultImage + "\" />";
         *  html += "</a>";
         *  //html += "<span class=\"product-price\">" + Globals.FormatStringThousand(DataObject.GetDouble(ds, i, "GiaBan")) + " " + DataObject.GetString(ds, i, "NgoaiTe") + "</span>";
         *  html += "</div>";
         * }
         * divContent.InnerHtml = html;*/
    }
Exemplo n.º 2
0
    public void LoadListProducts()
    {
        string      Lang            = Globals.GetLang();
        LanguageXML langXml         = new LanguageXML("Language" + Lang);
        Product     obj             = new Product();
        Catalog     objC            = new Catalog();
        int         CatID           = Globals.GetIntFromQueryString("CatID");
        int         ProducerID      = Globals.GetIntFromQueryString("ProducerID");
        string      Text            = Globals.GetStringFromQueryString("Text");
        string      StringCatalogID = "";

        if (CatID != -1)
        {
            StringCatalogID = objC.GetStringCatalogIDByParentCatID(CatID, Globals.AgentCatID, Lang);
        }
        DataSet ds = new DataSet();

        //if (CatID != -1 && ProducerID != -1) //tìm kiếm
        ds = obj.SearchProduct("ProductCat", Globals.AgentCatID, Lang, Text, StringCatalogID, ProducerID, "Default");

        /*else if (CatID != -1) //theo danh mục sp
         * {
         *  string strCatID = objC.GetStringCatalogIDByParentCatID(CatID, Globals.AgentCatID, Lang);
         *  ds = obj.GetProductByStringCatalogID("ProductCat", Lang, strCatID);
         *  //ds = obj.GetProductByCatalogID("ProductCat", Lang, CatID);
         * }
         * else if (ProducerID != -1) //theo nhà sx
         *  ds = obj.GetProductByProducerID("ProductCat", ProducerID, Lang);
         * else //tất cả
         *  ds = obj.GetAllProduct("ProductCat", Globals.AgentCatID, Lang);
         */
        int TotalItems = ds.Tables[0].Rows.Count;

        if (TotalItems % PageSize == 0)
        {
            PageCount = TotalItems / PageSize;
        }
        else
        {
            PageCount = TotalItems / PageSize + 1;
        }

        Int32 Page = Globals.GetIntFromQueryString("Page");

        if (Page == -1)
        {
            Page = 1;
        }
        int FromRow = (Page - 1) * PageSize;
        int ToRow   = Page * PageSize - 1;

        if (ToRow >= TotalItems)
        {
            ToRow = TotalItems - 1;
        }
        Response.Write(ProductListHtmlHelper.GetHtml(ds, Lang, FromRow, ToRow + 1));
    }
Exemplo n.º 3
0
    private void LoadData()
    {
        string      html            = "";
        string      Lang            = Globals.GetLang();
        LanguageXML langXml         = new LanguageXML("Language" + Lang);
        Product     obj             = new Product();
        Catalog     objC            = new Catalog();
        int         CatID           = Globals.GetIntFromQueryString("CatID");
        int         ProducerID      = Globals.GetIntFromQueryString("ProducerID");
        string      Text            = Globals.GetStringFromQueryString("Text");
        string      StringCatalogID = "";
        string      detailUrl       = "";

        if (CatID == -1)
        {
            lblSubject.Text = langXml.GetString("Web", "Text", "ListOfAllProduct");
        }
        else if (CatID != -1)
        {
            lblSubject.Text = objC.GetCatalogNameByCatalogID(CatID);
            StringCatalogID = objC.GetStringCatalogIDByParentCatID(CatID, Globals.AgentCatID, Lang);
        }
        DataSet ds = new DataSet();

        ds = obj.SearchProduct("ProductCat", Globals.AgentCatID, Lang, Text, StringCatalogID, ProducerID, "Default");

        int PageCount  = 0;
        int TotalItems = ds.Tables[0].Rows.Count;

        if (TotalItems % PageSize == 0)
        {
            PageCount = TotalItems / PageSize;
        }
        else
        {
            PageCount = TotalItems / PageSize + 1;
        }

        Int32 Page = Globals.GetIntFromQueryString("Page");

        if (Page == -1)
        {
            Page = 1;
        }
        int FromRow = (Page - 1) * PageSize;
        int ToRow   = Page * PageSize - 1;

        if (ToRow >= TotalItems)
        {
            ToRow = TotalItems - 1;
        }

        /*for (int i = FromRow; i < ToRow + 1; i++)
         * {
         *  if (_isViewLinkDetail)
         *      detailUrl = "ProductDetail.aspx?ID=" + DataObject.GetString(ds, i, "ID") + "&CatID=" + DataObject.GetString(ds, i, "GroupID") + "&Lang=" + Lang;
         *  else
         *      detailUrl = Globals.GetUploadsUrl() + DataObject.GetString(ds, i, "Anh");
         *  html += "<div class=\"product-item\">";
         *  html += "<a href=\"" + detailUrl + "\" class=\"product-name\">" + DataObject.GetString(ds, i, "TenGoi") + "</a>";
         *  if (_isViewLinkDetail)
         *      html += "<a href=\"" + detailUrl + "\" class=\"product-image\">";
         *  else
         *      html += "<a href=\"" + detailUrl + "\" class=\"product-image\" onclick=\"return hs.expand(this)\">";
         *  if (Globals.IsFileExistent(DataObject.GetString(ds, i, "Anh")))
         *      html += "<img width=\"" + _imageWidth + "\" height=\"" + _imageHeight + "\" src=\"Thumbnail.ashx?width=" + _imageWidth + "&height=" + _imageHeight + "&ImgFilePath=" + Globals.GetUploadsUrl() + DataObject.GetString(ds, i, "Anh") + "\" />";
         *  else
         *      html += "<img width=\"" + _imageWidth + "\" height=\"" + _imageHeight + "\" src=\"" + Globals.DefaultImage + "\" />";
         *  html += "</a>";
         *  if (_isViewPrice)
         *      html += "<span class=\"product-price\">" + Globals.FormatStringThousand(DataObject.GetDouble(ds, i, "GiaBan")) + " " + DataObject.GetString(ds, i, "NgoaiTe") + "</span>";
         *  if (_isViewProductDesc)
         *      html += "<span class=\"product-excerpt\">" + DataObject.GetString(ds, i, "ThongTin1") + "</span>";
         *  if (_isViewLinkAddCart)
         *      html += "html for button add to cart";
         *  html += "</div>";
         * }*/
        divContent.InnerHtml = ProductListHtmlHelper.GetHtmlString(ds, Lang, 0, ds.Tables[0].Rows.Count, _imageWidth, _imageHeight);
        divPaging.InnerHtml  = Paging.GetHtmlPaging(Context.Request.RawUrl, PageCount);
    }