Example #1
0
        /// <summary>
        /// 返回查询条件下所有总记录数
        /// </summary>
        /// <param name="strSearch"></param>
        /// <param name="classid"></param>
        /// <param name="smallclassid"></param>
        /// <returns></returns>
        private int TotalPageNo(string strWhere)
        {
            DBServer db = new DBServer();

            SqlParameter[] SqlParame =
            {
                db.MakeParam("@tblName",  SqlDbType.VarChar, 100, ParameterDirection.Input, "[elink_group]"),
                db.MakeParam("@strWhere", SqlDbType.VarChar, 500, ParameterDirection.Input, strWhere),
                db.MakeParam("@fldName",  SqlDbType.VarChar, 100, ParameterDirection.Input, "group_id"),
                db.MakeParam("@getRec",   SqlDbType.Int,       4, ParameterDirection.Input, 1)
            };
            int intValue = db.ExecuteScalar(CommandType.StoredProcedure, "Usp_Paged", SqlParame);

            return(intValue);
        }
Example #2
0
 /// <summary>
 /// 存储过程读取
 /// </summary>
 public IList <GroupInfo> GetList(int PageNo, int PageSize, string strWhere, out int TotalPageNo)
 {
     using (DBServer db = new DBServer())
     {
         TotalPageNo = 0;
         strWhere    = string.IsNullOrEmpty(strWhere) ? string.Empty : strWhere;
         SqlParameter[] SqlParam =
         {
             db.MakeParam("@tblName",     SqlDbType.VarChar,  100, ParameterDirection.Input, "[elink_group]"),
             db.MakeParam("@fldName",     SqlDbType.VarChar,  100, ParameterDirection.Input, "group_id"),
             db.MakeParam("@fldOut",      SqlDbType.VarChar, 1000, ParameterDirection.Input, "group_id,group_name,group_subjectionId,group_subjectionName,group_subjectionIds,group_display"),
             db.MakeInParam("@PageSize",  SqlDbType.Int,        4, PageSize),
             db.MakeInParam("@PageIndex", SqlDbType.Int,        4, PageNo),
             db.MakeInParam("@OrderType", SqlDbType.Int,        4,                       1),
             db.MakeParam("@strWhere",    SqlDbType.VarChar,  500, ParameterDirection.Input, strWhere)
         };
         List <GroupInfo> list = new List <GroupInfo>();
         using (DataTable table = db.GetDataTable(CommandType.StoredProcedure, "Usp_Paged", SqlParam))
         {
             foreach (DataRow row in table.Rows)
             {
                 GroupInfo model = new GroupInfo();
                 model.Group_id             = (int)row["Group_id"];
                 model.Group_name           = Convert.ToString(row["group_name"]);
                 model.Group_subjectionId   = (int)row["Group_subjectionId"];
                 model.Group_subjectionName = Convert.ToString(row["group_subjectionName"]);
                 model.Group_subjectionIds  = Convert.ToString(row["group_subjectionIds"]);
                 model.Group_display        = (int)row["Group_display"];
                 list.Add(model);
             }
             TotalPageNo = this.TotalPageNo(strWhere);
             table.Clear();
             table.Dispose();
             return(list);
         }
     }
 }