예제 #1
0
    void GetList()
    {
        #region Condition, orderby
        string condition = "";

        if (igid != "")
        {
            condition = GroupsItemsTSql.GetItemsInGroupCondition(igid, "");
        }
        else
        {
            condition = GroupsTSql.GetGroupsByVgapp(app);
        }
        condition = DataExtension.AndConditon(
            condition,
            GroupsTSql.GetGroupsByVglang(lang),
            GroupsTSql.GetGroupsByIgenable("1"),
            ItemsTSql.GetItemsByIienable("1"),
            ItemsTSql.GetItemsByViapp(app));

        if (key.Length > 0)
        {
            condition = DataExtension.AndConditon(condition, SearchTSql.GetSearchMathedCondition(key, ItemsColumns.VititleColumn, ItemsColumns.VikeyColumn, ItemsColumns.FipriceColumn, ItemsColumns.FisalepriceColumn));
        }

        string orderby = ItemsColumns.IiorderColumn + "," + ItemsColumns.DicreatedateColumn + " desc ";

        try
        {
            rows = int.Parse(SettingsExtension.GetSettingKey(maxItemKey, lang));
        }
        catch { }
        #endregion

        DataSet ds = GroupsItems.GetAllDataPagging(p, rows.ToString(), condition, orderby);
        if (ds.Tables.Count > 0)
        {
            DataTable dt      = ds.Tables[0];
            DataTable dtPager = ds.Tables[1];

            #region Lấy ra danh sách bài viết
            if (dt.Rows.Count > 0)
            {
                string link = "";
                string bigPost = "", smallPost = "";
                string price = "", salePrice = "";
                int    point = 2;

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    link      = (UrlExtension.WebisteUrl + dt.Rows[i][ItemsColumns.VISEOLINKSEARCHColumn] + RewriteExtension.Extensions).ToLower();
                    price     = dt.Rows[i][ItemsColumns.FipriceColumn].ToString();
                    salePrice = dt.Rows[i][ItemsColumns.FisalepriceColumn].ToString();

                    if (price == "0" || price == "")
                    {
                        price     = "";
                        salePrice = LanguageItemExtension.GetnLanguageItemTitleByName("Liên hệ");
                    }
                    else if (salePrice == "0" || salePrice == "")
                    {
                        salePrice = NumberExtension.FormatNumber(price) + LanguageItemExtension.GetnLanguageItemTitleByName("VNĐ");
                        price     = "";
                    }
                    else
                    {
                        price     = NumberExtension.FormatNumber(price) + LanguageItemExtension.GetnLanguageItemTitleByName("VNĐ");
                        salePrice = NumberExtension.FormatNumber(salePrice) + LanguageItemExtension.GetnLanguageItemTitleByName("VNĐ");
                    }

                    if (i < point)
                    {
                        bigPost += @"
            <div class='blog'>
              <div class='item item-row'>
                <div class='item-img'>
                  <a href='" + link + @"' class='imgc'>
                    " + ImagesExtension.GetImage(pic, dt.Rows[i][ItemsColumns.ViimageColumn].ToString(), dt.Rows[i][ItemsColumns.VititleColumn].ToString(), "", true, false, "") + @"
                  </a>
                </div>
                <div class='item-body'>
                  <h3>
                    <a href='" + link + @"' class='title item-title fSize-20'>" + dt.Rows[i][ItemsColumns.VititleColumn] + @"</a>
                  </h3>
                  <div class='item-text'>
                    " + StringExtension.LayChuoi(dt.Rows[i][ItemsColumns.VicontentColumn].ToString(), "", 1) + @"
                  </div>
                  <div class='item-price'>
                    <span class='real'>" + salePrice + @"</span>
                    <span class='throught'>" + price + @"</span>
                  </div>
                  <a href='" + link + @"' class='link item-link' title='" + LanguageItemExtension.GetnLanguageItemTitleByName("More") + @"'>" + LanguageItemExtension.GetnLanguageItemTitleByName("More") + @" <i class='fa fa-angle-right' aria-hidden='true'></i>
                  </a>
                </div>
              </div>
            </div>";
                    }
                    else
                    {
                        smallPost += @"
            <div class='col-12 col-sm-12 col-md-6 col-lg-6 col-xl-3'>
              <div class='item item-post'>
                <div class='item-img'>
                  <a href='" + link + @"' class='imgc'>
                    " + ImagesExtension.GetImage(pic, dt.Rows[i][ItemsColumns.ViimageColumn].ToString(), dt.Rows[i][ItemsColumns.VititleColumn].ToString(), "", true, false, "") + @"
                  </a>
                </div>
                <div class='item-body'>
                  <h3>
                    <a href='" + link + @"' class='title item-title'>" + dt.Rows[i][ItemsColumns.VititleColumn] + @"</a>
                  </h3>
                  <div class='item-price'>
                    <span class='real'>" + salePrice + @"</span>
                    <span class='throught'>" + price + @"</span>
                  </div>
                  <a href='" + link + @"' class='link item-link' title='" + LanguageItemExtension.GetnLanguageItemTitleByName("More") + @"'>" + LanguageItemExtension.GetnLanguageItemTitleByName("More") + @" <i class='fa fa-angle-right' aria-hidden='true'></i>
                  </a>
                </div>
              </div>
            </div>";
                    }

                    ltrList.Text = @"
           <div class='sublist sublist-1'>
            <div class='sublist-body'>
              <div class='slick-slider' data-slick='{'slidesToShow': 1, 'slidesToScroll': 1, 'autoplay': true, 'dots': false, 'arrows':true}'>
                " + bigPost + @"
              </div>
            </div>
          </div>
          <div class='sublist sublist-2'>
            <div class='sublist-body'>
              <div class='row'>
                " + smallPost + @"
              </div>
            </div>
          </div>";
                }
            }
            #endregion

            #region Xuất ra phân trang
            if (dtPager.Rows.Count > 0 && dt.Rows.Count > 0)
            {
                string split = PagingExtension.SpilitPages(int.Parse(dtPager.Rows[0]["TotalRows"].ToString()), rows, int.Parse(p), "", "hientai", "trangkhac", "dau", "cuoi", "truoc", "sau");
                if (split.Length > 0)
                {
                    int totalPage = 0;
                    try
                    {
                        double totalrow = double.Parse(dtPager.Rows[0]["TotalRows"].ToString());

                        totalPage = (int)(totalrow / rows);
                        if (totalPage < (totalrow / rows))
                        {
                            totalPage++;
                        }
                    }
                    catch { }

                    ltrPaging.Text +=
                        PagingExtension02.XuLyPhanTrang(split, dtPager.Rows[0]["TotalRows"].ToString(),
                                                        (title != "" ? title : go), LanguageItemExtension.GetnLanguageItemTitleByName("Đầu"),
                                                        LanguageItemExtension.GetnLanguageItemTitleByName("Cuối"),
                                                        LanguageItemExtension.GetnLanguageItemTitleByName("Trước"),
                                                        LanguageItemExtension.GetnLanguageItemTitleByName("Sau"));
                }
                else
                {
                    if (dt.Rows.Count < 1)
                    {
                        ltrList.Text += "<div class='emptyresult'>" + LanguageItemExtension.GetnLanguageItemTitleByName(noResultText) + "</div>";
                    }
                }
            }
            else
            {
                ltrList.Text += "<div class='emptyresult'>" + LanguageItemExtension.GetnLanguageItemTitleByName(noResultText) + "</div>";
            }
            #endregion
        }
    }
