void GetTotalPost()
    {
        string condition = DataExtension.AndConditon(
            DataExtension.OrConditon(
                GroupsTSql.GetGroupsByVgapp(TatThanhJsc.AboutUsModul.CodeApplications.AboutUs),
                GroupsTSql.GetGroupsByVgapp(TatThanhJsc.AdvertisingModul.CodeApplications.Advertising),
                GroupsTSql.GetGroupsByVgapp(TatThanhJsc.ProductModul.CodeApplications.Product),
                GroupsTSql.GetGroupsByVgapp(TatThanhJsc.DealModul.CodeApplications.Deal),
                GroupsTSql.GetGroupsByVgapp(TatThanhJsc.FileLibraryModul.CodeApplications.FileLibrary),
                GroupsTSql.GetGroupsByVgapp(TatThanhJsc.ServiceModul.CodeApplications.Service),
                GroupsTSql.GetGroupsByVgapp(TatThanhJsc.NewsModul.CodeApplications.News),
                GroupsTSql.GetGroupsByVgapp(TatThanhJsc.PhotoAlbumModul.CodeApplications.PhotoAlbum),
                GroupsTSql.GetGroupsByVgapp(TatThanhJsc.VideoModul.CodeApplications.Video),
                GroupsTSql.GetGroupsByVgapp(TatThanhJsc.QAModul.CodeApplications.QA),
                GroupsTSql.GetGroupsByVgapp(TatThanhJsc.CustomerReviewsModul.CodeApplications.CustomerReviews)
                ),
            GroupsTSql.GetGroupsByVglang(language));

        #region Hiển thị bài đã duyệt theo trạng thái phân quyền
        string userRole = CookieExtension.GetCookies("RolesUser");
        if (HorizaMenuConfig.ShowDuyetTin2)
        {
            if (StringExtension.RoleInListRoles(PhanQuyen.DuyetTin.Cap2, userRole))
            {
                #region Với tài khoản cấp 2 (trưởng ban biên tập)
                condition += " AND IIENABLE = '" + PhanQuyen.DuyetTin.Cap1 + "' ";
                #endregion
            }
            else if (StringExtension.RoleInListRoles(PhanQuyen.DuyetTin.Cap3, userRole))
            {
                #region Với tài khoản cấp 3 (tổng biên tập)
                condition += " AND IIENABLE = '" + PhanQuyen.DuyetTin.Cap2 + "' ";
                #endregion
            }
        }
        else if (HorizaMenuConfig.ShowDuyetTin1)
        {
            if (StringExtension.RoleInListRoles(PhanQuyen.DuyetTin.Cap3, userRole))
            {
                #region Với tài khoản cấp 3 (tổng biên tập)
                condition += " AND IIENABLE = '" + PhanQuyen.DuyetTin.Cap2 + "' ";
                #endregion
            }
        }
        #endregion

        string    orderBy = " DCREATEDATE DESC ";
        DataTable dt      = GroupsItems.GetAllData("", "*", condition, orderBy);
        if (dt.Rows.Count > 0)
        {
            totalPost.Text = " (" + dt.Rows.Count + ")";
        }
    }
