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 ObjectConvert <T, U>(U entity)
        {
            DoctorSpeciality doctorspecility = entity as DoctorSpeciality;

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

            BO.DoctorSpeciality doctorspecilityBO = new BO.DoctorSpeciality();
            doctorspecilityBO.ID        = doctorspecility.id;
            doctorspecilityBO.IsDeleted = doctorspecility.IsDeleted;
            if (doctorspecilityBO.UpdateByUserID.HasValue)
            {
                doctorspecilityBO.UpdateByUserID = doctorspecility.UpdateByUserID.Value;
            }

            if (doctorspecility.Specialty != null && (doctorspecility.Specialty.IsDeleted.HasValue == false || (doctorspecility.Specialty.IsDeleted.HasValue == true && doctorspecility.Specialty.IsDeleted.Value == false)))
            {
                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);
        }
Example #3
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));
        }
        public override T Convert <T, U>(U entity)
        {
            CompanySpecialtyDetail companyspecialtydetail = entity as CompanySpecialtyDetail;

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

            BO.CompanySpecialtyDetails companyspecialtyDetailBO = new BO.CompanySpecialtyDetails();

            companyspecialtyDetailBO.ID          = companyspecialtydetail.id;
            companyspecialtyDetailBO.SpecialtyId = companyspecialtydetail.SpecialtyId;
            companyspecialtyDetailBO.CompanyID   = companyspecialtydetail.CompanyID;
            if (companyspecialtydetail.ReevalDays.HasValue)
            {
                companyspecialtyDetailBO.ReevalDays = companyspecialtydetail.ReevalDays.Value;
            }
            if (companyspecialtydetail.ReevalVisitCount.HasValue)
            {
                companyspecialtyDetailBO.ReevalVisitCount = companyspecialtydetail.ReevalVisitCount.Value;
            }
            if (companyspecialtydetail.InitialDays.HasValue)
            {
                companyspecialtyDetailBO.InitialDays = companyspecialtydetail.InitialDays.Value;
            }
            if (companyspecialtydetail.InitialVisitCount.HasValue)
            {
                companyspecialtyDetailBO.InitialVisitCount = companyspecialtydetail.InitialVisitCount.Value;
            }
            if (companyspecialtydetail.MaxReval.HasValue)
            {
                companyspecialtyDetailBO.MaxReval = companyspecialtydetail.MaxReval.Value;
            }
            if (companyspecialtydetail.IsInitialEvaluation.HasValue)
            {
                companyspecialtyDetailBO.IsInitialEvaluation = companyspecialtydetail.IsInitialEvaluation.Value;
            }
            if (companyspecialtydetail.Include1500.HasValue)
            {
                companyspecialtyDetailBO.Include1500 = companyspecialtydetail.Include1500.Value;
            }
            if (companyspecialtydetail.AssociatedSpecialty.HasValue)
            {
                companyspecialtyDetailBO.AssociatedSpecialty = companyspecialtydetail.AssociatedSpecialty.Value;
            }
            if (companyspecialtydetail.AllowMultipleVisit.HasValue)
            {
                companyspecialtyDetailBO.AllowMultipleVisit = companyspecialtydetail.AllowMultipleVisit.Value;
            }
            companyspecialtyDetailBO.InitialCode = companyspecialtydetail.InitialCode;
            companyspecialtyDetailBO.ReEvalCode  = companyspecialtydetail.ReEvalCode;
            //companyspecialtyDetailBO.MandatoryProcCode = companyspecialtydetail.MandatoryProcCode;
            if (companyspecialtydetail.IsDeleted.HasValue)
            {
                companyspecialtyDetailBO.IsDeleted = companyspecialtydetail.IsDeleted.Value;
            }
            if (companyspecialtydetail.UpdateByUserID.HasValue)
            {
                companyspecialtyDetailBO.UpdateByUserID = companyspecialtydetail.UpdateByUserID.Value;
            }

            if (companyspecialtydetail.Specialty != null)
            {
                BO.Specialty boSpecialty = new BO.Specialty();
                using (SpecialityRepository sr = new SpecialityRepository(_context))
                {
                    boSpecialty = sr.Convert <BO.Specialty, Specialty>(companyspecialtydetail.Specialty);
                    companyspecialtyDetailBO.Specialty = boSpecialty;
                }
            }
            if (companyspecialtydetail.Company != null)
            {
                BO.Company boCompany = new BO.Company();
                using (CompanyRepository cmp = new CompanyRepository(_context))
                {
                    boCompany = cmp.Convert <BO.Company, Company>(companyspecialtydetail.Company);
                    companyspecialtyDetailBO.Company = boCompany;
                }
            }
            return((T)(object)companyspecialtyDetailBO);
        }