Exemple #1
0
        public void Update(AppointmentBase ap)
        {
            CommonFunctions.UpdateApostrophe(ap);
            StringBuilder sb = new StringBuilder();

            sb.Append("UPDATE Appointment SET ");
            sb.Append("StudentId=" + ap.Student.PersonId);
            sb.Append(",StaffId=" + ap.StaffAccompanying.PersonId);
            if (ap is DoctorAppointment)
            {
                sb.Append(",DoctorId=" + ((DoctorAppointment)ap).Doctor.PersonId);
                sb.Append(",SpecialistId=null");
                sb.Append(",KeyCode='" + ((DoctorAppointment)ap).KeyCode + "'");
            }
            else
            {
                sb.Append(",DoctorId=null");
                sb.Append(",SpecialistId=" + ((SpecialistAppointment)ap).Specialist.PersonId);
                sb.Append(",KeyCode=null");
            }
            sb.Append(",AppointmentDate='" + ap.AppointmentDate.ToString("dd/MM/yyyy") + "'");
            sb.Append(",AppointmentHour='" + ap.AppointmentHour + "'");
            sb.Append(",AppointmentMinute='" + ap.AppointmentMinute + "'");
            sb.Append(",AmPm='" + ap.AmPm + "'");
            sb.Append(",IsFollowupNeeded=" + ap.IsFollowupNeeded);
            sb.Append(",IsInHouseAppointment=" + ap.IsInHouseAppointment);
            sb.Append(",ProfessionalServiceProviderTypeId=" + ap.ProfessionalServiceProviderTypeId);
            sb.Append(",Purpose='" + ap.Purpose + "'");
            if (ap.Comments != null && ap.Comments != string.Empty)
            {
                sb.Append(",Comments='" + ap.Comments + "'");
            }
            else
            {
                sb.Append(",Comments=null");
            }

            sb.Append(" WHERE AppointmentId =" + ap.AppointmentId);
            string sql = sb.ToString();

            dbc.ExecuteCommand(sql);
        }
Exemple #2
0
        public void Add(AppointmentBase ap)
        {
            CommonFunctions.UpdateApostrophe(ap);
            StringBuilder sb = new StringBuilder();

            sb.Append("INSERT INTO Appointment (StudentId,StaffId,DoctorId,SpecialistId,KeyCode,AppointmentDate,AppointmentHour,AppointmentMinute,AMPM,IsFollowupNeeded,IsInHouseAppointment,Purpose,Comments,ProfessionalServiceProviderTypeId) VALUES (");
            sb.Append(ap.Student.PersonId);
            sb.Append("," + ap.StaffAccompanying.PersonId);
            if (ap is DoctorAppointment)
            {
                sb.Append("," + ((DoctorAppointment)ap).Doctor.PersonId);
                sb.Append(",null");
                sb.Append(",'" + ((DoctorAppointment)ap).KeyCode + "'");
            }
            else
            {
                sb.Append(",null");
                sb.Append("," + ((SpecialistAppointment)ap).Specialist.PersonId);
                sb.Append(",null");
            }
            sb.Append(",'" + ap.AppointmentDate.ToString("dd/MM/yyyy") + "'");
            sb.Append(",'" + ap.AppointmentHour + "'");
            sb.Append(",'" + ap.AppointmentMinute + "'");
            sb.Append(",'" + ap.AmPm + "'");
            sb.Append("," + ap.IsFollowupNeeded);
            sb.Append("," + ap.IsInHouseAppointment);
            sb.Append(",'" + ap.Purpose + "'");
            if (ap.Comments != null && ap.Comments != string.Empty)
            {
                sb.Append(",'" + ap.Comments + "'");
            }
            else
            {
                sb.Append(",null");
            }
            sb.Append("," + ap.ProfessionalServiceProviderTypeId);
            sb.Append(")");
            string sql = sb.ToString();

            dbc.ExecuteCommand(sql);
        }