Esempio n. 1
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public IList <GroupInfo> GetList(string strWhere)
 {
     using (DBServer db = new DBServer())
     {
         StringBuilder strSql = new StringBuilder();
         strSql.Append("select  group_id, group_name, group_subjectionId, group_subjectionName, group_subjectionIds, group_display, Group_level");
         strSql.Append(" FROM [elink_group] ");
         if (!string.IsNullOrEmpty(strWhere.Trim()))
         {
             strSql.Append(string.Format(" where {0}", strWhere));
         }
         List <GroupInfo> list = new List <GroupInfo>();
         using (DataTable table = db.GetDataTable(CommandType.Text, strSql.ToString()))
         {
             foreach (DataRow row in table.Rows)
             {
                 GroupInfo model = new GroupInfo();
                 model.Group_id             = Convert.ToInt32(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        = Convert.ToInt32(row["Group_display"]);
                 model.Group_level          = Convert.ToInt32(row["Group_level"]);
                 list.Add(model);
             }
             table.Clear();
             table.Dispose();
             return(list);
         }
     }
 }
Esempio n. 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);
         }
     }
 }