Example #2
0
    void GetNew(string order)
    {
        if (!modul.Equals(""))
        {
            condition = DataExtension.AndConditon(
                "VGAPP = '" + modul + "'",
                GroupsTSql.GetGroupsByVglang(language));
        }
        else
        {
            condition = DataExtension.AndConditon(
                DataExtension.OrConditon(
                    GroupsTSql.GetGroupsByVgapp(TatThanhJsc.AboutUsModul.CodeApplications.AboutUs),
                    GroupsTSql.GetGroupsByVgapp(TatThanhJsc.AdvertisingModul.CodeApplications.Advertising),
                    GroupsTSql.GetGroupsByVgapp(TatThanhJsc.ProductModul.CodeApplications.Product),
                    GroupsTSql.GetGroupsByVgapp(TatThanhJsc.DealModul.CodeApplications.Deal),
                    GroupsTSql.GetGroupsByVgapp(TatThanhJsc.FileLibraryModul.CodeApplications.FileLibrary),
                    GroupsTSql.GetGroupsByVgapp(TatThanhJsc.ServiceModul.CodeApplications.Service),
                    GroupsTSql.GetGroupsByVgapp(TatThanhJsc.NewsModul.CodeApplications.News),
                    GroupsTSql.GetGroupsByVgapp(TatThanhJsc.PhotoAlbumModul.CodeApplications.PhotoAlbum),
                    GroupsTSql.GetGroupsByVgapp(TatThanhJsc.VideoModul.CodeApplications.Video),
                    GroupsTSql.GetGroupsByVgapp(TatThanhJsc.QAModul.CodeApplications.QA),
                    GroupsTSql.GetGroupsByVgapp(TatThanhJsc.CustomerReviewsModul.CodeApplications.CustomerReviews)
                    ),
                GroupsTSql.GetGroupsByVglang(language));
        }

        #region Hiển thị bài đã duyệt theo trạng thái phân quyền
        string userRole = CookieExtension.GetCookies("RolesUser");
        if (HorizaMenuConfig.ShowDuyetTin2)
        {
            if (StringExtension.RoleInListRoles(PhanQuyen.DuyetTin.Cap2, userRole))
            {
                #region Với tài khoản cấp 2 (trưởng ban biên tập)
                condition += " AND IIENABLE = '" + PhanQuyen.DuyetTin.Cap2 + "' ";
                #endregion
            }
            else if (StringExtension.RoleInListRoles(PhanQuyen.DuyetTin.Cap3, userRole))
            {
                #region Với tài khoản cấp 3 (tổng biên tập)
                condition += " AND IIENABLE = '1' ";
                #endregion
            }
        }
        else if (HorizaMenuConfig.ShowDuyetTin1)
        {
            if (StringExtension.RoleInListRoles(PhanQuyen.DuyetTin.Cap3, userRole))
            {
                #region Với tài khoản cấp 3 (tổng biên tập)
                condition += " AND IIENABLE = '1' ";
                #endregion
            }
        }
        #endregion

        if (!title.Equals(""))
        {
            condition += " AND " + SearchTSql.GetSearchMathedCondition(title, ItemsColumns.VititleColumn);
        }

        if (!DateFrom.Equals(""))
        {
            DateTime dFrom = DateTime.ParseExact(DateFrom, "dd/MM/yyyy", null);
            condition += " AND DICREATEDATE >= '" + dFrom.ToString("yyyy-MM-dd HH:mm:ss") + "'";
        }

        if (!DateTo.Equals(""))
        {
            DateTime dTo = DateTime.ParseExact(DateTo, "dd/MM/yyyy", null).AddDays(1);
            condition += " AND DICREATEDATE < '" + dTo.ToString("yyyy-MM-dd HH:mm:ss") + "'";
        }

        if (!user.Equals(""))
        {
            condition += " AND " + SearchTSql.GetSearchMathedCondition(user, ItemsColumns.ViUrl);
        }

        condition += " AND VISEOMETACANONICAL <> '' ";

        if (order.Length > 0)
        {
            orderBy = order;
        }
        else
        {
            orderBy = CookieExtension.GetCookiesSort(sortCookiesName);
            if (orderBy.Length < 1)
            {
                orderBy = " DCREATEDATE DESC ";
            }
        }

        DataSet ds = new DataSet();
        ds = GroupsItems.GetAllDataPagging(p, DdlListShowItem.SelectedValue, condition, orderBy);
        DataTable dt = new DataTable();
        dt = ds.Tables[1];

        string key        = "modul=" + modul + "&user="******"&title=" + title + "&DateFrom=" + DateFrom + "&DateTo=" + DateTo + "&NumberShowItem=" + NumberShowItem;
        string linkSearch = UrlExtension.WebisteUrl + "/admin.aspx?uc=DuyetTin&suc=BaiVietDaDuyet&" + key;
        LtPagging.Text = PagingExtension.SpilitPages(Convert.ToInt32(dt.Rows[0]["TotalRows"]),
                                                     Convert.ToInt16(DdlListShowItem.SelectedValue), Convert.ToInt32(p),
                                                     linkSearch, "currentPS", "otherPS", "firstPS",
                                                     "lastPS", "previewPS", "nextPS");
        LtPaggingTop.Text      = LtPagging.Text;
        rp_mn_users.DataSource = ds.Tables[0];
        rp_mn_users.DataBind();
    }