/** * 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); }
/** * 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); }
/** * 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); }