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); }
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); }
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); }
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(); } }
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); }
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); }
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(); }
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); }
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); }
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); }
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); }
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(); }
//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); }
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); }
public void acceptDoctorService(int id) { TheUnitOfWork.DoctorServiceRepo.acceptDoctorService(id); TheUnitOfWork.SaveChanges(); }
public void rejectDoctorService(int id) { TheUnitOfWork.DoctorServiceRepo.rejectDoctorService(id); TheUnitOfWork.SaveChanges(); }
public bool Delete(int id) { TheUnitOfWork.SubOfferRepo.Delete(id); return(TheUnitOfWork.SaveChanges() > new int()); }
public virtual void Delete() { CheckConcurrency(); Repository.Delete(DbEntity); TheUnitOfWork.SaveChanges(); }
public void changeBindingAndRejectedStatus(string doctorId, bool rejectState) { TheUnitOfWork.DoctorAttachmentRepo.changeBindingAndRejectedStatus(doctorId, rejectState); TheUnitOfWork.SaveChanges(); }
public virtual void Insert() { CheckConcurrency(); Repository.Insert(DbEntity); TheUnitOfWork.SaveChanges(); }