Example #1
0
        private AppointmentBase GetAppointment(DataRow dr)
        {
            AppointmentBase ap;// = new Incident();

            if (dr["DoctorId"].ToString() != string.Empty)
            {
                ap = new DoctorAppointment();
                ((DoctorAppointment)ap).Doctor  = GetDoctor((int)dr["DoctorId"]);
                ((DoctorAppointment)ap).KeyCode = dr["KeyCode"].ToString();
                ap.AppointmentType = "Doctor";
            }
            else
            {
                ap = new SpecialistAppointment();
                Specialist specialist = GetSpecialist((int)dr["Specialistid"]);
                ((SpecialistAppointment)ap).Specialist = specialist;
                ap.AppointmentType = specialist.SpecialistType;
            }

            ap.AmPm          = dr["AMPM"].ToString();
            ap.AppointmentId = (int)dr["AppointmentId"];
            ap.ProfessionalServiceProviderTypeId = (int)dr["ProfessionalServiceProviderTypeId"];
            ap.AppointmentDate          = (DateTime)dr["AppointmentDate"];
            ap.IsFollowupNeeded         = (bool)dr["IsFollowupNeeded"];
            ap.AppointmentHour          = dr["AppointmentHour"].ToString();
            ap.AppointmentMinute        = dr["AppointmentMinute"].ToString();
            ap.FurtherTreatmentRequired = dr["FurtherTreatmentRequired"].ToString();
            ap.TreatmentReceived        = dr["TreatmentReceived"].ToString();
            ap.StaffAccompanying        = GetStaffAccompanying((int)dr["StaffId"]);
            ap.IsInHouseAppointment     = (bool)dr["IsInHouseAppointment"];
            ap.IsClosed          = (bool)dr["IsClosed"];
            ap.Purpose           = dr["Purpose"].ToString();
            ap.Comments          = dr["Comments"].ToString();
            ap.StaffAccompanying = GetStaffAccompanying((int)dr["StaffId"]);
            ap.Student           = GetStudent((int)dr["StudentId"]);
            ap.UpdateDisplayNames();
            return(ap);
        }
Example #2
0
        //public AppointmentBase()
        //{
        //    Student = new Student();
        //    StaffAccomnaying = new Staff();
        //}

        public virtual void UpdateDisplayNames()
        {
            if (this is DoctorAppointment)
            {
                DoctorAppointment da = (DoctorAppointment)this;
                SpecialistDisplayName    = da.Doctor.FullName;
                AppointmentType          = "Doctor";
                ServiceProviderAddress   = da.Doctor.FullAddress;
                ServiceProviderTelephone = da.Doctor.Phone;
            }
            else if (this is SpecialistAppointment)
            {
                SpecialistAppointment sa = (SpecialistAppointment)this;
                SpecialistDisplayName    = sa.Specialist.FullName;
                AppointmentType          = sa.Specialist.SpecialistType;
                ServiceProviderAddress   = sa.Specialist.FullAddress;
                ServiceProviderTelephone = sa.Specialist.Phone;
            }

            ResidentDisplayName = Student.FullName;
            StaffDisplayName    = StaffAccompanying.FullName;
            AppointmentTime     = AppointmentHour + ":" + AppointmentMinute + ":" + AmPm;
        }