Example #1
0
 /// <summary>
 /// 取得菜单数据
 /// </summary>
 /// <param name="where"></param>
 /// <param name="orderBy"></param>
 /// <returns></returns>
 public List<PlatformMenu> GetPlatformMenusList(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<PlatformMenu> list = new List<PlatformMenu>();
     using (IDataReader reader = MSEntLibSqlHelper.ExecuteDataReaderBySql(sql.ToString()))
     {
         while (reader.Read())
         {
             PlatformMenu model = new PlatformMenu();
             ConvertToModel(reader, model);
             list.Add(model);
         }
     }
     return list;
 }
Example #2
0
 private void ConvertToModel(IDataReader reader, PlatformMenu model)
 {
     if (reader["Id"] != DBNull.Value)
         model.Id = Convert.ToInt32(reader["Id"]);
     if (reader["ParentId"] != DBNull.Value)
         model.ParentId = Convert.ToInt32(reader["ParentId"]);
     if (reader["MenuText"] != DBNull.Value)
         model.MenuText = reader["MenuText"].ToString();
     if (reader["IsFolder"] != DBNull.Value)
         model.IsFolder = Convert.ToBoolean(reader["IsFolder"]);
     if (reader["PagePath"] != DBNull.Value)
         model.PagePath = reader["PagePath"].ToString();
     if (reader["MenuPath"] != DBNull.Value)
         model.MenuPath = reader["MenuPath"].ToString();
 }