/**
         * Method returns a mapped (database to model) staffSchedule model
         *
         * @param reader MySqlDataReader
         * @return Model implementing IModel interface - staffschedule
         */
        public IModel map(MySqlDataReader reader)
        {
            StaffModel         staff         = new StaffModel();
            ScheduleModel      schedule      = new ScheduleModel();
            StaffScheduleModel staffSchedule = new StaffScheduleModel();

            staff.setStaffId(reader.GetInt32("staffId"));
            staff.setFirstName(reader.GetString("firstName"));
            staff.setLastName(reader.GetString("lastName"));
            if (!reader.IsDBNull(6))
            {
                staff.setPhoneNumber(reader.GetString("phoneNumber"));
            }
            staff.setStaffType(reader.GetString("staffType"));

            schedule.setScheduleId(reader.GetInt32("scheduleId"));
            schedule.setDate(Helpers.DateHelper.getDateTimeStringFromReader(reader, "date"));
            schedule.setStartTime(reader.GetString("startTime"));
            schedule.setEndTime(reader.GetString("endTime"));

            staffSchedule.setStaffScheduleId(reader.GetInt32("staffScheduleId"));
            staffSchedule.setStaffMember(staff);
            staffSchedule.setSchedule(schedule);
            return(staffSchedule);
        }
Exemplo n.º 2
0
        /**
         * Method returns a mapped (database to model) StaffModel
         * @param reader MySqlDataReader
         * @return Model implementing IModel interface - staff
         */
        public IModel map(MySqlDataReader reader)
        {
            StaffModel staffMember = new StaffModel();

            staffMember.setStaffId(reader.GetInt16("staffId"));
            staffMember.setFirstName(reader.GetString("firstName"));
            staffMember.setLastName(reader.GetString("lastName"));
            if (!reader.IsDBNull(3))
            {
                staffMember.setPhoneNumber(reader.GetString("phoneNumber"));
            }
            staffMember.setStaffType(reader.GetString("staffType"));
            return(staffMember);
        }
Exemplo n.º 3
0
        /**
         * Method prepares staff model from data get from form
         *
         * @return staff model
         */
        private StaffModel getStaffModelFromForm()
        {
            StaffModel staffMember = new StaffModel();

            staffMember.setFirstName(doctorsFirstName.Text);
            staffMember.setLastName(doctorsLastName.Text);
            staffMember.setPhoneNumber(doctorsPhoneNumber.Text);
            if (String.IsNullOrEmpty(doctorsPhoneNumber.Text))
            {
                staffMember.setPhoneNumber("NULL");
            }
            ListItem staffType = (ListItem)staffTypes.SelectedItem;

            staffMember.setStaffType(staffType.text);
            return(staffMember);
        }
Exemplo n.º 4
0
        /**
         * Method returns a mapped (database to model) BookingModel
         * @param reader MySqlDataReader
         * @return Model implementing IModel interface - booking
         */
        public IModel map(MySqlDataReader reader)
        {
            BookingModel  booking  = new BookingModel();
            UserModel     user     = new UserModel();
            StaffModel    staff    = new StaffModel();
            ScheduleModel schedule = new ScheduleModel();

            booking.setBookingId(reader.GetInt16("bookingId"));
            booking.setConfirmation(reader.GetInt16("confirmation"));
            booking.setAttendance(reader.GetInt16("attendance"));
            booking.setLackOfCancellation(reader.GetInt16("lackOfCancellation"));

            if (!reader.IsDBNull(14))
            {
                booking.setComment(reader.GetString("comment"));
            }
            else
            {
                booking.setComment("");
            }

            booking.setStartTime(reader.GetString("startTime"));
            booking.setEndTime(reader.GetString("endTime"));

            if (reader.GetSchemaTable().Columns.Contains("patientId"))
            {
                booking.setUserId(reader.GetInt16("patientId"));
            }
            if (reader.GetSchemaTable().Columns.Contains("patientFirstName"))
            {
                user.setFirstName(reader.GetString("patientFirstName"));
            }

            user.setFirstName(reader.GetString("patientFirstName"));
            user.setLastName(reader.GetString("patientLastName"));
            booking.setUserModel(user);
            staff.setStaffId(reader.GetInt16("staffId"));
            staff.setFirstName(reader.GetString("staffFirstName"));
            staff.setLastName(reader.GetString("staffLastName"));
            staff.setStaffType(reader.GetString("staffType"));
            booking.setStaffMember(staff);
            schedule.setDate(Helpers.DateHelper.getDateTimeStringFromReader(reader, "date"));
            booking.setScheduleModel(schedule);
            return(booking);
        }