private int CountNum(HttpContext context) { string sqlWhere = " 1=1"; if (admin.AdminType != adminDal.HighestLevel()) { sqlWhere += string.Format(" and UnitCode like '{0}%'", admin.UnitCode); } if (null != context.Request.QueryString["OutProName"]) { sqlWhere += string.Format(" and OutProName like '{0}%'", context.Request.QueryString["OutProName"]); } return(dal.CountNum(sqlWhere)); }
//后台管理员新闻列表 private DataTable GetAllList(HttpContext context) { string sqlWhere = ""; if (admin.AdminType != adminDal.HighestLevel()) { sqlWhere = string.Format(" T_News.AdminUserId = {0}", admin.Id); } else { sqlWhere = " 1=1 "; } if (!string.IsNullOrEmpty(context.Request.QueryString["NewsTitle"])) { sqlWhere += string.Format(" and NewsTitle like '{0}%'", context.Request.QueryString["NewsTitle"]); } if (!string.IsNullOrEmpty(context.Request.QueryString["NewsType"])) { sqlWhere += string.Format(" and newstypeid='{0}'", context.Request.QueryString["NewsType"]); } if (string.IsNullOrEmpty(admin.UnitCode)) { sqlWhere += " and T_News.UnitCode like '" + admin.UnitCode + "%'"; } int startIndex = 0; try { startIndex = int.Parse(context.Request.Form["page"]) - 1; } catch { } int pageSize = 10; try { pageSize = int.Parse(context.Request.Form["rows"].ToString()); } catch { } string order = string.Format(" order by {0} {1}", context.Request.Form["sort"].ToString(), context.Request.Form["order"].ToString()); return(dal.GetAllList(sqlWhere, startIndex, pageSize, order)); }
private string Update(T_AdminUser model) { if (admin.AdminType == dal.HighestLevel()) { if (dal.Update(model)) { return("修改管理员登录账号成功!"); } else { return("修改管理员登录账号失败,错误代码:500"); } } else { return("您没有修改管理员登录账号权限!"); } }