/// <summary> /// 获得分页数据 /// </summary> /// <param Name="pager">分页实体类:KingTop.Model.Pager</param> /// <returns></returns> public void PageData(KingTop.Model.Pager pager, string strModelId, string strFlowId, string strStateValue) { ModelManage sqlModelManage = new ModelManage(); DataTable dtModelManage = sqlModelManage.GetList("ONE", Utils.getOneParams(strModelId)); string strTableName = dtModelManage.Rows[0]["tableName"].ToString(); SqlParameter[] prams = new SqlParameter[] { new SqlParameter("@Id", "ID"), new SqlParameter("@Table", strTableName), new SqlParameter("@Where", GetWhere(pager.DicWhere, strFlowId, strStateValue)), new SqlParameter("@Cou", "*,(SELECT Name FROM K_ReviewFlowState WHERE K_ReviewFlowState.StateValue=FlowState) AS StateName"), new SqlParameter("@NewPageIndex", pager.PageIndex), new SqlParameter("@PageSize", pager.PageSize), new SqlParameter("@order", "ID DESC"), new SqlParameter("@isSql", 0), new SqlParameter("@strSql", "") }; DataSet ds = SQLHelper.ExecuteDataSet(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "proc_Pager", prams); pager.RecordCount = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString()); pager.PageData(ds.Tables[1]); }
// 分页控件数据绑定 private void SplitDataBind() { Dictionary <string, string> dicWhere = new Dictionary <string, string>(); KingTop.Model.Pager p = new KingTop.Model.Pager(); KingTop.BLL.SysManage.UserGropManage objUserGrop = new KingTop.BLL.SysManage.UserGropManage(); if (StrKeySearch != "") { dicWhere.Add("UserGroupName", Utils.UrlDecode(StrKeySearch)); txtSearch.Text = StrKeySearch; } //如果不是超级管理员,则只显示自己用户组以下的用户 string userId = LoginInfoHelper.GetLoginAccountId(Session, Response); if (userId != "0") { DataTable dt = bllUserGrop.GetList("LOGINUSERGROP", Utils.getTwoParams(SiteID.ToString(), userId)).Tables[0]; if (dt.Rows.Count > 0) { dicWhere.Add("NumCode", dt.Rows[0]["NumCode"].ToString()); } } dicWhere.Add("SiteID", SiteID.ToString()); p.Aspnetpage = Split; p.RptControls = rptUserGropeList; p.DicWhere = dicWhere; //把表保存到临时内存中 dsUserGroupRole = bllUserGrop.GetList("GROUPANDROLENAME", Utils.getOneParams(SiteID.ToString())); //dsUserGroupName = BllgroupRole.GetUserGroupRole(p); objUserGrop.PageData(p, 1); }
// 分页控件数据绑定 private void SplitDataBind() { Dictionary <string, string> dicWhere = new Dictionary <string, string>(); KingTop.Model.Pager p = new KingTop.Model.Pager(); if (StrKeySearch != "") { dicWhere.Add("UserName", Utils.UrlDecode(StrKeySearch)); txtSearch.Text = StrKeySearch; } //如果不是超级管理员,则只显示自己用户组以下的用户 string userId = LoginInfoHelper.GetLoginAccountId(Session, Response); if (userId != "0") { UserGroup bllUserGrop = new UserGroup(); DataTable dt = bllUserGrop.GetList("LOGINUSERGROP", Utils.getTwoParams(SiteID.ToString(), userId)).Tables[0]; if (dt.Rows.Count > 0) { dicWhere.Add("NumCode", dt.Rows[0]["NumCode"].ToString()); ourNumCode = dt.Rows[0]["NumCode"].ToString(); //strUserGrop = dt.Rows[0]["UserGroupCode"].ToString(); } dicWhere.Add("UserID", userId); } dicWhere.Add("SiteID", this.SiteID.ToString()); p.DicWhere = dicWhere; p.Aspnetpage = Split; p.RptControls = RptUser; BllAccount.PageData(p, 2); }
public string SplitSQLPacking(KingTop.Model.Pager pager, string tableName, string sqlField, string sqlWhere, string sqlOrder, string sqlFieldForignData) { StringBuilder splitSQL; // 分页SQL语句 string outOrder; Regex reg; MatchCollection matchCollection; // 匹配表名 reg = new Regex(@"\s+(?<1>[0-9a-zA-Z_]+)\.[0-9a-zA-Z_]+\s+"); splitSQL = new StringBuilder(); matchCollection = reg.Matches(sqlOrder); outOrder = sqlOrder; // 格式化外表引用字段 sqlField = FormatField(sqlField, sqlFieldForignData); // 由排序创建表联合后的外排序 foreach (Match match in matchCollection) { outOrder = sqlOrder.Replace(match.Groups[1].Value, "A"); } // 记录总数 splitSQL.Append("select count(1) from "); splitSQL.Append(tableName); if (!string.IsNullOrEmpty(sqlWhere.Trim())) { splitSQL.Append(" where "); splitSQL.Append(sqlWhere); } splitSQL.Append(";"); // 分页SQL splitSQL.Append("select * from ("); splitSQL.Append("select row_number() over(order by "); splitSQL.Append(sqlOrder); splitSQL.Append(") as RowNum,"); splitSQL.Append(sqlField); splitSQL.Append(" from "); splitSQL.Append(tableName); if (!string.IsNullOrEmpty(sqlWhere.Trim())) { splitSQL.Append(" where "); splitSQL.Append(sqlWhere); } splitSQL.Append(")A where "); splitSQL.Append(" A.RowNum between "); splitSQL.Append(pager.PageSize * (pager.PageIndex - 1) + 1); splitSQL.Append(" and "); splitSQL.Append(pager.PageSize * pager.PageIndex); splitSQL.Append(" order by "); splitSQL.Append(outOrder); return(splitSQL.ToString()); }
public void PageData(KingTop.Model.Pager pager, Hashtable hsWhereEqual, Hashtable hsWhereLike, string sort) { StringBuilder selSQL; // 查询SQL string selTotalSQL; // 查询所有记录条数SQL List <SqlParameter> selParam; // 查询参数 DataSet ds; selSQL = new StringBuilder(); selParam = new List <SqlParameter>(); selSQL.Append("ModelFieldType=@ModelFieldType"); // 一般模型字段 selParam.Add(new SqlParameter("@ModelFieldType", 1)); foreach (string key in hsWhereEqual.Keys) // 添加查询条件 { if (hsWhereEqual[key] != null && !string.IsNullOrEmpty(hsWhereEqual[key].ToString().Trim())) { selSQL.Append(" and " + key + "=@" + key); } selParam.Add(new SqlParameter("@" + key, hsWhereEqual[key])); } foreach (string key in hsWhereLike.Keys) // 添加搜索条件 { selSQL.Append(" and " + key + " like '%" + hsWhereLike[key] + "%' "); } selTotalSQL = "select count(*) from K_ModelField where " + selSQL.ToString() + ";"; if (!string.IsNullOrEmpty(sort)) // 加入自定义排序 { selSQL.Insert(0, "select T.* from (select ROW_NUMBER() over(order by " + sort + ") as IndexNum,ID,Name,ModelFieldGroupId,IsRequired,FieldAlias,BasicField,IsSystemFiierd,IsDel,IsEnable,Orders,IsListEnable,IsSearch,IsInputValue from K_ModelField where "); } else // 默认排序 { selSQL.Insert(0, "select T.* from (select ROW_NUMBER() over(order by orders asc) as IndexNum,ID,Name,ModelFieldGroupId,IsRequired,FieldAlias,BasicField,IsSystemFiierd,IsDel,IsEnable,Orders,IsListEnable,IsSearch,IsInputValue from K_ModelField where "); } if (!string.IsNullOrEmpty(sort)) // 加入自定义排序 { selSQL.Append(")T where T.IndexNum Between " + (pager.PageIndex - 1) * pager.PageSize + " and " + pager.PageSize * pager.PageIndex + " order by T." + sort.Trim() + ";"); } else // 默认排序 { selSQL.Append(")T where T.IndexNum Between " + (pager.PageIndex - 1) * pager.PageSize + " and " + pager.PageSize * pager.PageIndex + " order by T.orders asc;"); } selSQL.Insert(0, selTotalSQL); ds = SQLHelper.ExecuteDataSet(SQLHelper.ConnectionStringLocalTransaction, CommandType.Text, selSQL.ToString(), selParam.ToArray()); pager.RecordCount = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString()); pager.PageData(ds.Tables[1]); }
// 分页控件数据绑定 private void SplitDataBind(Dictionary <string, string> dicWhere) { KingTop.Model.Pager p = new KingTop.Model.Pager(); KingTop.BLL.Content.ModelManage objsource = new KingTop.BLL.Content.ModelManage(); p.Aspnetpage = Split; p.RptControls = rptModelManage; p.DicWhere = dicWhere; objsource.PageData(p); }
public DataSet GetUserGroupRole(KingTop.Model.Pager pager, int SiteID) { SqlParameter[] prams = new SqlParameter[] { new SqlParameter("@NewPageIndex", pager.PageIndex), new SqlParameter("@PageSize", pager.PageSize), new SqlParameter("@SiteID", SiteID) }; return(SQLHelper.ExecuteDataSet(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "PROC_GetUserGroupName", prams)); }
public void PageData(KingTop.Model.Pager pager, string tbName) { AddSpecialSqlWhere(); // 添加特殊条件 if (!string.IsNullOrEmpty(this._deliverAndSearchUrlParam)) // 添加传递的URL参数条件 { dal.GetKeepUrlParam(ref this._sqlWhere, this.tableName, this._deliverAndSearchUrlParam, filterUrlParam, HttpContext.Current.Request.QueryString); } dal.PageData(pager, tbName, this._sqlField, this._sqlWhere, this._sqlOrder, this._sqlFieldForignData); }
/// <summary> /// 获得分页数据 /// </summary> public void PageData(KingTop.Model.Pager pager, string tableName, string sqlField, string sqlWhere, string sqlOrder, string sqlFieldForignData) { string sql; sql = SplitSQLPacking(pager, tableName, sqlField, sqlWhere, sqlOrder, sqlFieldForignData); sql = Regex.Replace(sql, @"(?<3>(?<1>[0-9a-zA-Z_]+)\.(?<2>[0-9a-zA-Z_]+))", "${1}.[${2}]"); // 格式化SQL中的字段名成[字段名]格式 DataSet ds = SQLHelper.ExecuteDataSet(SQLHelper.ConnectionStringLocalTransaction, CommandType.Text, sql); pager.RecordCount = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString()); pager.PageData(ds.Tables[1]); }
/// <summary> /// 获得分页数据 /// </summary> /// <param Name="pager">分页实体类:KingTop.Model.Pager</param> /// <returns></returns> public void PageData(KingTop.Model.Pager pager) { SqlParameter[] prams = new SqlParameter[] { new SqlParameter("@NewPageIndex", pager.PageIndex), new SqlParameter("@PageSize", pager.PageSize) }; DataSet ds = SQLHelper.ExecuteDataSet(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "proc_GetDataTableInfo", prams); pager.RecordCount = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString()); pager.PageData(ds.Tables[1]); }
private void PageData() { Dictionary <string, string> dcWhere = new Dictionary <string, string>(); dcWhere.Add("RecyclingManageID", strPid); KingTop.Model.Pager p = new KingTop.Model.Pager(); p.Aspnetpage = AspNetPager1; p.SearField = "*,(select tablename from K_RecyclingManage where ID=AssociatedID) as tableName"; p.RptControls = rptModelFileGroup; p.DicWhere = dcWhere; bllRecyclingAssociated.PageData(p); }
// 分页控件数据绑定 private void SplitDataBind() { KingTop.Model.Pager p; // 分页控件 Hashtable hsWhereEqual; hsWhereEqual = new Hashtable(); p = new KingTop.Model.Pager(); hsWhereEqual.Add("IsDel", IsDel); p.Aspnetpage = Split; p.RptControls = rptModelField; commonField.PageData(p, hsWhereEqual, GetSearch(), Sort); }
// 分页控件数据绑定 private void SplitDataBind() { Dictionary <string, string> dicWhere = new Dictionary <string, string>(); KingTop.Model.Pager p = new KingTop.Model.Pager(); if (StrKeySearch != "") { dicWhere.Add(Utils.UrlDecode(Request.QueryString["searchType"]), Utils.UrlDecode(StrKeySearch)); txtSearch.Text = StrKeySearch; } p.Aspnetpage = Split; p.RptControls = rptActionList; p.DicWhere = dicWhere; objActionPermit.PageData(p, 1, SiteID); }
private void PageData() { Dictionary <string, string> dcWhere = new Dictionary <string, string>(); if (StrKeySearch != "") { dcWhere.Add("tableName", Utils.UrlDecode(StrKeySearch)); txtGroupName.Text = StrKeySearch; } KingTop.Model.Pager p = new KingTop.Model.Pager(); p.Aspnetpage = AspNetPager1; p.RptControls = rptModelFileGroup; p.DicWhere = dcWhere; bllRecyclingManage.PageData(p); }
// 分页控件数据绑定 private void SplitDataBind() { Dictionary <string, string> dicWhere = new Dictionary <string, string>(); KingTop.Model.Pager p = new KingTop.Model.Pager(); if (StrKeySearch != "") { dicWhere.Add("TemplateName", Utils.UrlDecode(StrKeySearch)); txtSearch.Text = StrKeySearch; } p.Aspnetpage = Split; p.RptControls = rptTemplateList; p.DicWhere = dicWhere; bllTemplate.PageData(p); }
/// <summary> /// 获得分页数据 /// </summary> /// <param name="pager">分页实体类:KingTop.Model.Pager</param> /// <returns></returns> public void PageData(KingTop.Model.Pager pager) { SqlParameter[] prams = new SqlParameter[]{ new SqlParameter("@Id","ID"), new SqlParameter("@Table","K_TemplateProject"), new SqlParameter("@Where",GetWhere(pager.DicWhere)), new SqlParameter("@Cou","*"), new SqlParameter("@NewPageIndex",pager.PageIndex), new SqlParameter("@PageSize",pager.PageSize), new SqlParameter("@order","ID DESC"), new SqlParameter("@isSql",0), new SqlParameter("@strSql","") }; DataSet ds = SQLHelper.ExecuteDataSet(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "proc_Pager", prams); pager.RecordCount = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString()); pager.PageData(ds.Tables[1]); }
private void PageData() { Dictionary <string, string> dcWhere = new Dictionary <string, string>(); if (StrKeySearch != "") { dcWhere.Add("title", Utils.UrlDecode(StrKeySearch)); txtGroupName.Text = StrKeySearch; } if (strPid != "" && strPid != "0") { dcWhere.Add("tableName2", strPid); ddlTable.SelectedValue = strPid; } KingTop.Model.Pager p = new KingTop.Model.Pager(); p.Aspnetpage = AspNetPager1; p.RptControls = rptModelFileGroup; p.DicWhere = dcWhere; bllRecyclingManage.PageNewsData(p); }
/// <summary> /// 使用SQL语句获得分页数据 /// </summary> /// <param Name="pager">分页实体类:KingTop.Model.Pager</param> /// <returns></returns> public void PageData(KingTop.Model.Pager pager, int StrNumber) { SqlParameter[] prams = new SqlParameter[] { new SqlParameter("@Id", ""), new SqlParameter("@Table", ""), new SqlParameter("@Where", ""), new SqlParameter("@Cou", ""), new SqlParameter("@NewPageIndex", pager.PageIndex), new SqlParameter("@PageSize", pager.PageSize), new SqlParameter("@order", "UserID asc"), new SqlParameter("@isSql", 1), new SqlParameter("@strSql", GetStrSqlByNumber(StrNumber)) }; DataSet ds = SQLHelper.ExecuteDataSet(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "proc_Pager", prams); pager.RecordCount = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString()); pager.PageData(ds.Tables[1]); }
private void PageData() { Dictionary <string, string> dcWhere = new Dictionary <string, string>(); if (StrKeySearch != "") { dcWhere.Add("Name", StrKeySearch); txtGroupName.Text = strKeySearch; } if (StrModelId != "" && StrModelId != "-1") { dcWhere.Add("ModelId", StrModelId); ddlModelList.SelectedValue = StrModelId; } KingTop.Model.Pager p = new KingTop.Model.Pager(); p.Aspnetpage = AspNetPager1; p.RptControls = rptModelFileGroup; p.DicWhere = dcWhere; bllModelFieldGroup.PageData(p); }
/// <summary> /// 使用SQL语句获得分页数据 /// </summary> /// <param Name="pager">分页实体类:KingTop.Model.Pager</param> /// <returns></returns> public void PageData(KingTop.Model.Pager pager, int StrNumber) { SqlParameter[] prams = new SqlParameter[] { new SqlParameter("@Id", ""), new SqlParameter("@Table", ""), new SqlParameter("@Where", ""), new SqlParameter("@Cou", ""), //new SqlParameter("@NewPageIndex",pager.PageIndex), new SqlParameter("@NewPageIndex", Utils.ParseInt(System.Web.HttpContext.Current.Request.QueryString["page"], 1)), new SqlParameter("@PageSize", pager.PageSize), new SqlParameter("@order", "Orders DESC,UserID DESC"), new SqlParameter("@isSql", 1), new SqlParameter("@strSql", GetStrSqlByNumber(StrNumber, pager.DicWhere)) }; DataSet ds = SQLHelper.ExecuteDataSet(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "proc_Pager", prams); pager.RecordCount = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString()); pager.PageData(ds.Tables[1]); }
/// <summary> /// 获得分页数据 /// </summary> /// <param Name="pager">分页实体类:KingTop.Model.Pager</param> /// <returns></returns> public void PageData(KingTop.Model.Pager pager) { SqlParameter[] prams = new SqlParameter[] { new SqlParameter("@Id", "ID"), new SqlParameter("@Table", "K_ModelFieldGroup"), new SqlParameter("@Where", GetWhere(pager.DicWhere)), new SqlParameter("@Cou", "*,(SELECT Title FROM K_ModelManage WHERE ID = ModelId) AS ModelName"), new SqlParameter("@NewPageIndex", pager.PageIndex), new SqlParameter("@PageSize", pager.PageSize), new SqlParameter("@order", "Orders asc"), new SqlParameter("@isSql", 0), new SqlParameter("@strSql", "") }; DataSet ds = SQLHelper.ExecuteDataSet(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "proc_Pager", prams); pager.RecordCount = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString()); pager.PageData(ds.Tables[1]); }
/// <summary> /// 获得分页数据 /// </summary> /// <param name="pager">分页实体类:KingTop.Model.Pager</param> /// <returns></returns> public void PageData(KingTop.Model.Pager pager) { dal.PageData(pager); }
// 分页控件数据绑定 private void SplitDataBind() { KingTop.Model.Pager split; string[] splitParam; string tempVar; // 临时变量 // 初始加载时的SQL各参数 splitParam = ctrManageList.GetSQLParam(hdnCustomCol.Value, hdnShowCol.Value); ctrManageList.SqlWhere = splitParam[1]; // 初始时的where tempVar = ctrManageList.Search(); // 搜索栏条件 //查询条件保存到cookies中 if (!string.IsNullOrEmpty(tempVar)) { SetModelCookies("search", Server.UrlEncode(tempVar)); } else if (!string.IsNullOrEmpty(SearchWhere)) { tempVar = SearchWhere; } if (!string.IsNullOrEmpty(ctrManageList.SqlWhere.Trim()) && !string.IsNullOrEmpty(tempVar)) { ctrManageList.SqlWhere = ctrManageList.SqlWhere + " and " + tempVar; } else { ctrManageList.SqlWhere += tempVar; } tempVar = ctrManageList.LinkSearch(); // 链接按钮中的搜索条件 //查询条件保存到cookies中 if (!string.IsNullOrEmpty(tempVar)) { SetModelCookies("searchlink", Server.UrlEncode(tempVar)); } else if (!string.IsNullOrEmpty(SearchlinkWhere)) { tempVar = SearchlinkWhere; } if (!string.IsNullOrEmpty(ctrManageList.SqlWhere.Trim()) && !string.IsNullOrEmpty(tempVar)) { ctrManageList.SqlWhere = ctrManageList.SqlWhere + " and " + tempVar; } else { ctrManageList.SqlWhere += tempVar; } ctrManageList.SqlOrder = splitParam[3]; // 初始时的order by tempVar = BLL.Content.ControlManageList.GetClientSort(); // 列表标题排序 if (tempVar.Contains(".Orders")) // 排序字段排序列 { if (!string.IsNullOrEmpty(ctrManageList.SqlOrder.Trim()) && !string.IsNullOrEmpty(tempVar.Trim()) && tempVar.Contains(".Orders asc")) { ctrManageList.SqlOrder = ctrManageList.SqlOrder.Replace(".Orders desc", ".Orders asc"); } if (!string.IsNullOrEmpty(ctrManageList.SqlOrder.Trim()) && !string.IsNullOrEmpty(tempVar.Trim()) && tempVar.Contains(".Orders desc")) { ctrManageList.SqlOrder = ctrManageList.SqlOrder.Replace(".Orders asc", ".Orders desc"); } } else // 其它字段排序 { if (!string.IsNullOrEmpty(ctrManageList.SqlOrder.Trim()) && !string.IsNullOrEmpty(tempVar.Trim())) { ctrManageList.SqlOrder = tempVar + "," + ctrManageList.SqlOrder; } else { ctrManageList.SqlOrder = tempVar + ctrManageList.SqlOrder; } } // 初始加载时选取的字段 int page = 1; if (pageindex > 0) { page = pageindex; } else if (!string.IsNullOrEmpty(Request.QueryString["page"])) { page = Utils.ParseInt(Request.QueryString["page"], 1); } else if (!string.IsNullOrEmpty(ModelPageNum)) { page = Utils.ParseInt(ModelPageNum, 1); } ctrManageList.SqlField = splitParam[2]; // 基本字段中引用外表数据的字段参数 ctrManageList.SqlFieldForignData = hdnForignTableCol.Value; split = new KingTop.Model.Pager(); split.PageIndex = page; split.Aspnetpage = Split; split.RptControls = rptListInfo; ctrManageList.PageData(split, splitParam[0]); }
public DataSet GetUserGroupRole(KingTop.Model.Pager pager, int SiteID) { return(dal.GetUserGroupRole(pager, SiteID)); }
public void PageData(KingTop.Model.Pager pager, string strModelId, string strFlowId, string strStateValue) { dal.PageData(pager, strModelId, strFlowId, strStateValue); }
/// <summary> /// 用SQL语句获得分页数据 /// </summary> /// <param name="pager">分页实体类:KingTop.Model.Pager</param> /// <returns></returns> public void PageData(KingTop.Model.Pager pager, int StrNumber, int SiteID) { dal.PageData(pager, StrNumber, SiteID); }
public void PageData(KingTop.Model.Pager pager, int strNumber) { dal.PageData(pager, strNumber); }