Пример #1
0
        public SupSpecailization Insert(SupSpecailization SupSDTO, bool byAdmin)
        {
            if (SupSDTO == null)
            {
                throw new ArgumentNullException();
            }

            SupSpecialization sup_specilize = Mapper.Map <SupSpecialization>(SupSDTO);

            sup_specilize.ByAdmin = byAdmin;
            TheUnitOfWork.SupSpecializationRepo.Insert(sup_specilize);
            TheUnitOfWork.SaveChanges();
            SupSDTO.ID = sup_specilize.ID;
            return(SupSDTO);
        }
Пример #2
0
        public CreateClinicDto Insert(CreateClinicDto clinicDTO, string DoctorId)
        {
            if (clinicDTO == null)
            {
                throw new ArgumentNullException();
            }

            clinicDTO.DoctorId = DoctorId;
            Clinic clinic = Mapper.Map <Clinic>(clinicDTO);

            TheUnitOfWork.ClinicRepo.Insert(clinic);
            TheUnitOfWork.SaveChanges();
            clinicDTO.DoctorId = clinic.DoctorId;
            return(clinicDTO);
        }
Пример #3
0
        public bool Update(UpdateClinicDto clinicDto, string docID)
        {
            if (clinicDto == null)
            {
                throw new ArgumentNullException();
            }

            bool result = false;
            //clinicDto.DoctorId = docID;
            Clinic clinic = Mapper.Map <Clinic>(clinicDto);

            TheUnitOfWork.ClinicRepo.Update(clinic);
            result = TheUnitOfWork.SaveChanges() > new int();
            return(result);
        }
Пример #4
0
        public bool Update(DoctorServiceDto doctorServiceDto)
        {
            if (doctorServiceDto == null)
            {
                throw new ArgumentNullException();
            }

            bool result = false;

            doctorServiceDto.ByAdmin = true;
            DoctorService doctorService = Mapper.Map <DoctorService>(doctorServiceDto);

            TheUnitOfWork.DoctorServiceRepo.Update(doctorService);
            result = TheUnitOfWork.SaveChanges() > new int();
            return(result);
        }
 public void create(string doctorId, List <SupSpecailization> subSpecialtiesDto)
 {
     if (subSpecialtiesDto != null)
     {
         List <CreateDoctorSubSpecializationDTO> createListDto = new List <CreateDoctorSubSpecializationDTO>();
         subSpecialtiesDto.ForEach(item =>
         {
             createListDto.Add(new CreateDoctorSubSpecializationDTO {
                 DoctorId = doctorId, subSpecializeId = item.ID
             });
         });
         var doctorSubSpecialty = Mapper.Map <List <DoctorSubSpecialization> >(createListDto);
         TheUnitOfWork.DoctorSubSpecializationRepo.InsertList(doctorSubSpecialty);
         TheUnitOfWork.SaveChanges();
     }
 }
Пример #6
0
        public bool Update(UpdateAreaDTO areaDTO)
        {
            if (areaDTO == null)
            {
                throw new ArgumentNullException();
            }

            bool result = false;

            areaDTO.ByAdmin = true;
            Area area = Mapper.Map <Area>(areaDTO);

            TheUnitOfWork.AreaRepo.Update(area);
            result = TheUnitOfWork.SaveChanges() > new int();
            return(result);
        }
Пример #7
0
        public CreateAreaDTO Insert(CreateAreaDTO areaDTO, bool byAdmin)
        {
            if (areaDTO == null)
            {
                throw new ArgumentNullException();
            }

            Area area = Mapper.Map <Area>(areaDTO);

            area.ByAdmin = byAdmin;
            TheUnitOfWork.AreaRepo.Insert(area);
            TheUnitOfWork.SaveChanges();
            areaDTO.ID      = area.ID;
            areaDTO.ByAdmin = byAdmin;
            return(areaDTO);
        }
