Esempio n. 1
0
        public override T Convert <T, U>(U entity)
        {
            if (entity is AttorneyVisit)
            {
                AttorneyVisit AttorneyVisitDB = entity as AttorneyVisit;

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

                BO.AttorneyVisit AttorneyVisitBO = new BO.AttorneyVisit();
                AttorneyVisitBO.ID = AttorneyVisitDB.Id;
                AttorneyVisitBO.CalendarEventId = AttorneyVisitDB.CalendarEventId;
                AttorneyVisitBO.CaseId          = AttorneyVisitDB.CaseId;
                AttorneyVisitBO.PatientId       = AttorneyVisitDB.PatientId;
                AttorneyVisitBO.CompanyId       = AttorneyVisitDB.CompanyId;
                AttorneyVisitBO.AttorneyId      = AttorneyVisitDB.AttorneyId;
                AttorneyVisitBO.EventStart      = AttorneyVisitDB.EventStart;
                AttorneyVisitBO.EventEnd        = AttorneyVisitDB.EventEnd;
                AttorneyVisitBO.Subject         = AttorneyVisitDB.Subject;
                AttorneyVisitBO.VisitStatusId   = AttorneyVisitDB.VisitStatusId;
                AttorneyVisitBO.ContactPerson   = AttorneyVisitDB.ContactPerson;
                AttorneyVisitBO.Agenda          = AttorneyVisitDB.Agenda;

                AttorneyVisitBO.IsDeleted      = AttorneyVisitDB.IsDeleted;
                AttorneyVisitBO.CreateByUserID = AttorneyVisitDB.CreateByUserID;
                AttorneyVisitBO.UpdateByUserID = AttorneyVisitDB.UpdateByUserID;

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

                        //if (AttorneyVisitDB.Patient.PatientInsuranceInfoes != null && AttorneyVisitDB.Patient.PatientInsuranceInfoes.Count > 0)
                        //{
                        //    List<BO.PatientInsuranceInfo> PatientInsuranceInfoBOList = new List<BO.PatientInsuranceInfo>();
                        //    using (PatientInsuranceInfoRepository patientInsuranceInfoRepo = new PatientInsuranceInfoRepository(_context))
                        //    {
                        //        foreach (PatientInsuranceInfo eachPatientInsuranceInfo in AttorneyVisitDB.Patient.PatientInsuranceInfoes)
                        //        {
                        //            if (eachPatientInsuranceInfo.IsDeleted.HasValue == false || (eachPatientInsuranceInfo.IsDeleted.HasValue == true && eachPatientInsuranceInfo.IsDeleted.Value == false))
                        //            {
                        //                PatientInsuranceInfoBOList.Add(patientInsuranceInfoRepo.Convert<BO.PatientInsuranceInfo, PatientInsuranceInfo>(eachPatientInsuranceInfo));
                        //            }
                        //        }

                        //        AttorneyVisitBO.Patient.PatientInsuranceInfoes = PatientInsuranceInfoBOList;
                        //    }
                        //}
                    }
                }

                if (AttorneyVisitDB.Case != null)
                {
                    BO.Case CaseBO = new BO.Case();
                    using (CaseRepository caseRepo = new CaseRepository(_context))
                    {
                        CaseBO = caseRepo.Convert <BO.Case, Case>(AttorneyVisitDB.Case);
                        AttorneyVisitBO.Case = CaseBO;

                        if (AttorneyVisitDB.Case.PatientAccidentInfoes != null && AttorneyVisitDB.Case.PatientAccidentInfoes.Count > 0)
                        {
                            List <BO.PatientAccidentInfo> PatientAccidentInfoBOList = new List <BO.PatientAccidentInfo>();
                            using (PatientAccidentInfoRepository patientAccidentInfoRepo = new PatientAccidentInfoRepository(_context))
                            {
                                foreach (PatientAccidentInfo eachPatientInsuranceInfo in AttorneyVisitDB.Case.PatientAccidentInfoes)
                                {
                                    if (eachPatientInsuranceInfo.IsDeleted.HasValue == false || (eachPatientInsuranceInfo.IsDeleted.HasValue == true && eachPatientInsuranceInfo.IsDeleted.Value == false))
                                    {
                                        PatientAccidentInfoBOList.Add(patientAccidentInfoRepo.Convert <BO.PatientAccidentInfo, PatientAccidentInfo>(eachPatientInsuranceInfo));
                                    }
                                }

                                AttorneyVisitBO.Case.PatientAccidentInfoes = PatientAccidentInfoBOList;
                            }
                        }
                    }
                }

                if (AttorneyVisitDB.Company != null)
                {
                    BO.Company boCompany = new BO.Company();
                    using (CompanyRepository cmp = new CompanyRepository(_context))
                    {
                        boCompany = cmp.Convert <BO.Company, Company>(AttorneyVisitDB.Company);
                        AttorneyVisitBO.Company = boCompany;
                    }
                }

                if (AttorneyVisitDB.CalendarEvent != null)
                {
                    AttorneyVisitBO.CalendarEvent = new BO.CalendarEvent();

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

                return((T)(object)AttorneyVisitBO);
            }
            else if (entity is CalendarEvent)
            {
                CalendarEvent CalendarEventDB = entity as CalendarEvent;

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

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

                return((T)(object)CalendarEvent);
            }

            return(default(T));
        }
