Ejemplo n.º 1
0
        private void AddUpdateDoctors(Student student)
        {
            DoctorData doctorData = new DoctorData(dbc);

            foreach (Doctor doctor in student.Doctors)
            {
                //if (doctor.PersonId == 0)
                //{
                //    doctorData.Add(doctor, student.PersonId);
                //}
                //else
                //{
                bool personExists = doctorData.PersonExists(doctor.PersonId, student.PersonId);
                if (!personExists)
                {
                    doctorData.Allocate(doctor, student.PersonId);
                }
                // }
            }

            foreach (object obj in student.RemovedObjects)
            {
                if (obj is Doctor)
                {
                    doctorData.Remove((Doctor)obj, student.PersonId);
                }
            }
        }
Ejemplo n.º 2
0
        //protected DoctorData doctorData;
        public StudentDoctorAddEdit(Student student, DBCommand dbc) : base(student, dbc)
        {
            _database = new DoctorData(_dbc);
            foreach (Doctor doctor in student.Doctors)
            {
                bool personExists = _database.PersonExists(doctor.PersonId, student.PersonId);
                if (!personExists)
                {
                    _database.Allocate(doctor, student.PersonId);
                }
            }

            foreach (object obj in student.RemovedObjects)
            {
                if (obj is Doctor)
                {
                    _database.Remove((Doctor)obj, student.PersonId);
                }
            }
        }