public string LoadDocs(int pageSize = 10) { StringBuilder str = new StringBuilder(); string sql = "select Doc_ID,Doc_Avatar, Doc_Code, Doc_Staff, Doc_ViewCount, Doc_Name, Doc_Title, Doc_Content, Doc_File, Doc_CreatedDate, DocsType_ID, Doc_CreatedBy, Doc_Hot, Doc_Pos from tbl_Documents Order By Doc_CreatedDate DESC"; DataTable ds = UpdateData.UpdateBySql(sql).Tables[0]; DataRowCollection rows = ds.Rows; if (rows.Count > 0) { int currentPage = Request["page"] != null?int.Parse(Request["page"]) : 1; int totalpage = (int)rows.Count / pageSize; int startrow = totalpage < 1? 0 : (currentPage * pageSize); int endrow = totalpage < 1 ? rows.Count : startrow + pageSize; for (int i = startrow; i < endrow; i++) { str.Append("<tr>"); str.Append(" <td align=center>" + i + "</td>"); str.Append(" <td>" + rows[i]["Doc_Code"] + "</td>"); str.Append(" <td class=\"text-center\"><a id=\"link-docname\" href=?d=" + rows[i]["Doc_ID"] + ">" + rows[i]["Doc_Name"] + "</a></td>"); str.Append(" <td class=\"doc-content\">" + rows[i]["Doc_Content"] + "</td>"); str.Append(" <td>" + DateTime.Parse(rows[i]["Doc_CreatedDate"].ToString()).ToString("dd/MM/yyyy") + "</td>"); str.Append("<td><a class=\"text-center\" href=\"" + rows[i]["Doc_File"] + "\"><i class=\"fa fa-download\"></i>Tải về</a></td>"); str.Append("</tr>"); } phantrang pages = new phantrang(); if (rows.Count > pageSize) { str.Append(pages.pagelink((int)rows.Count / 1, currentPage, "?")); } } return(str.ToString()); }
protected string LoadEnterprise(int p) { int parent = ModControl.GetParent(p) != 0 ? ModControl.GetParent(p) : p; string sql = "select * from tbl_Content where lang=" + Session["vlang"]; sql += " and Mod_ID=" + p; if (ModControl.GetParent(p) == 0) { sql += " OR Mod_ID in (SELECT Mod_ID FROM tbl_Mod WHERE Mod_Parent=" + p + ")"; } sql += " Order By Content_Date DESC"; DataSet ds = UpdateData.UpdateBySql(sql); DataRowCollection rows = ds.Tables[0].Rows; StringBuilder str = new StringBuilder(); if (rows.Count > 0) { int currentPage = Request["page"] != null?int.Parse(Request["page"]) : 1; int totalpage = (int)rows.Count / 5 + 1; int startrow = totalpage < 1 ? 0 : ((currentPage - 1) * 5); int endrow = 0; if (currentPage == totalpage) { endrow = rows.Count; } else { endrow = totalpage < 1 ? rows.Count : startrow + 5; } for (int i = startrow; i < endrow; i++) { str.Append(" <div class=\"w100 item fl\">"); str.Append(" <div class=\"row\">"); str.Append(" <div class=\"image content-left-dst tin-tucnews\">"); str.Append(" <a href=\"/" + ModControl.GetModCode(p) + "/" + ContentControl.GetContentField("Code", int.Parse(rows[i]["Content_ID"].ToString())) + ".htm\"><img class=\"img-responsive\" src=" + rows[i]["Content_img"] + "></a>"); str.Append(" </div>"); str.Append(" <div class=\"content-right-dst\">"); str.Append(" <div class=\"date-author w100 fl\">"); string name = rows[i]["Content_Name"].ToString().Length > 70 ? rows[i]["Content_Name"].ToString().Substring(0, 70) + "..." : rows[i]["Content_Name"].ToString(); str.Append(" <div class=\"title\">"); str.Append(" <h2><a href=\"/" + ModControl.GetModCode(p) + "/" + ContentControl.GetContentField("Code", int.Parse(rows[i]["Content_ID"].ToString())) + ".htm\">" + name + "</a></h2>"); str.Append(" <span><i class=\"fa fa-calendar\"></i> Ngày đăng:" + rows[i]["Content_Date"] + "</span></div>"); str.Append(" <div>"); string quote = rows[i]["Content_Intro"].ToString().Length > 200 ? rows[i]["Content_Intro"].ToString().Substring(0, 200) : rows[i]["Content_Intro"].ToString(); str.Append(" <div class=\"description\">" + quote + "...</div>"); str.Append(" <div>"); str.Append(" </div>"); str.Append("</div></div></div></div></div>"); } phantrang pages = new phantrang(); if (rows.Count > 5) { str.Append("<span class=\"pull-right\">" + pages.pagelink((int)rows.Count / 5 + 1, currentPage, "?") + "</span>"); } } return(str.ToString()); }
protected string LoadContentNews(int p) { string sql = "select * from tbl_Content where lang=" + Session["vlang"] + "and Mod_ID=" + p + "Order By Content_Date DESC"; DataSet ds = UpdateData.UpdateBySql(sql); DataRowCollection rows = ds.Tables[0].Rows; StringBuilder str = new StringBuilder(); if (rows.Count > 0) { int currentPage = Request["page"] != null?int.Parse(Request["page"]) : 1; int totalpage = (int)rows.Count / pageSize + 1; int startrow = totalpage < 1 ? 0 : ((currentPage - 1) * pageSize); int endrow = 0; if (currentPage == totalpage) { endrow = rows.Count; } else { endrow = totalpage < 1 ? rows.Count : startrow + pageSize; } for (int i = startrow; i < endrow; i++) { string quote = rows[i]["Content_Intro"].ToString().Length > 200 ? rows[i]["Content_Intro"].ToString().Substring(0, 200) : rows[i]["Content_Intro"].ToString(); string title = rows[i]["Content_name"].ToString(); string datetime = rows[i]["Content_Date"].ToString(); if (!string.IsNullOrEmpty(datetime)) { datetime = DateTime.Parse(datetime).ToString("dd/MM/yyyy"); } str.Append("<div class=\"item_article\">"); str.Append("<div class=\"article_content\">"); str.Append("<div class=\"article_image\">"); str.Append("<a href=\"" + quote + "\">"); str.Append("<img class=\"img-responsive\" border=\"0\" src=\"" + rows[i]["Content_img"] + "\" alt=\"" + title + "\"></a></div>"); str.Append("<div class=\"article_info\">"); str.Append("<h3 class=\"title\"><a href = \"" + ModControl.GetModCode(p) + "/" + ContentControl.GetContentField("Code", int.Parse(rows[i]["Content_ID"].ToString())) + ".htm\">" + title + "</a></h3>"); str.Append("<span><p>" + quote + "</p></span>"); str.Append("<span class=\"datenewsl\"><i class=\"fa fa-calendar\"></i> " + datetime + "</span>"); str.Append("</div></div></div>"); } phantrang pages = new phantrang(); if (rows.Count > pageSize) { str.Append("<span class=\"pull-right\">" + pages.pagelink((int)rows.Count / 5 + 1, currentPage, "?") + "</span>"); } } else { display = "displaynone"; return("<b class='text-danger'>Không có tin nào được đăng trong mục này.</b>"); } return(str.ToString()); }
public string SearchDoc(int pageSize = 10) { string code = Request["txtCode"] != null? Request["txtCode"]:""; string name = Request["txtName"] != ""?Request["txtName"] : ""; string sdate = Request["txtSDate"] != ""?Request["txtSDate"] : DateTime.MinValue.ToShortDateString(); string edate = Request["txtEDate"] != "" ? Request["txtEDate"] : DateTime.MaxValue.ToShortDateString(); string sql = ""; sql = "select * from tbl_Documents where Doc_Code like '%" + code + "%' and Doc_Name like N'%" + name + "%' and Doc_CreatedDate >'" + sdate + "' and Doc_CreatedDate <'" + edate + "'"; DataTable ds = UpdateData.UpdateBySql(sql).Tables[0]; DataRowCollection rows = ds.Rows; StringBuilder str = new StringBuilder(); if (rows.Count > 0) { int currentPage = Request["page"] != null?int.Parse(Request["page"]) : 1; int totalpage = (int)rows.Count / pageSize; int startrow = totalpage < 1 ? 0 : ((currentPage - 1) * pageSize); int endrow = totalpage < 1 ? rows.Count : startrow + pageSize; for (int i = startrow; i < endrow; i++) { str.Append("<tr>"); str.Append(" <td align=center>" + i + "</td>"); str.Append(" <td>" + rows[i]["Doc_Code"] + "</td>"); str.Append(" <td class=\"text-center\"><a id=\"link-docname\" href=?dt=" + rows[i]["Doc_ID"] + ">" + rows[i]["Doc_Name"] + "</a></td>"); str.Append(" <td class=\"doc-content\">" + rows[i]["Doc_Content"] + "</td>"); str.Append(" <td>" + DateTime.Parse(rows[i]["Doc_CreatedDate"].ToString()).ToString("dd/MM/yyyy") + "</td>"); str.Append("<td><a class=\"text-center\" href=\"" + rows[i]["Doc_File"] + "\"><i class=\"fa fa-download\"></i>Tải về</a></td>"); str.Append("</tr>"); } phantrang pages = new phantrang(); if (rows.Count > pageSize) { str.Append(pages.pagelink((int)rows.Count / 1, currentPage, "?")); } } return(str.ToString()); }