Esempio n. 2
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));
        }
Esempio n. 3
0
        public T ConvertIMEvisit <T, U>(U entity)
        {
            if (entity is IMEVisit)
            {
                IMEVisit IMEVisit = entity as IMEVisit;

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

                BO.IMEVisit IMEVisitBO = new BO.IMEVisit();
                IMEVisitBO.ID = IMEVisit.ID;
                IMEVisitBO.CalendarEventId         = IMEVisit.CalendarEventId;
                IMEVisitBO.CaseId                  = IMEVisit.CaseId;
                IMEVisitBO.PatientId               = IMEVisit.PatientId;
                IMEVisitBO.EventStart              = IMEVisit.EventStart;
                IMEVisitBO.EventEnd                = IMEVisit.EventEnd;
                IMEVisitBO.Notes                   = IMEVisit.Notes;
                IMEVisitBO.VisitStatusId           = IMEVisit.VisitStatusId;
                IMEVisitBO.TransportProviderId     = IMEVisit.TransportProviderId;
                IMEVisitBO.DoctorName              = IMEVisit.DoctorName;
                IMEVisitBO.VisitCreatedByCompanyId = IMEVisit.VisitCreatedByCompanyId;
                IMEVisitBO.IsDeleted               = IMEVisit.IsDeleted;
                IMEVisitBO.CreateByUserID          = IMEVisit.CreateByUserID;
                IMEVisitBO.UpdateByUserID          = IMEVisit.UpdateByUserID;

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

                if (IMEVisit.TransportProviderId != null)
                {
                    BO.Company CompanyBO = new BO.Company();
                    using (PatientRepository patientRepo = new PatientRepository(_context))
                    {
                        CompanyBO          = patientRepo.Convert <BO.Company, Company>(IMEVisit.Company);
                        IMEVisitBO.Company = CompanyBO;
                    }
                }

                if (IMEVisit.CalendarEvent != null)
                {
                    IMEVisitBO.CalendarEvent = new BO.CalendarEvent();

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

                return((T)(object)IMEVisitBO);
            }

            return(default(T));
        }
        public override T Convert <T, U>(U entity)
        {
            if (entity is Notification)
            {
                Notification notification = entity as Notification;

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

                BO.Notification notificationBO = new BO.Notification();
                notificationBO.ID         = notification.Id;
                notificationBO.CompanyId  = notification.CompanyId;
                notificationBO.LocationId = notification.LocationId;
                notificationBO.StartDate  = notification.StartDate;
                notificationBO.EndDate    = notification.EndDate;
                notificationBO.IsViewed   = notification.IsViewed;

                notificationBO.CreateByUserID = notification.CreateByUserID;

                if (notification.IsDeleted.HasValue)
                {
                    notificationBO.IsDeleted = notification.IsDeleted.Value;
                }
                if (notification.UpdateByUserID.HasValue)
                {
                    notificationBO.UpdateByUserID = notification.UpdateByUserID.Value;
                }


                //if (notification.Company != null)
                //{
                //    BO.Company boCompany = new BO.Company();
                //    using (CompanyRepository cmp = new CompanyRepository(_context))
                //    {
                //        boCompany = cmp.Convert<BO.Company, Company>(notification.Company);
                //        notificationBO.Company = boCompany;
                //    }
                //}
                //if (notification.Location != null)
                //{
                //    BO.Location boLocation = new BO.Location();
                //    using (LocationRepository cmp = new LocationRepository(_context))
                //    {
                //        boLocation = cmp.Convert<BO.Location, Location>(notification.Location);
                //        notificationBO.Location = boLocation;
                //    }
                //}


                return((T)(object)notificationBO);
            }
            else if (entity is CalendarEvent)
            {
                CalendarEvent CalendarEventDB = entity as CalendarEvent;

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

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

                return((T)(object)CalendarEvent);
            }

            return(default(T));
        }