Esempio n. 1
0
        public static Teacher CreateForm(OdbcDataReader reader)
        {
            Teacher teacher = new Teacher();

            Teacher.CreateForm(reader, teacher);
            return(teacher);
        }
Esempio n. 2
0
        // load all teacher NOT in this paidgroup
        // paidGroupID must be set before
        public Teacher[] LoadNonMemberTeachers(DBManager db)
        {
            if (this._paidGroupID == 0)
            {
                return(null);
            }

            String subQuery = "SELECT teacher_id FROM paid_group_teacher_mapping WHERE paid_group_id='" + this._paidGroupID + "'";
            String sql      = "SELECT * FROM teacher WHERE is_active=1 AND teacher_id NOT IN ( " + subQuery + " ) ORDER BY teacher_id";

            OdbcDataReader       reader = db.Query(sql);
            LinkedList <Teacher> list   = new LinkedList <Teacher>();

            while (reader.Read())
            {
                list.AddLast(Teacher.CreateForm(reader));
            }

            Teacher[] entities = new Teacher[list.Count];
            int       i        = 0;

            foreach (Teacher t in list)
            {
                entities[i++] = t;
            }
            return(entities);
        }
Esempio n. 3
0
        public override bool LoadFromDB(DBManager db, string sqlCriteria)
        {
            OdbcDataReader reader = db.Query("SELECT * FROM teacher WHERE " + sqlCriteria);

            if (!reader.Read())
            {
                return(false);
            }
            return(Teacher.CreateForm(reader, this));
        }
Esempio n. 4
0
        public static Teacher[] LoadListFromDB(DBManager db, string sqlCriteria)
        {
            OdbcDataReader       reader = db.Query("SELECT * FROM teacher " + sqlCriteria);
            LinkedList <Teacher> list   = new LinkedList <Teacher>();

            while (reader.Read())
            {
                list.AddLast(Teacher.CreateForm(reader));
            }

            Teacher[] entities = new Teacher[list.Count];
            int       i        = 0;

            foreach (Teacher t in list)
            {
                entities[i++] = t;
            }
            return(entities);
        }