public override T Convert <T, U>(U entity)
        {
            DoctorSpeciality doctorspecility = entity as DoctorSpeciality;

            if (doctorspecility == null)
            {
                return(default(T));
            }

            BO.DoctorSpeciality doctorspecilityBO = new BO.DoctorSpeciality();

            doctorspecilityBO.IsDeleted = doctorspecility.IsDeleted;
            if (doctorspecilityBO.UpdateByUserID.HasValue)
            {
                doctorspecilityBO.UpdateByUserID = doctorspecility.UpdateByUserID.Value;
            }

            BO.Doctor boDoctor = new BO.Doctor();
            using (DoctorRepository sr = new DoctorRepository(_context))
            {
                boDoctor = sr.Convert <BO.Doctor, Doctor>(doctorspecility.Doctor);
                doctorspecilityBO.Doctor = boDoctor;
            }

            BO.Specialty boSpecliality = new BO.Specialty();
            using (SpecialityRepository sr = new SpecialityRepository(_context))
            {
                boSpecliality = sr.Convert <BO.Specialty, Specialty>(doctorspecility.Specialty);
                doctorspecilityBO.Specialty = boSpecliality;
            }

            return((T)(object)doctorspecilityBO);
        }
        public override T Convert <T, U>(U entity)
        {
            DoctorLocationSchedule doctorlocationschedule = entity as DoctorLocationSchedule;

            if (doctorlocationschedule == null)
            {
                return(default(T));
            }

            BO.DoctorLocationSchedule doctorlocationscheduleBO = new BO.DoctorLocationSchedule();

            doctorlocationscheduleBO.ID = doctorlocationschedule.id;
            if (doctorlocationschedule.IsDeleted.HasValue)
            {
                doctorlocationscheduleBO.IsDeleted = doctorlocationschedule.IsDeleted.Value;
            }
            if (doctorlocationschedule.UpdateByUserID.HasValue)
            {
                doctorlocationscheduleBO.UpdateByUserID = doctorlocationschedule.UpdateByUserID.Value;
            }

            if (doctorlocationschedule.Doctor != null && (doctorlocationschedule.Doctor.IsDeleted.HasValue == false || (doctorlocationschedule.Doctor.IsDeleted.HasValue == true && doctorlocationschedule.Doctor.IsDeleted.Value == false)))
            {
                BO.Doctor boDoctor = new BO.Doctor();
                using (DoctorRepository cmp = new DoctorRepository(_context))
                {
                    boDoctor = cmp.ObjectConvert <BO.Doctor, Doctor>(doctorlocationschedule.Doctor);

                    if (boDoctor != null && doctorlocationschedule.Doctor != null && doctorlocationschedule.Doctor.User != null)
                    {
                        using (UserRepository userRep = new UserRepository(_context))
                        {
                            boDoctor.user = userRep.Convert <BO.User, User>(doctorlocationschedule.Doctor.User);
                        }
                    }

                    doctorlocationscheduleBO.doctor = boDoctor;
                }
            }

            if (doctorlocationschedule.Location != null && (doctorlocationschedule.Location.IsDeleted.HasValue == false || (doctorlocationschedule.Location.IsDeleted.HasValue == true && doctorlocationschedule.Location.IsDeleted.Value == false)))
            {
                BO.Location boLocation = new BO.Location();
                using (LocationRepository cmp = new LocationRepository(_context))
                {
                    boLocation = cmp.Convert <BO.Location, Location>(doctorlocationschedule.Location);
                    doctorlocationscheduleBO.location = boLocation;
                }
            }

            if (doctorlocationschedule.Schedule != null && (doctorlocationschedule.Schedule.IsDeleted.HasValue == false || (doctorlocationschedule.Schedule.IsDeleted.HasValue == true && doctorlocationschedule.Schedule.IsDeleted.Value == false)))
            {
                BO.Schedule boSchedule = new BO.Schedule();
                using (ScheduleRepository cmp = new ScheduleRepository(_context))
                {
                    boSchedule = cmp.Convert <BO.Schedule, Schedule>(doctorlocationschedule.Schedule);
                    doctorlocationscheduleBO.schedule = boSchedule;
                }
            }

            return((T)(object)doctorlocationscheduleBO);
        }
예제 #3
0
        public T ConvertEOvisit <T, U>(U entity)
        {
            if (entity is EOVisit)
            {
                EOVisit EOVisit = entity as EOVisit;

                if (EOVisit == null)
                {
                    return(default(T));
                }

                BO.EOVisit EOVisitBO = new BO.EOVisit();
                EOVisitBO.ID = EOVisit.ID;
                EOVisitBO.CalendarEventId         = EOVisit.CalendarEventId;
                EOVisitBO.DoctorId                = EOVisit.DoctorId;
                EOVisitBO.PatientId               = EOVisit.PatientId;
                EOVisitBO.VisitCreatedByCompanyId = EOVisit.PatientId;
                EOVisitBO.InsuranceProviderId     = EOVisit.InsuranceProviderId;
                EOVisitBO.VisitStatusId           = EOVisit.VisitStatusId;
                EOVisitBO.EventStart              = EOVisit.EventStart;
                EOVisitBO.EventEnd                = EOVisit.EventEnd;
                EOVisitBO.Notes = EOVisit.Notes;

                EOVisitBO.IsDeleted      = EOVisit.IsDeleted;
                EOVisitBO.CreateByUserID = EOVisit.CreateByUserID;
                EOVisitBO.UpdateByUserID = EOVisit.UpdateByUserID;

                if (EOVisit.Doctor != null)
                {
                    BO.Doctor doctorBO = new BO.Doctor();
                    using (DoctorRepository patientRepo = new DoctorRepository(_context))
                    {
                        doctorBO         = patientRepo.Convert <BO.Doctor, Doctor>(EOVisit.Doctor);
                        EOVisitBO.Doctor = doctorBO;
                    }
                }

                if (EOVisit.Patient != null)
                {
                    BO.Patient PatientBO = new BO.Patient();
                    using (PatientRepository patientRepo = new PatientRepository(_context))
                    {
                        PatientBO         = patientRepo.Convert <BO.Patient, Patient>(EOVisit.Patient);
                        EOVisitBO.Patient = PatientBO;
                    }
                }

                if (EOVisit.Company != null)
                {
                    BO.Company CompanyBO = new BO.Company();
                    using (CompanyRepository companyRepo = new CompanyRepository(_context))
                    {
                        CompanyBO         = companyRepo.Convert <BO.Company, Company>(EOVisit.Company);
                        EOVisitBO.Company = CompanyBO;
                    }
                }

                if (EOVisit.InsuranceMaster != null)
                {
                    BO.InsuranceMaster InsuranceMasterBO = new BO.InsuranceMaster();
                    using (InsuranceMasterRepository InsuranceMasterRepo = new InsuranceMasterRepository(_context))
                    {
                        InsuranceMasterBO         = InsuranceMasterRepo.ObjectConvert <BO.InsuranceMaster, InsuranceMaster>(EOVisit.InsuranceMaster);
                        EOVisitBO.InsuranceMaster = InsuranceMasterBO;
                    }
                }

                if (EOVisit.CalendarEvent != null)
                {
                    EOVisitBO.CalendarEvent = new BO.CalendarEvent();

                    using (CalendarEventRepository calEventRep = new CalendarEventRepository(_context))
                    {
                        EOVisitBO.CalendarEvent = calEventRep.Convert <BO.CalendarEvent, CalendarEvent>(EOVisit.CalendarEvent);
                    }
                }

                return((T)(object)EOVisitBO);
            }

            return(default(T));
        }