private void listView1_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListView listview = sender as ListView; PageBean bean = listview.SelectedItem as PageBean; if (bean != null) { myFrame.Navigate(bean.type); } }
public ActionResult GetPage(int page, int rows) { PageBean<BookInfo> list = new PageBean<BookInfo>(); try { long total = 0; string userName = Request.Params["BookName"]; IQueryable<BookInfo> iquery=null; if (!string.IsNullOrEmpty(userName)) { iquery = iGenericRepository.GetPageList(out total, page, rows, r => r.name.Equals(userName)&&!r.state.Equals("10")); } if (iquery == null) list.rows = iGenericRepository.GetPageList(out total, page, rows,r=>!r.state.Equals("10")).ToList(); else { list.rows = iquery.ToList(); } list.total = total; var Bean = new { total = total, rows = (from li in list.rows select new { ID=li.book_id, name = li.name, price = li.price, ISBN = li.ISBN, CBS = li.CBS, author = li.author, Holder = li.Holder , state = UtilCodeInfo.bookState.FirstOrDefault(r => r.Code.Equals(li.state)) == null ? "未知" : UtilCodeInfo.bookState.FirstOrDefault(r => r.Code.Equals(li.state)).Name }).ToList() }; return Json(Bean, JsonRequestBehavior.AllowGet); } catch (Exception) { list = new PageBean<BookInfo>(); } return Json(list, JsonRequestBehavior.AllowGet); }
public ActionResult GetPage(int page,int rows) { PageBean<p_tj_GetChB_Result> pageBean=new PageBean<p_tj_GetChB_Result>(); try { long total = 0; DateTime dt = UtilData.StringToDateTime(Request.Params["DateTime"]); string scname = Request.Params["ScName"]; if (dt.Equals(new DateTime(1900, 1, 1))) { dt = DateTime.Now; } pageBean.rows = isStatisticsManager.GetList(out total, page, rows, dt, scname); pageBean.total = total; } catch (Exception) { pageBean=new PageBean<p_tj_GetChB_Result>(); } return Json(pageBean, JsonRequestBehavior.AllowGet); }
public ActionResult GetPage(int page, int rows) { PageBean<UserInfo> list = new PageBean<UserInfo>(); try { long total = 0; string sqlWhere = ""; string userName = Request.Params["UserName"]; if (userName != null) { sqlWhere = " and UserName='******'"; } list.rows = iUserManager.GetPageList(out total,page, rows).ToList(); list.total = total; } catch (Exception) { list = new PageBean<UserInfo>(); } return Json(list, JsonRequestBehavior.AllowGet); }
public ActionResult GetPage(int page, int rows) { PageBean<Role> pageBean=new PageBean<Role>(); try { string name = Request.Params["RoleName"]; long total = 0; if (!string.IsNullOrEmpty(name)) { pageBean.rows = iRoleManager.GetPageList(out total, page, rows, ""); } else { pageBean.rows = iRoleManager.GetPageList(out total, page, rows); } } catch (Exception) { throw; } return Json(pageBean, JsonRequestBehavior.AllowGet); }
public PageBean<BM_COMMON> GetPageList(int pageIndex, int pageSize, string sqlWhere, string order) { PageBean<BM_COMMON> pageBean = new PageBean<BM_COMMON>(); IList<BM_COMMON> list = new List<BM_COMMON>(); DBHelper db = new DBHelper(); string strSql = "select * from (select * ,ROW_NUMBER() over(order by " + order + ") num from Message where " + sqlWhere + ") Tabl where num BETWEEN " + (pageIndex - 1) * pageSize + " and " + (pageSize) * (pageIndex); DbCommand cmd = db.GetSqlStringCommand(strSql); DataTable dt = db.ExecuteDataTable(cmd); foreach (DataRow row in dt.Rows) { BM_COMMON ht = this.DataRowToBean(row); list.Add(ht); } pageBean.rows = list; pageBean.total = this.SelectCOMMONBeanPageCount(sqlWhere); return pageBean; }
public PageBean<Role> GetPageList(int pageIndex, int pageSize, string sqlWhere, string order, bool sotr) { PageBean<Role> pageBean = new PageBean<Role>(); IList<Role> list = new List<Role>(); DBHelper db = new DBHelper(); string strSql = string.Empty; if (sotr) { strSql = "select * from (select * ,ROW_NUMBER() over(order by " + order + " desc ) num from Role where " + sqlWhere + ") Tabl where num BETWEEN " + (pageIndex - 1) * pageSize + " and " + (pageSize) * (pageIndex); } else { strSql = "select * from (select * ,ROW_NUMBER() over(order by " + order + " asc ) num from Role where " + sqlWhere + ") Tabl where num BETWEEN " + (pageIndex - 1) * pageSize + " and " + (pageSize) * (pageIndex); } DbCommand cmd = db.GetSqlStringCommand(strSql); DataTable dt = db.ExecuteDataTable(cmd); foreach (DataRow row in dt.Rows) { Role ht = this.DataRowToBean(row); list.Add(ht); } pageBean.rows = list; pageBean.total = this.SelectRolePageCount(sqlWhere); return pageBean; }
public PageBean<UserInfo> GetPageList(int pageIndex, int pageSize, string sqlWhere) { PageBean<UserInfo> pageBean = new PageBean<UserInfo>(); IList<UserInfo> list = new List<UserInfo>(); DBHelper db = new DBHelper(); string strSql = "select * from (select * ,ROW_NUMBER() over(order by UserName) num from [UserInfo] where 1=1 " + sqlWhere + ") Tabl where num BETWEEN " + (pageIndex - 1)*pageSize + " and " + (pageSize)*(pageIndex); DbCommand cmd = db.GetSqlStringCommand(strSql); DataTable dt = db.ExecuteDataTable(cmd); foreach (DataRow row in dt.Rows) { UserInfo ht = this.DataRowToBean(row); list.Add(ht); } pageBean.rows = list; pageBean.total = this.SelectUserPageCount(sqlWhere); return pageBean; }
public ActionResult GetBookManageList(int page,int rows) { PageBean<BookManage> list = new PageBean<BookManage>(); try { long total = 0; string userName = Request.Params["BookName"]; IQueryable<BookManage> iquery = null; if (iquery == null) list.rows = iBookManager.GetPageList(out total, page, rows).ToList(); else { list.rows = iquery.ToList(); } var lists = new { total = total, rows = (from temp in list.rows select new { ID = temp.ID , BookName = UtilData.GetBmName(UtilCodeInfo.bookList,temp.book_id.ToString()) , UserName = temp.Username , BorrowTime = temp.BorrowTimeString , ReturnTime = temp.ReturnTimeString , OptionUser = temp.OptionUser , Bz = temp.Bz }).ToList() }; return Json(lists, JsonRequestBehavior.AllowGet); } catch (Exception) { list = new PageBean<BookManage>(); return Json(list, JsonRequestBehavior.AllowGet); } }