예제 #1
0
파일: Teacher.cs 프로젝트: nettatata/btsman
        public static bool CreateForm(OdbcDataReader reader, Teacher teacher)
        {
            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 "teacher_id": teacher._teacherID = reader.GetInt32(i);
                                      break;
                    case "sex": teacher._sex = reader.GetString(i);
                                      break;
                    case "addr": teacher._addr = reader.GetString(i);
                                      break;
                    case "tel": teacher._tel = reader.GetString(i);
                                      break;
                    case "email": teacher._email = reader.GetString(i);
                                      break;
                    case "birthday":
                        teacher._birthday = new DateTime(reader.GetDate(i).Ticks);
                                      break;
                    case "firstname": teacher._firstname = reader.GetString(i);
                                      break;
                    case "surname": teacher._surname = reader.GetString(i);
                                      break;
                    case "citizen_id": teacher._citizenID = reader.GetString(i);
                                      break;
                    case "image": teacher._img = reader.GetString(i);
                                      break;
                    case "subject": teacher._subject = reader.GetString(i);
                                      break;
                    case "is_active": teacher._isActive = reader.GetInt32(i) > 0 ? true : false;
                                      break;

                }
            }
            return reader.HasRows;
        }
예제 #2
0
파일: Payment.cs 프로젝트: nettatata/btsman
        public static bool CreateForm(OdbcDataReader reader, Payment payment)
        {
            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 "course_id": payment._courseID = reader.GetInt32(i);
                                      break;
                    case "sum_all_cost": payment._sumAllCost = reader.GetInt32(i);
                                      break;
                    case "sum_max_payable": payment._sumMaxPayable = reader.GetInt32(i);
                                      break;
                    case "sum_paid_cost": payment._sumPaidCost = reader.GetInt32(i);
                                      break;
                    case "last_paid_date": payment._lastPaidDate = new DateTime(reader.GetDate(i).Ticks);
                                      break;
                    case "paid_round": payment._paidRound = reader.GetInt32(i);
                                      break;
                    case "status": payment._status = reader.GetInt32(i);
                                      break;
                    // helper info
                    case "bts_course_id": payment._btsCourseID = reader.GetString(i);
                                      break;
                    case "course_name": payment._courseName = reader.GetString(i);
                                      break;
                    case "course_start_date": payment._courseStartDate = new DateTime(reader.GetDate(i).Ticks);
                                      break;
                    case "course_end_date": payment._courseEndDate = new DateTime(reader.GetDate(i).Ticks);
                                      break;
                    case "paid_group_id": payment._paidGroupID = reader.GetInt32(i);
                                      break;

                }
            }
            return reader.HasRows;
        }
예제 #3
0
파일: Course.cs 프로젝트: nettatata/btsman
        public static bool CreateForm(OdbcDataReader reader, Course course)
        {
            if (course._teacher == null) { course._teacher = new Teacher(); }
            if (course._paidGroup == null) { course._paidGroup = new PaidGroup(); }

            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 "course_id": course._courseID = reader.GetInt32(i);
                                      break;
                    case "bts_course_id": course._btsCourseID = reader.GetString(i);
                                      break;
                    case "course_name": course._courseName = reader.GetString(i);
                                      break;
                    case "short_name": course._shortName = reader.GetString(i);
                                      break;
                    case "course_desc": course._courseDesc = reader.GetString(i);
                                      break;
                    case "course_type": course._courseType = reader.GetString(i);
                                      break;
                    case "room_id": course._roomID = reader.GetInt32(i);
                                      break;
                    case "teacher_id": course._teacherID = reader.GetInt32(i);
                                      course._teacher._teacherID = course._teacherID;
                                      break;
                    case "paid_group_id": course._paidGroupID = reader.GetInt32(i);
                                      course._paidGroup._paidGroupID = course._paidGroupID;
                                      break;
                    case "category": course._category = reader.GetString(i);
                                      break;
                    case "start_date": course._startdate = new DateTime(reader.GetDate(i).Ticks);
                                      break;
                    case "end_date": course._enddate = new DateTime(reader.GetDate(i).Ticks);
                                      break;
                    case "day_of_week": course._dayOfWeek = reader.GetString(i);
                                      break;
                    case "open_time": course._opentime = reader.GetString(i);
                                      break;
                    case "cost":      course._cost = reader.GetInt32(i);
                                      course._discountedCost = course._cost;
                                      break;
                    case "seat_limit": course._seatLimit = reader.GetInt32(i);
                                      break;
                    case "bank_regis_limit": course._bankRegisLimit = reader.GetInt32(i);
                                      break;
                    case "image": course._img = reader.GetString(i);
                                      break;
                    case "is_active": course._isActive = reader.GetInt32(i) > 0 ? true : false;
                                      break;
                    // helper info
                    case "teacher_firstname":
                                      course._teacher._firstname = reader.GetString(i);
                                      break;
                    case "teacher_surname":
                                      course._teacher._surname = reader.GetString(i);
                                      break;
                    case "num_registered":
                                      course._numRegistered = reader.GetInt32(i);
                                      break;

                }
            }
            return reader.HasRows;
        }