示例#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));
        }
示例#2
0
        public override T Convert <T, U>(U entity)
        {
            if (entity is PatientVisitUnscheduled)
            {
                PatientVisitUnscheduled PatientVisitUnscheduledDB = entity as PatientVisitUnscheduled;

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

                BO.PatientVisitUnscheduled PatientVisitUnscheduledBO = new BO.PatientVisitUnscheduled();
                PatientVisitUnscheduledBO.ID                  = PatientVisitUnscheduledDB.Id;
                PatientVisitUnscheduledBO.CaseId              = PatientVisitUnscheduledDB.CaseId;
                PatientVisitUnscheduledBO.PatientId           = PatientVisitUnscheduledDB.PatientId;
                PatientVisitUnscheduledBO.EventStart          = PatientVisitUnscheduledDB.EventStart;
                PatientVisitUnscheduledBO.MedicalProviderName = PatientVisitUnscheduledDB.MedicalProviderName;
                PatientVisitUnscheduledBO.DoctorName          = PatientVisitUnscheduledDB.DoctorName;
                PatientVisitUnscheduledBO.Notes               = PatientVisitUnscheduledDB.Notes;
                PatientVisitUnscheduledBO.SpecialtyId         = PatientVisitUnscheduledDB.SpecialtyId;
                PatientVisitUnscheduledBO.RoomTestId          = PatientVisitUnscheduledDB.RoomTestId;
                PatientVisitUnscheduledBO.ReferralId          = PatientVisitUnscheduledDB.ReferralId;
                PatientVisitUnscheduledBO.Status              = "Completed";

                PatientVisitUnscheduledBO.IsDeleted      = PatientVisitUnscheduledDB.IsDeleted;
                PatientVisitUnscheduledBO.CreateByUserID = PatientVisitUnscheduledDB.CreateByUserID;
                PatientVisitUnscheduledBO.UpdateByUserID = PatientVisitUnscheduledDB.UpdateByUserID;

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

                if (PatientVisitUnscheduledDB.Specialty != null)
                {
                    BO.Specialty SpecialtyBO = new BO.Specialty();
                    using (SpecialityRepository specialtyRepo = new SpecialityRepository(_context))
                    {
                        SpecialtyBO = specialtyRepo.Convert <BO.Specialty, Specialty>(PatientVisitUnscheduledDB.Specialty);
                        PatientVisitUnscheduledBO.Specialty = SpecialtyBO;
                    }
                }

                if (PatientVisitUnscheduledDB.RoomTest != null)
                {
                    BO.RoomTest RoomTestBO = new BO.RoomTest();
                    using (RoomTestRepository roomTestRepo = new RoomTestRepository(_context))
                    {
                        RoomTestBO = roomTestRepo.Convert <BO.RoomTest, RoomTest>(PatientVisitUnscheduledDB.RoomTest);
                        PatientVisitUnscheduledBO.RoomTest = RoomTestBO;
                    }
                }

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

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

                                PatientVisitUnscheduledBO.Case.PatientAccidentInfoes = PatientAccidentInfoBOList;
                            }
                        }
                    }
                }

                return((T)(object)PatientVisitUnscheduledBO);
            }

            return(default(T));
        }