Ejemplo n.º 1
0
        public static bool CreateForm(OdbcDataReader reader, Role role)
        {
            int fCount = reader.FieldCount;
            for (int i = 0; i < fCount; i++)
            {
                string name = reader.GetName(i);

                // Map to DB field. Need to change if db changed
                switch (name) {
                    case "name": role._name = reader.GetString(i);
                                      break;
                    case "role_id": role._roleId = reader.GetInt32(i);
                                      break;
                }
            }
            return reader.HasRows;
        }
Ejemplo n.º 2
0
        public static Role[] LoadListFromDB(DBManager db, string sqlCriteria)
        {
            OdbcDataReader reader = db.Query("SELECT * FROM role " + sqlCriteria);
            LinkedList<Role> list = new LinkedList<Role>();
            while (reader.Read())
            {
                list.AddLast(Role.CreateForm(reader));
            }

            Role[] entities = new Role[list.Count];
            int i = 0;
            foreach (Role t in list)
            {
                entities[i++] = t;
            }
            return entities;
        }
Ejemplo n.º 3
0
 public static Role CreateForm(OdbcDataReader reader)
 {
     Role role = new Role();
     Role.CreateForm(reader, role);
     return role;
 }