private void loadNguoiDungT(string noidung, string danhmuc) { int row = 10; int hide = 0; if (Request.QueryString["p"] != null) { hide = Convert.ToInt32(Request.QueryString["p"]); } nguoidungBLL bs = new nguoidungBLL(); List <nguoidungDAL> ds = bs.getNguoiDungT(row, hide, noidung, danhmuc); rpNguoiDung.DataSource = ds; rpNguoiDung.DataBind(); for (int i = 0; i <= ds.Count - 1; i++) { Label lbSTT = rpNguoiDung.Items[i].FindControl("lbSTT") as Label; lbSTT.Text += (i + 1 + hide).ToString(); } string pa = "&tval=" + noidung + "&tkey=" + danhmuc; // phan trang: int current = Convert.ToInt32(Request.QueryString["p"]); phantrang pt = new phantrang(); lbPage.Text = pt.paging(bs.countT(noidung, danhmuc), row, pa, current); }
private void LoadNews(int pagecurrent, int pagesize, string field, string where, string order) { phantrang pt = new phantrang(); ContentControl ct = new ContentControl(); pagecurrent = pagecurrent < 1 ? 1 : pagecurrent; DataTable dt = ct.dt_Contentsearch(pagecurrent, pagesize, field, where, order); DataRowCollection rows = dt.Rows; StringBuilder str = new StringBuilder(); if (rows.Count > 0) { int tongso = Convert.ToInt16(dt.Rows[0]["tongso"].ToString()); int tem = (tongso >= pagesize) ? pagesize : tongso; tem = tongso >= pagesize * pagecurrent ? pagesize : tongso - pagesize * (pagecurrent - 1); //str.Append("<div class=\"box-main-left\">"); for (int i = 0; i < tem; i++) { int p = Convert.ToInt32(rows[i]["Mod_ID"]); string n = rows[i]["Content_Name"].ToString(); string img = rows[i]["Content_Img"].ToString(); string intro = rows[i]["Content_intro"].ToString(); string url = ResolveUrl("~/" + ModControl.GetModCode(p) + "/" + rows[i]["Content_Url"] + ".htm"); str.Append(CMSfunc.LoadNewsItem(url, img, n, intro)); } //str.Append("</div>"); ltrListNews.Text = str.ToString(); if ((((tongso - 1) / pagesize) + 1) > 1) { ltrPhantrang.Text = pt.pagelinkNews(((tongso - 1) / pagesize) + 1, pagecurrent, Request.RawUrl); } } }
private void loadSanPham(int hide) { int row = 10; sanphamBLL bs = new sanphamBLL(); List <sanphamDAL> ds = bs.getSanPhambyIdP(id, row, hide); rpsanpham.DataSource = ds; rpsanpham.DataBind(); khuyenmaiBLL km = new khuyenmaiBLL(); for (int i = 0; i <= ds.Count - 1; i++) { Label lbgia = rpsanpham.Items[i].FindControl("lbGia") as Label; if (ds[i].khuyenmai == true) { decimal khm = ds[i].gia - (ds[i].gia * km.getKhuyenMaibyId(1) / 100); lbgia.Text = "<span class='price'><span style='color:Red;'><del>" + String.Format("{0:0,0 vnđ}", ds[i].gia) + "</del> </span>" + String.Format("{0:0,0 vnđ}", khm) + "</span>"; } else { lbgia.Text = "<span class='price'>" + String.Format("{0:0,0 vnđ}", ds[i].gia) + "</span>"; } } // phan trang: int current = Convert.ToInt32(Request.QueryString["p"]); phantrang pt = new phantrang(); int cou = bs.countP(-1, "", Convert.ToInt32(Request.QueryString["id"])); lbPhanTrang.Text = pt.pagingpublic(cou, row, "&id=" + Request.QueryString["id"], current); }
private void loadNguoiDungV(string role) { int row = 10; int hide = 0; if (Request.QueryString["p"] != null) { hide = Convert.ToInt32(Request.QueryString["p"]); } nguoidungBLL bs = new nguoidungBLL(); List <nguoidungDAL> ds = bs.getNguoiDungV(row, hide, role); rpNguoiDung.DataSource = ds; rpNguoiDung.DataBind(); for (int i = 0; i <= ds.Count - 1; i++) { Label lbSTT = rpNguoiDung.Items[i].FindControl("lbSTT") as Label; lbSTT.Text += (i + 1 + hide).ToString(); } // phan trang: int current = Convert.ToInt32(Request.QueryString["p"]); phantrang pt = new phantrang(); lbPage.Text = pt.paging(bs.countV(ddlRole.Text), row, "", current); }
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()); }
private void loadsp(int danhmuc, string noidung, int view) { int row = 10; int hide = 0; if (Request.QueryString["p"] != null) { hide = Convert.ToInt32(Request.QueryString["p"]); } sanphamBLL bs = new sanphamBLL(); List <sanphamDAL> ds = bs.getSanPhamP(row, hide, danhmuc, noidung, view); rpSanpham.DataSource = ds; rpSanpham.DataBind(); for (int i = 0; i <= ds.Count - 1; i++) { Label lbSTT = rpSanpham.Items[i].FindControl("lbSTT") as Label; DropDownList ddKuyenMai = rpSanpham.Items[i].FindControl("ddKuyenMai") as DropDownList; lbSTT.Text += (i + 1 + hide).ToString(); if (ds[i].khuyenmai == true) { ddKuyenMai.SelectedValue = "1"; } else { ddKuyenMai.SelectedValue = "0"; } } string pa = ""; if (view != -1) { pa = "&v=" + view + "&val=" + Request.QueryString["val"].ToString(); } else if (danhmuc != -1 && noidung != "") { pa = "&t=" + danhmuc + "&n=" + noidung + "&val=" + Request.QueryString["val"].ToString(); } // phan trang: int current = Convert.ToInt32(Request.QueryString["p"]); phantrang pt = new phantrang(); lbPage.Text = pt.paging(bs.countP(danhmuc, noidung, view), row, pa, current); }
private void loadLienHe() { int row = 10; int hide = 0; if (Request.QueryString["p"] != null) { hide = Convert.ToInt32(Request.QueryString["p"]); } lienheBLL bs = new lienheBLL(); List <lienheDAL> list = bs.getLienHeP(row, hide); rpLienHe.DataSource = list; rpLienHe.DataBind(); List <userpublicDAL> us = (List <userpublicDAL>)Session["adminuser"]; int id_user = us[0].id_user; lienheviewBLL b = new lienheviewBLL(); List <lienheDAL> ds = b.lienhe_view(id_user); for (int i = 0; i <= list.Count - 1; i++) { Label lbSTT = rpLienHe.Items[i].FindControl("lbSTT") as Label; lbSTT.Text = (hide + i + 1).ToString(); Label lbView = rpLienHe.Items[i].FindControl("lbview") as Label; if (check(list[i].id_lienhe) == true) { // lbView.Visible = false; lbView.Text = "[Đã xem]"; } else { lbView.Visible = true; } } // phan trang: int current = Convert.ToInt32(Request.QueryString["p"]); phantrang pt = new phantrang(); lbPage.Text = pt.paging(bs.countP(), row, "", current); }
// load san pham ban chay: private void spbanchay(int id_khm) { lbtitle.Text = "Sản phẩm bán chạy"; lbDanhMuc.Text = "Sản phẩm bán chạy"; int row = 10; int hide = 0; if (Request.QueryString["p"] != null) { hide = Convert.ToInt32(Request.QueryString["p"]); } phantrang pt = new phantrang(); khuyenmaiBLL km = new khuyenmaiBLL(); sanphamBLL spbs = new sanphamBLL(); dathangdetailBLL bs = new dathangdetailBLL(); List <dathangdetail> ds = bs.getdathangDetailMuaNhieuP(row, hide); rpbanchay.DataSource = ds; rpbanchay.DataBind(); for (int i = 0; i <= ds.Count() - 1; i++) { Label lbA = rpbanchay.Items[i].FindControl("lbA") as Label; Label lbHinh = rpbanchay.Items[i].FindControl("lbHinh") as Label; Label lbTen = rpbanchay.Items[i].FindControl("lbTen") as Label; Label lbGia = rpbanchay.Items[i].FindControl("lbGia") as Label; List <sanphamDAL> sptt = spbs.getSPbyId(ds[i].id_sanpham); lbA.Text = "<a href='chitietsanpham.aspx?id=" + sptt[0].id_sanpham + "&gr=" + sptt[0].id_danhmuc + "' title='" + sptt[0].ten_sanpham + "'>"; lbHinh.Text = "<img class='hinhsp' height='350' width='275' alt='" + sptt[0].ten_sanpham + "' src='/uploads/" + sptt[0].hinhanh + "' style='display: block;' />"; lbTen.Text = "<span class='productName'>" + sptt[0].ten_sanpham + "</span>"; if (sptt[0].khuyenmai == true) { decimal khm = sptt[0].gia - (sptt[0].gia * km.getKhuyenMaibyId(id_khm) / 100); lbGia.Text = "<span class='price'><span style='color:Red;'><del>" + String.Format("{0:0,0 vnđ}", sptt[0].gia) + "</del> </span>" + String.Format("{0:0,0 vnđ}", khm) + "</span>"; } else { lbGia.Text = "<span class='price'>" + String.Format("{0:0,0 vnđ}", sptt[0].gia) + "</span>"; } } int r = bs.countMuaNhieuP(); lbPhanTrang.Text = pt.pagingpublic(r, row, "&v=bc", hide); }
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()); }
// load san pham khuyen mai: private void loadspKM() { lbtitle.Text = "Sản phẩm khuyến mãi"; lbDanhMuc.Text = "Sản phẩm khuyến mãi"; int hide = 0; int row = 10; if (Request.QueryString["p"] != null) { hide = Convert.ToInt32(Request.QueryString["p"]); } phantrang pt = new phantrang(); khuyenmaiBLL km = new khuyenmaiBLL(); sanphamBLL bs = new sanphamBLL(); List <sanphamDAL> ds = bs.getSanPhamKMP(hide, row); rpsanpham.DataSource = ds; rpsanpham.DataBind(); for (int i = 0; i <= ds.Count - 1; i++) { Label lbGia = rpsanpham.Items[i].FindControl("lbGia") as Label; if (ds[i].khuyenmai == true) { decimal khm = ds[i].gia - (ds[i].gia * km.getKhuyenMaibyId(1) / 100); lbGia.Text = "<span class='price'><span style='color:Red;'><del>" + String.Format("{0:0,0 vnđ}", ds[i].gia) + "</del> </span>" + String.Format("{0:0,0 vnđ}", khm) + "</span>"; } else { lbGia.Text = "<span class='price'>" + String.Format("{0:0,0 vnđ}", ds[i].gia) + "</span>"; } } int r = bs.countKMP(); lbPhanTrang.Text = pt.pagingpublic(r, row, "&v=km", hide); }
// load dat hang private void loadDatHang(string v) { int row = 10; int hide = 0; if (Request.QueryString["p"] != null) { hide = Convert.ToInt32(Request.QueryString["p"]); } dathangBLL bs = new dathangBLL(); phuongthucthanhtoanBLL pt_bs = new phuongthucthanhtoanBLL(); dathangdetailBLL dhdt_bs = new dathangdetailBLL(); nguoidungBLL nd_bs = new nguoidungBLL(); khuyenmaiBLL km = new khuyenmaiBLL(); List <dathangDAL> ds = bs.getDathangP(row, hide, v); rpDatHang.DataSource = ds; rpDatHang.DataBind(); for (int i = 0; i <= ds.Count - 1; i++) { List <nguoidungDAL> nd_ds = nd_bs.getNguoiDungbyId(ds[i].id_user); List <phuongthucthanhtoanDAL> pt_ds = pt_bs.getPhuongThucById(ds[i].id_pt); List <dathangdetail> dhdt_ds = dhdt_bs.getdathangDetail(ds[i].id_dathang); Label lbNguoiDung = rpDatHang.Items[i].FindControl("lbNguoiDung") as Label; lbNguoiDung.Text = nd_ds[0].hoten; Label lbThanhToan = rpDatHang.Items[i].FindControl("lbThanhToan") as Label; lbThanhToan.Text = pt_ds[0].ten_phuongthuc; Label lbTongTien = rpDatHang.Items[i].FindControl("lbTongTien") as Label; decimal tongTien = 0; for (int j = 0; j <= dhdt_ds.Count - 1; j++) { if (dhdt_ds[j].khuyenmai == true) { tongTien += (dhdt_ds[j].gia - (dhdt_ds[j].gia * km.getKhuyenMaibyId(1) / 100)) * dhdt_ds[j].soluong; } else { tongTien += (dhdt_ds[j].gia * dhdt_ds[j].soluong); } } lbTongTien.Text = String.Format("{0:0,0 VNĐ}", tongTien); Label lbHinh = rpDatHang.Items[i].FindControl("lbHinh") as Label; if (ds[i].trangthai == true) { lbHinh.Text = "<img src=\"../images/admin/dathutien.jpg\" alt=\"Đã thu tiền\">"; } Label lbSTT = rpDatHang.Items[i].FindControl("lbSTT") as Label; lbSTT.Text += (i + 1 + hide).ToString(); } string view = ""; if (v != "") { view = "&v=" + Request.QueryString["v"]; } // phan trang: int current = Convert.ToInt32(Request.QueryString["p"]); phantrang pt = new phantrang(); lbPage.Text = pt.paging(bs.countP(v), row, view, current); }