public VM.Appointment GetAppointmentForCopy(string ApptId, int InstitutionId, NameValueCollection searchfilter) { Patient _patient; List<VM.Appointment> ap = GetAppointments(InstitutionId, searchfilter); VM.Appointment copyAppt = SearchOnAppointment(ap, Constants.Id, ApptId).FirstOrDefault(); if (copyAppt == null) return new VM.Appointment(); Appointment toCopy = copyAppt.ToRAppointment(); VM.Appointment app = new VM.Appointment(); //Appointment copiedFromExisting = new Appointment(toCopy, copyAppt.clinicID); //copiedFromExisting.BackgroundPersistWork(new HraModelChangedEventArgs(null)); //SessionManager.Instance.SetActivePatient(copiedFromExisting.unitnum, copiedFromExisting.apptID); //SessionManager.Instance.GetActivePatient().BackgroundLoadWork(); //SessionManager.Instance.MetaData.AllProviders.BackgroundListLoad(); //_patient = SessionManager.Instance.GetActivePatient(); //_patient.Providers.BackgroundListLoad(); //VM.Appointment app = copiedFromExisting.FromRAppointment(); //app.clinics = GetClinicList(); //app.Providers = SessionManager.Instance.MetaData.AllProviders.ToProviderList(); //app.FromRAppointment(_patient); //app.AppointmentDate = DateTime.Now; //app.appttime = null; //app.IsGoldenAppointment = "No"; //app.IsCopyAppointment = "Yes"; // SavePatient(app); return app; }
public VM.Appointment GetAppointmentForAdd(string MRN, int clinicId) { GoldenAppointment _appointment = new GoldenAppointment(); _appointment.MRN = MRN; _appointment.Load(); Patient _patient; VM.Appointment app = new VM.Appointment(); if (_appointment.apptid.HasValue) { AppointmentList appts = new AppointmentList(); appts.BackgroundListLoad(); ////Appointment goldenAppointment = appts.First(appt => appt.id == _appointment.apptid); // // SessionManager.Instance.SetActivePatient(goldenAppointment.unitnum, goldenAppointment.apptID); // SessionManager.Instance.GetActivePatient().BackgroundLoadWork(); //// SessionManager.Instance.MetaData.AllProviders.BackgroundListLoad(); // _patient = SessionManager.Instance.GetActivePatient(); // _patient.Providers.BackgroundListLoad(); // // VM.Appointment app = goldenAppointment.FromRAppointment(); // app.clinics= GetClinicList(); //// app.Providers = SessionManager.Instance.MetaData.AllProviders.ToProviderList(); // app.FromRAppointment(_patient); // app.IsGoldenAppointment = "Yes"; // app.IsCopyAppointment = "No"; return app; } else { _patient = new Patient(MRN); _patient.Providers.LoadFullList(); SessionManager.Instance.SetActivePatient(_patient.unitnum, _patient.apptid); Appointment appointment = new Appointment(); // appointment = new Appointment(clinicId, MRN) { }; // VM.Appointment app = appointment.FromRAppointment(); // app.clinics=GetClinicList(); // // SessionManager.Instance.MetaData.AllProviders.BackgroundListLoad(); //// app.Providers = SessionManager.Instance.MetaData.AllProviders.ToProviderList(); // app.FromRAppointment(_patient); // app.IsGoldenAppointment = "No"; // app.IsCopyAppointment = "No"; return app; } }