예제 #2
0
    void GetList()
    {
        #region Condition, orderby
        string condition = "";

        if (igid != "")
        {
            condition = GroupsItemsTSql.GetItemsInGroupCondition(igid, "");
        }
        else
        {
            condition = GroupsTSql.GetGroupsByIgid(igidFirst);
        }

        condition = DataExtension.AndConditon(
            condition,
            GroupsTSql.GetGroupsByVglang(lang),
            GroupsTSql.GetGroupsByIgenable("1"),
            ItemsTSql.GetItemsByIienable("1"),
            ItemsTSql.GetItemsByViapp(app));

        if (key.Length > 0)
        {
            condition = DataExtension.AndConditon(condition, SearchTSql.GetSearchMathedCondition(key, ItemsColumns.VititleColumn, ItemsColumns.VikeyColumn, ItemsColumns.FipriceColumn, ItemsColumns.FisalepriceColumn));
        }

        string orderby = ItemsColumns.IiorderColumn + "," + ItemsColumns.DicreatedateColumn + " desc ";

        try
        {
            rows = int.Parse(SettingsExtension.GetSettingKey(maxItemKey, lang));
        }
        catch { }
        #endregion

        DataSet ds = GroupsItems.GetAllDataPagging(p, rows.ToString(), condition, orderby);
        if (ds.Tables.Count > 0)
        {
            DataTable dt      = ds.Tables[0];
            DataTable dtPager = ds.Tables[1];

            #region Lấy ra danh sách bài viết
            if (dt.Rows.Count > 0)
            {
                string link = "";
                string price = "", salePrice = "";
                string time  = "";
                int    point = 2;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    link      = (UrlExtension.WebisteUrl + dt.Rows[i][ItemsColumns.VISEOLINKSEARCHColumn] + RewriteExtension.Extensions).ToLower();
                    price     = dt.Rows[i][ItemsColumns.FipriceColumn].ToString();
                    salePrice = dt.Rows[i][ItemsColumns.FisalepriceColumn].ToString();

                    if (price == "0" || price == "")
                    {
                        price     = "";
                        salePrice = LanguageItemExtension.GetnLanguageItemTitleByName("Liên hệ");
                    }
                    else if (salePrice == "0" || salePrice == "")
                    {
                        salePrice = NumberExtension.FormatNumber(price) + LanguageItemExtension.GetnLanguageItemTitleByName("VNĐ");
                        price     = "";
                    }
                    else
                    {
                        price     = NumberExtension.FormatNumber(price) + LanguageItemExtension.GetnLanguageItemTitleByName("VNĐ");
                        salePrice = NumberExtension.FormatNumber(salePrice) + LanguageItemExtension.GetnLanguageItemTitleByName("VNĐ");
                    }

                    time = LayThoiGianTour(dt.Rows[i][ItemsColumns.ViurlColumn].ToString());

                    if (i < point)
                    {
                        ltrList1.Text += @"
          <div class='item item-post item-big'>
            <div class='item-img'>
              <a href='" + link + @"' class='imgc' title='" + dt.Rows[i][ItemsColumns.VititleColumn] + @"'>
                " + ImagesExtension.GetImage(pic, dt.Rows[i][ItemsColumns.ViimageColumn].ToString(), dt.Rows[i][ItemsColumns.VititleColumn].ToString(), "", true, false, "") + @"
              </a>
              <div class='item-date'>
                <div>
                  <i class='fa fa-calendar' aria-hidden='true'></i><span>" + LanguageItemExtension.GetnLanguageItemTitleByName("Time") + @": " + time + @"</span>
                </div>
                <div>
                  <i class='fa fa-plane' aria-hidden='true'></i><span>" + LanguageItemExtension.GetnLanguageItemTitleByName("Departure") + @": " + dt.Rows[i][ItemsColumns.VISEOMETAPARAMSColumn] + @"</span>
                </div>
              </div>
            </div>
            <div class='item-body'>
              <h3>
                <a href='" + link + @"' class='title item-title' title='" + dt.Rows[i][ItemsColumns.VititleColumn] + @"'>" + dt.Rows[i][ItemsColumns.VititleColumn] + @"</a>
              </h3>
              <p class='item-text'>" + dt.Rows[i][ItemsColumns.VidescColumn].ToString() + @"</p>
              <div class='item-price'>
                <span class='real'>" + salePrice + @"</span>
                <span class='throught'>" + price + @"</span>
              </div>
              <a href='" + link + @"' class='link item-link' title='" + LanguageItemExtension.GetnLanguageItemTitleByName("More") + @"'>" + LanguageItemExtension.GetnLanguageItemTitleByName("More") + @" <i class='fa fa-angle-right' aria-hidden='true'></i>
              </a>
            </div>
          </div>";
                    }
                    else
                    {
                        ltrList2.Text += @"
          <div class='col'>
            <div class='item item-post'>
              <div class='item-img'>
                <a href='" + link + @"' title='" + dt.Rows[i][ItemsColumns.VititleColumn] + @"' class='imgc'>
                  " + ImagesExtension.GetImage(pic, dt.Rows[i][ItemsColumns.ViimageColumn].ToString(), dt.Rows[i][ItemsColumns.VititleColumn].ToString(), "", true, false, "") + @"
                </a>
                <div class='item-date'>
                  <div>
                    <i class='fa fa-calendar' aria-hidden='true'></i><span>" + LanguageItemExtension.GetnLanguageItemTitleByName("Time") + @": " + time + @"</span>
                  </div>
                  <div>
                    <i class='fa fa-plane' aria-hidden='true'></i><span>" + LanguageItemExtension.GetnLanguageItemTitleByName("Departure") + @": " + dt.Rows[i][ItemsColumns.VISEOMETAPARAMSColumn] + @"</span>
                  </div>
                </div>
              </div>
              <div class='item-body'>
                <h3>
                  <a href='" + link + @"' class='title item-title' title='" + dt.Rows[i][ItemsColumns.VititleColumn] + @"'>" + dt.Rows[i][ItemsColumns.VititleColumn] + @"</a>
                </h3>
                <div class='item-price'>
                  <span class='real'>" + salePrice + @"</span>
                  <span class='throught'>" + price + @"</span>
                </div>
                <a href='" + link + @"' class='link item-link' title='" + LanguageItemExtension.GetnLanguageItemTitleByName("More") + @"'>" + LanguageItemExtension.GetnLanguageItemTitleByName("More") + @" <i class='fa fa-angle-right' aria-hidden='true'></i>
                </a>
              </div>
            </div>
          </div>";
                    }
                }
            }
            #endregion

            #region Xuất ra phân trang
            if (dtPager.Rows.Count > 0 && dt.Rows.Count > 0)
            {
                string split = PagingExtension.SpilitPages(int.Parse(dtPager.Rows[0]["TotalRows"].ToString()), rows, int.Parse(p), "", "hientai", "trangkhac", "dau", "cuoi", "truoc", "sau");
                if (split.Length > 0)
                {
                    int totalPage = 0;
                    try
                    {
                        double totalrow = double.Parse(dtPager.Rows[0]["TotalRows"].ToString());

                        totalPage = (int)(totalrow / rows);
                        if (totalPage < (totalrow / rows))
                        {
                            totalPage++;
                        }
                    }
                    catch { }

                    ltrPaging.Text +=
                        PagingExtension02.XuLyPhanTrang(split, dtPager.Rows[0]["TotalRows"].ToString(),
                                                        (title != "" ? title : go), LanguageItemExtension.GetnLanguageItemTitleByName("Trang đầu"),
                                                        LanguageItemExtension.GetnLanguageItemTitleByName("Trang cuối"),
                                                        LanguageItemExtension.GetnLanguageItemTitleByName("Trước"),
                                                        LanguageItemExtension.GetnLanguageItemTitleByName("Sau"));
                }
                else
                {
                    if (dt.Rows.Count < 1)
                    {
                        ltrNoResult.Text += "<div class='emptyresult'>" + LanguageItemExtension.GetnLanguageItemTitleByName(noResultText) + "</div>";
                        pnInfo.Visible    = false;
                    }
                }
            }
            else
            {
                ltrNoResult.Text += "<div class='emptyresult'>" + LanguageItemExtension.GetnLanguageItemTitleByName(noResultText) + "</div>";
                pnInfo.Visible    = false;
            }
            #endregion
        }
    }