Пример #8
0
        public DoctorServiceDto Create(DoctorServiceDto doctorServiceDto, bool byAdmin)
        {
            if (doctorServiceDto == null)
            {
                throw new ArgumentNullException();
            }

            DoctorService doctorService = Mapper.Map <DoctorService>(doctorServiceDto);

            doctorService.ByAdmin = byAdmin;
            TheUnitOfWork.DoctorServiceRepo.Insert(doctorService);
            TheUnitOfWork.SaveChanges();
            doctorServiceDto.ID      = doctorService.ID;
            doctorServiceDto.ByAdmin = byAdmin;
            return(doctorServiceDto);
        }
        public void AddOrUpdateClinicClinicService(string clinicId, IEnumerable <ClinicServiceDto> clinicServiceDtos)
        {
            var clinicClinicServices = TheUnitOfWork.ClinicClinicServiceRepo.GetWhere(c => c.ClinicId == clinicId);

            TheUnitOfWork.ClinicClinicServiceRepo.DeleteList(clinicClinicServices);
            if (clinicClinicServices.Count == 0)
            {
                foreach (var clinicService in clinicServiceDtos)
                {
                    var newClinicClinicService = new ClinicClinicService
                    {
                        ClinicId        = clinicId,
                        ClinicServiceId = clinicService.ID
                    };
                    TheUnitOfWork.ClinicClinicServiceRepo.Insert(newClinicClinicService);
                }
            }
            else
            {
                bool inserted;
                foreach (var clinicService in clinicServiceDtos) // 1
                {
                    inserted = false;
                    foreach (var clinicClinicService in clinicClinicServices) // 1 2
                    {
                        if (clinicService.ID == clinicClinicService.ClinicServiceId && inserted == false)
                        {
                            TheUnitOfWork.ClinicClinicServiceRepo.Update(clinicClinicService);
                            inserted = true;
                        }
                        if (clinicService.ID != clinicClinicService.ClinicServiceId && inserted == false)
                        {
                            var newClinicClinicService = new ClinicClinicService
                            {
                                ClinicId        = clinicId,        //c1
                                ClinicServiceId = clinicService.ID // 1
                            };
                            TheUnitOfWork.ClinicClinicServiceRepo.Insert(newClinicClinicService);
                            inserted = true;
                        }
                    }
                }
            }
            TheUnitOfWork.SaveChanges();
        }
Пример #10
0
        public Reservation CreateReservation(string userId, CreateReservationDTO createDto)
        {
            DayShift dayShift = TheUnitOfWork.DayShiftRepo.GetById(createDto.dayShiftId);

            createDto.Date = createDto.Date.Date;
            Reservation reservation = Mapper.Map <Reservation>(createDto);

            reservation.IsRated = false;
            reservation.userId  = userId;

            if (CountOfReversationInDate(createDto.dayShiftId, createDto.Date) < dayShift.MaxNumOfReservation)
            {
                var reseve = TheUnitOfWork.ReservationRepo.Insert(reservation);
                TheUnitOfWork.SaveChanges();
                return(reseve);
            }
            return(null);
        }
Пример #11
0
        public List <SupSpecailization> InsertList(List <SupSpecailization> supSpecailizationsDto, bool byAdmin)
        {
            if (supSpecailizationsDto == null)
            {
                throw new ArgumentNullException();
            }

            foreach (var item in supSpecailizationsDto)
            {
                SupSpecialization sup = Mapper.Map <SupSpecialization>(item);
                sup.ByAdmin = byAdmin;
                var insertedItem = TheUnitOfWork.SupSpecializationRepo.Insert(sup);
                TheUnitOfWork.SaveChanges();
                item.ID      = insertedItem.ID;
                item.ByAdmin = insertedItem.ByAdmin;
            }
            return(supSpecailizationsDto);
        }
Пример #12
0
        public List <CreateDoctor_DoctorService> InsertList(List <CreateDoctor_DoctorService> doctorservicesDtos, string DoctorId)
        {
            if (doctorservicesDtos == null)
            {
                throw new ArgumentNullException();
            }

            for (int i = 0; i < doctorservicesDtos.Count; i++)
            {
                doctorservicesDtos[i].doctorID = DoctorId;
            }

            List <Doctor_DoctorService> doctorservices = Mapper.Map <List <Doctor_DoctorService> >(doctorservicesDtos);

            TheUnitOfWork.Doctor_DoctorServiceRepo.InsertList(doctorservices);
            TheUnitOfWork.SaveChanges();

            return(doctorservicesDtos);
        }
