Exemple #1
0
        public override T Convert <T, U>(U entity)
        {
            ScheduleDetail scheduledetail = entity as ScheduleDetail;

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

            BO.ScheduleDetail scheduledetailBO = new BO.ScheduleDetail();
            scheduledetailBO.ID             = scheduledetail.id;
            scheduledetailBO.Name           = scheduledetail.Name;
            scheduledetailBO.dayofWeek      = scheduledetail.DayOfWeek;
            scheduledetailBO.slotStart      = scheduledetail.SlotStart;
            scheduledetailBO.slotEnd        = scheduledetail.SlotEnd;
            scheduledetailBO.slotDate       = scheduledetail.SlotDate;
            scheduledetailBO.scheduleStatus = (BO.GBEnums.ScheduleStatus)scheduledetail.Status;

            if (scheduledetail.IsDeleted.HasValue)
            {
                scheduledetailBO.IsDeleted = scheduledetail.IsDeleted.Value;
            }
            if (scheduledetail.UpdateByUserID.HasValue)
            {
                scheduledetailBO.UpdateByUserID = scheduledetail.UpdateByUserID.Value;
            }

            using (ScheduleRepository sr = new ScheduleRepository(_context))
            {
                scheduledetailBO.Schedule = sr.Convert <BO.Schedule, Schedule>(scheduledetail.Schedule);
            }

            return((T)(object)scheduledetailBO);
        }
        public override T Convert <T, U>(U entity)
        {
            Room room = entity as Room;

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

            BO.Room roomBO = new BO.Room();
            roomBO.ID               = room.id;
            roomBO.name             = room.Name;
            roomBO.contactersonName = room.ContactPersonName;
            roomBO.phone            = room.Phone;

            if (room.IsDeleted.HasValue)
            {
                roomBO.IsDeleted = room.IsDeleted.Value;
            }
            if (room.UpdateByUserID.HasValue)
            {
                roomBO.UpdateByUserID = room.UpdateByUserID.Value;
            }

            if (room.RoomTest != null)
            {
                BO.RoomTest roomtestBO = new BO.RoomTest();
                roomtestBO.name      = room.RoomTest.Name;
                roomtestBO.ID        = room.RoomTest.id;
                roomtestBO.ColorCode = room.RoomTest.ColorCode;

                if (room.RoomTest.IsDeleted.HasValue)
                {
                    roomtestBO.IsDeleted = room.RoomTest.IsDeleted.Value;
                }
                if (room.RoomTest.UpdateByUserID.HasValue)
                {
                    roomtestBO.UpdateByUserID = room.RoomTest.UpdateByUserID.Value;
                }
                roomBO.roomTest = roomtestBO;
            }

            BO.Location boLocation = new BO.Location();
            using (LocationRepository sr = new LocationRepository(_context))
            {
                boLocation      = sr.Convert <BO.Location, Location>(room.Location);
                roomBO.location = boLocation;
            }
            BO.Schedule boSchedule = new BO.Schedule();
            using (ScheduleRepository cmp = new ScheduleRepository(_context))
            {
                boSchedule = cmp.Convert <BO.Schedule, Schedule>(room.Schedule);
                // cmp.Save(boSchedule);
                roomBO.schedule = boSchedule;
            }
            return((T)(object)roomBO);
        }
        public override T Convert <T, U>(U entity)
        {
            Location location = entity as Location;

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

            BO.Location locationBO = new BO.Location();

            locationBO.ID           = location.id;
            locationBO.Name         = location.Name;
            locationBO.IsDefault    = location.IsDefault;
            locationBO.LocationType = (BO.GBEnums.LocationType)location.LocationType;
            if (location.IsDeleted.HasValue)
            {
                locationBO.IsDeleted = location.IsDeleted.Value;
            }
            if (location.UpdateByUserID.HasValue)
            {
                locationBO.UpdateByUserID = location.UpdateByUserID.Value;
            }



            if (location.Company != null)
            {
                BO.Company boCompany = new BO.Company();
                boCompany.ID          = location.Company.id;
                boCompany.Name        = location.Company.Name;
                boCompany.TaxID       = location.Company.TaxID;
                boCompany.Status      = (BO.GBEnums.AccountStatus)location.Company.Status;
                boCompany.CompanyType = (BO.GBEnums.CompanyType)location.Company.CompanyType;
                if (location.Company.SubscriptionPlanType != null)
                {
                    boCompany.SubsCriptionType = (BO.GBEnums.SubsCriptionType)location.Company.SubscriptionPlanType;
                }
                else
                {
                    boCompany.SubsCriptionType = null;
                }

                locationBO.Company = boCompany;
            }

            if (location.AddressInfo != null)
            {
                BO.AddressInfo boAddress = new BO.AddressInfo();
                boAddress.Name     = location.AddressInfo.Name;
                boAddress.Address1 = location.AddressInfo.Address1;
                boAddress.Address2 = location.AddressInfo.Address2;
                boAddress.City     = location.AddressInfo.City;
                boAddress.State    = location.AddressInfo.State;
                boAddress.ZipCode  = location.AddressInfo.ZipCode;
                boAddress.Country  = location.AddressInfo.Country;
                //[STATECODE-CHANGE]
                //boAddress.StateCode = location.AddressInfo.StateCode;
                //[STATECODE-CHANGE]
                boAddress.CreateByUserID = location.AddressInfo.CreateByUserID;
                boAddress.ID             = location.AddressInfo.id;
                if (location.AddressInfo.IsDeleted.HasValue)
                {
                    boAddress.IsDeleted = location.AddressInfo.IsDeleted.Value;
                }
                if (location.AddressInfo.UpdateByUserID.HasValue)
                {
                    boAddress.UpdateByUserID = location.AddressInfo.UpdateByUserID.Value;
                }
                locationBO.AddressInfo = boAddress;
            }

            if (location.ContactInfo != null)
            {
                BO.ContactInfo boContactInfo = new BO.ContactInfo();
                boContactInfo.Name           = location.ContactInfo.Name;
                boContactInfo.CellPhone      = location.ContactInfo.CellPhone;
                boContactInfo.EmailAddress   = location.ContactInfo.EmailAddress;
                boContactInfo.HomePhone      = location.ContactInfo.HomePhone;
                boContactInfo.WorkPhone      = location.ContactInfo.WorkPhone;
                boContactInfo.FaxNo          = location.ContactInfo.FaxNo;
                boContactInfo.CreateByUserID = location.ContactInfo.CreateByUserID;
                boContactInfo.ID             = location.ContactInfo.id;
                if (location.ContactInfo.IsDeleted.HasValue)
                {
                    boContactInfo.IsDeleted = location.ContactInfo.IsDeleted.Value;
                }
                if (location.ContactInfo.UpdateByUserID.HasValue)
                {
                    boContactInfo.UpdateByUserID = location.ContactInfo.UpdateByUserID.Value;
                }
                locationBO.ContactInfo = boContactInfo;
            }
            BO.Schedule boSchedule = new BO.Schedule();
            using (ScheduleRepository cmp = new ScheduleRepository(_context))
            {
                boSchedule = cmp.Convert <BO.Schedule, Schedule>(location.Schedule);
                // cmp.Save(boSchedule);
                locationBO.Schedule = boSchedule;
            }
            return((T)(object)locationBO);
        }
        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);
        }