コード例 #1
0
 private void ConvertToModel(IDataReader reader, PlatformRoles model)
 {
     if (reader["Id"] != DBNull.Value)
         model.Id = Convert.ToInt32(reader["Id"]);
     if (reader["PagePath"] != DBNull.Value)
         model.PagePath = reader["PagePath"].ToString();
 }
コード例 #2
0
 /// <summary>
 /// 取得平台管理员权限数据集
 /// </summary>
 /// <param name="where"></param>
 /// <param name="orderBy"></param>
 /// <returns></returns>
 public List<PlatformRoles> GetPlatformRolesList(string where, string orderBy)
 {
     StringBuilder sql = new StringBuilder();
     sql.Append("select * from [dbo].[PlatformManager_Role]");
     if (!string.IsNullOrEmpty(where))
         sql.Append(" where " + where);
     if (!string.IsNullOrEmpty(orderBy))
         sql.Append(" order by " + orderBy);
     List<PlatformRoles> list = new List<PlatformRoles>();
     using (IDataReader reader = MSEntLibSqlHelper.ExecuteDataReaderBySql(sql.ToString()))
     {
         while (reader.Read())
         {
             PlatformRoles model = new PlatformRoles();
             ConvertToModel(reader, model);
             list.Add(model);
         }
     }
     return list;
 }