Пример #13
0
        public List <CreateClinicImagesDto> InsertList(List <CreateClinicImagesDto> clinicImagesDTOs, string clinicID)
        {
            if (clinicImagesDTOs == null)
            {
                throw new ArgumentNullException();
            }

            for (int i = 0; i < clinicImagesDTOs.Count; i++)
            {
                clinicImagesDTOs[i].ClinicId = clinicID;
            }

            List <ClinicImage> clinicImgs = Mapper.Map <List <ClinicImage> >(clinicImagesDTOs);

            TheUnitOfWork.ClinicImagesRepo.InsertList(clinicImgs);
            TheUnitOfWork.SaveChanges();
            for (int i = 0; i < clinicImgs.Count; i++)
            {
                clinicImagesDTOs[i].Id = clinicImgs[i].Id;
            }
            return(clinicImagesDTOs);
        }
Пример #14
0
        public List <DoctorServiceDto> InsertList(List <DoctorServiceDto> ServicesDto, bool byAdmin)
        {
            if (ServicesDto == null)
            {
                throw new ArgumentNullException();
            }

            foreach (var item in ServicesDto)
            {
                item.ByAdmin = byAdmin;
            }
            List <DoctorService> doctorServices = Mapper.Map <List <DoctorService> >(ServicesDto);

            TheUnitOfWork.DoctorServiceRepo.InsertList(doctorServices);
            TheUnitOfWork.SaveChanges();

            for (int i = 0; i < doctorServices.Count; i++)
            {
                ServicesDto[i].ID = doctorServices[i].ID;
            }

            return(ServicesDto);
        }
        public void UpdateList(string doctorId, List <SupSpecailization> subSpecialtiesDto)
        {
            List <DoctorSubSpecialization> inputFromUserList = new List <DoctorSubSpecialization>();

            subSpecialtiesDto.ForEach(item =>
            {
                inputFromUserList.Add(new DoctorSubSpecialization {
                    DoctorId = doctorId, subSpecializeId = item.ID
                });
            });
            var InsertListtoDatabase = new List <DoctorSubSpecialization>();
            var indatabase           = TheUnitOfWork.DoctorSubSpecializationRepo.GetByDoctorId(doctorId);

            inputFromUserList.ForEach(item =>
            {
                if (indatabase.Find(x => x.DoctorId == item.DoctorId && x.subSpecializeId == item.subSpecializeId) == null)
                {
                    InsertListtoDatabase.Add(new DoctorSubSpecialization {
                        DoctorId = doctorId, subSpecializeId = item.subSpecializeId
                    });
                }
            });
            var deletedListFromDatabase = new List <DoctorSubSpecialization>();

            indatabase.ForEach(item =>
            {
                if (inputFromUserList.Find(x => x.DoctorId == item.DoctorId && x.subSpecializeId == item.subSpecializeId) == null)
                {
                    deletedListFromDatabase.Add(item);
                }
            });

            TheUnitOfWork.DoctorSubSpecializationRepo.InsertList(InsertListtoDatabase);
            TheUnitOfWork.DoctorSubSpecializationRepo.DeleteList(deletedListFromDatabase);
            TheUnitOfWork.SaveChanges();
        }
Пример #16
0
        //public CreateMakeOfferDTO update(CreateMakeOfferDTO offerDTO)
        //{
        //    var makeOffer = Mapper.Map<MakeOffer>(offerDTO);
        //    TheUnitOfWork.MakeOfferRepo.Update(makeOffer);
        //    TheUnitOfWork.SaveChanges();
        //    return offerDTO;
        //}
        public CreateMakeOfferDTO update(CreateMakeOfferDTO offerDTO)
        {
            var offer = TheUnitOfWork.MakeOfferRepo.GetById(offerDTO.Id);

            offer.OfferImages = null;


            var makeOffer = Mapper.Map <MakeOffer>(offerDTO);

            offer.OfferImages     = makeOffer.OfferImages;
            offer.Details         = offerDTO.Details;
            offer.Discount        = offerDTO.Discount;
            offer.Fees            = offerDTO.Fees;
            offer.Information     = offerDTO.Information;
            offer.NumberOfSession = offerDTO.NumberOfSession;
            offer.State           = offerDTO.State;
            offer.Title           = offerDTO.Title;



            TheUnitOfWork.MakeOfferRepo.Update(offer);
            TheUnitOfWork.SaveChanges();
            return(offerDTO);
        }
