Exemplo n.º 1
0
        private void Add()
        {
            if (SelectedDoctor != null && SelectedDiagnosis != null && SelectedPatient != null)
            {
                DoctorVisit p = new DoctorVisit();
                p.DiagnosisID = SelectedDiagnosis.Id;
                p.DoctorID    = SelectedDoctor.Id;
                p.PatientID   = SelectedPatient.Id;
                p.VisitDate   = VisitDate;

                ButtonResult result = ButtonResult.OK;
                if (ButtonName == "add")
                {
                    visRepo.Add(p);
                }
                else
                {
                    DoctorVisit.DiagnosisID = SelectedDiagnosis.Id;
                    DoctorVisit.DoctorID    = SelectedDoctor.Id;
                    DoctorVisit.PatientID   = SelectedPatient.Id;
                    DoctorVisit.VisitDate   = VisitDate;
                    visRepo.Update(DoctorVisit);
                }

                RequestClose(new DialogResult(result));
            }
        }