Пример #17
0
        public IsDoctorAcceptDTO checkAcceptinationOfDoctorAccount(string doctorId)
        {
            IsDoctorAcceptDTO isDoctorAcceptDto = new IsDoctorAcceptDTO();

            var isAccept         = true;
            var report           = new List <string>();
            var doctor           = TheUnitOfWork.DoctorRepo.GetById(doctorId);
            var doctorAttachment = TheUnitOfWork.DoctorAttachmentRepo.GetFirstOrDefault(i => i.DoctorId == doctorId);

            if (doctor.IsAccepted == true)
            {
                isDoctorAcceptDto.AcceptState  = true;
                isDoctorAcceptDto.ErrorDetails = null;
                return(isDoctorAcceptDto);
            }
            if (TheUnitOfWork.DoctorSubSpecializationRepo.GetFirstOrDefault(i => i.DoctorId == doctorId) == null)
            {
                isAccept = false;
                report.Add("SubSpecialty Not Been Assigned");
            }
            //attachment cases
            if (doctorAttachment == null)
            {
                isAccept = false;
                report.Add("Attachment Not Been Assigned");
            }
            else
            {
                if (doctorAttachment.Rejected == true && doctorAttachment.isBinding == false)
                {
                    isAccept = false;
                    report.Add("Attachment were Been Rejected By Admin you should upload correct attachment");
                }
                else if (doctorAttachment.Rejected == false && doctorAttachment.isBinding == true)
                {
                    isAccept = false;
                    report.Add("Waiting Attachment to Be Accept By Admin");
                }
            }
            //end attachment cases
            if (TheUnitOfWork.Doctor_DoctorServiceRepo.GetFirstOrDefault(i => i.doctorID == doctorId) == null)
            {
                //isAccept = false;
                report.Add("Doctor Services Not Been Assigned");
            }
            if (TheUnitOfWork.ClinicRepo.GetFirstOrDefault(i => i.DoctorId == doctorId) == null)
            {
                isAccept = false;
                report.Add("Clinic Details Not Been Assigned");
            }
            if (TheUnitOfWork.ClinicClinicServiceRepo.GetFirstOrDefault(i => i.ClinicId == doctorId) == null)
            {
                //isAccept = false;
                report.Add("Clinic Services Not Been Assigned");
            }



            if (isAccept == true)
            {
                doctor.IsAccepted = true;
                TheUnitOfWork.DoctorRepo.Update(doctor);
                TheUnitOfWork.SaveChanges();

                isDoctorAcceptDto.AcceptState  = true;
                isDoctorAcceptDto.ErrorDetails = null;
                return(isDoctorAcceptDto);
            }

            isDoctorAcceptDto.AcceptState  = false;
            isDoctorAcceptDto.ErrorDetails = report;
            return(isDoctorAcceptDto);
        }
Пример #18
0
 public void acceptDoctorService(int id)
 {
     TheUnitOfWork.DoctorServiceRepo.acceptDoctorService(id);
     TheUnitOfWork.SaveChanges();
 }
Пример #19
0
 public void rejectDoctorService(int id)
 {
     TheUnitOfWork.DoctorServiceRepo.rejectDoctorService(id);
     TheUnitOfWork.SaveChanges();
 }
Пример #20
0
 public bool Delete(int id)
 {
     TheUnitOfWork.SubOfferRepo.Delete(id);
     return(TheUnitOfWork.SaveChanges() > new int());
 }
Пример #21
0
 public virtual void Delete()
 {
     CheckConcurrency();
     Repository.Delete(DbEntity);
     TheUnitOfWork.SaveChanges();
 }
Пример #22
0
 public void changeBindingAndRejectedStatus(string doctorId, bool rejectState)
 {
     TheUnitOfWork.DoctorAttachmentRepo.changeBindingAndRejectedStatus(doctorId, rejectState);
     TheUnitOfWork.SaveChanges();
 }
Пример #23
0
 public virtual void Insert()
 {
     CheckConcurrency();
     Repository.Insert(DbEntity);
     TheUnitOfWork.SaveChanges();
 }