/// <summary>
        /// Запись файла в БД
        /// </summary>
        /// <returns></returns>
        protected async Task SaveFileAsync()
        {
            isLoad = false;
            //Создаем поток
            using var stream = uploadViewModel.File.OpenReadStream();

            var ms = new MemoryStream();
            //Присваиваем имя файла для хранения в БД
            Guid guid     = Guid.NewGuid();
            var  filename = $"{guid}.pdf";
            //Считываем файл в память
            await stream.CopyToAsync(ms);

            //Создаем и инициализируем экземпляр модели
            var order = new Order()
            {
                OrderScreen = ms.ToArray(),
                FileName    = filename
            };
            //Сохраняем модель в БД
            await FileUploadRepository.UploadAsync(order);

            //Получаем id
            orderId = FileUploadRepository.OrderId;
            isLoad  = false;
        }
 public FileUploadServiceImpl(FileUploadRepository fileUploadRepo, TransactionManager transactionManager, FileUploadMaker fileUploadMaker, IHostingEnvironment hostingEnvironment)
 {
     _fileUploadRepo     = fileUploadRepo;
     _transactionManager = transactionManager;
     _fileUploadMaker    = fileUploadMaker;
     _hostingEnvironment = hostingEnvironment;
 }
예제 #3
0
 public FileUpload(FileHelper fileHelper, IMapper mapper, FileUploadService fileUploadService, FileUploadRepository fileUploadRepo, PaginatedMetaService paginatedMetaService)
 {
     _fileUploadService    = fileUploadService;
     _fileUploadRepo       = fileUploadRepo;
     _paginatedMetaService = paginatedMetaService;
     _mapper     = mapper;
     _fileHelper = fileHelper;
 }
예제 #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            FileUploadRepository file = new FileUploadRepository();
            string contents           = FileReader.GetResourceContent(@"E:\\EdgeModuleDocs.txt");
            string url = file.StringUploadOnBlobStorageAsync(@"EdgeModule.txt", contents).Result;

            Console.ReadKey();
        }
예제 #5
0
        public void Index()
        {
            // Arrange
            FileUploadRepository fileUploadRepository = new FileUploadRepository();
            FileUploadController controller           = new FileUploadController(fileUploadRepository);

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            Assert.IsNotNull(result);
        }
예제 #6
0
        public void TestGetAddressSortedViewModel()
        {
            // Arrange
            FileUploadRepository fileUploadRepository = new FileUploadRepository();
            FileUploadController controller           = new FileUploadController(fileUploadRepository);

            // populate dummy DataTable
            DataTable dummyDT = makeDummeDataTable();

            List <AddressSortedViewModel> listAddressSortedViewModel = new List <Models.AddressSortedViewModel>();

            listAddressSortedViewModel = fileUploadRepository.GetAddressSorted(dummyDT);

            // Do 1 or more Asserts here...
            Assert.AreEqual(8, listAddressSortedViewModel.Count);
            Assert.AreEqual("65, Ambling Way", listAddressSortedViewModel.ToArray()[0].StreetName);
        }
예제 #7
0
        public void TestGetFrequencyViewModel()
        {
            // Arrange
            FileUploadRepository fileUploadRepository = new FileUploadRepository();
            FileUploadController controller           = new FileUploadController(fileUploadRepository);

            // populate dummy DataTable
            DataTable dummyDT = makeDummeDataTable();

            List <NamesFrequencyViewModel> listNamesFrequencyViewModel = new List <Models.NamesFrequencyViewModel>();

            listNamesFrequencyViewModel = fileUploadRepository.GetNamesFrequency(dummyDT);


            // Do 1 or more Asserts here...
            Assert.AreEqual(9, listNamesFrequencyViewModel.Count);
            Assert.AreEqual("James", listNamesFrequencyViewModel.ToArray()[0].FirstOrLastName);
            Assert.AreEqual(3, listNamesFrequencyViewModel.ToArray()[0].Frequency);
        }
예제 #8
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context                      = context;
     GigsRepository                = new GigRepository(context);
     InfluencerRepository          = new InfluencerRepository(context);
     SpecificIndustryRepository    = new SpecificIndustryRepository(context);
     FavouriteGigRepository        = new FavouriteGigRepository(context);
     FavouriteInfluencerRepository = new FavouriteInfluencerRepository(context);
     ApplicationUserRepository     = new ApplicationUserRepository(context);
     BasicPackageRepository        = new BasicPackageRepository(context);
     AdvancedPackageRepository     = new AdvancedPackageRepository(context);
     PremiumPackageRepository      = new PremiumPackageRepository(context);
     FileUploadRepository          = new FileUploadRepository(context);
     MembershipTypeRepository      = new MembershipTypeRepository(context);
     AuroraWalletRepository        = new AuroraWalletRepository(context);
     NotificationsRepository       = new NotificationsRepository(context);
     UserNotificationsRepository   = new UserNotificationsRepository(context);
     WalletRepository              = new WalletRepository(context);
     AuctionRepository             = new AuctionRepository(context);
     IndustryRepository            = new IndustryRepository(context);
     OrderRepository               = new OrderRepository(context);
     ShoppingCartRepository        = new ShoppingCartRepository(context);
 }
예제 #9
0
        internal static BaseEntityRepo GetRepo <T>(MIDASGBXEntities context)
        {
            BaseEntityRepo repo = null;

            if (typeof(T) == typeof(BO.Company))
            {
                repo = new CompanyRepository(context);
            }
            else if (typeof(T) == typeof(BO.Signup))
            {
                repo = new CompanyRepository(context);
            }
            else if (typeof(T) == typeof(BO.User))
            {
                repo = new UserRepository(context);
            }
            else if (typeof(T) == typeof(BO.OTP))
            {
                repo = new OTPRepository(context);
            }
            else if (typeof(T) == typeof(BO.PasswordToken))
            {
                repo = new PasswordTokenRepository(context);
            }
            else if (typeof(T) == typeof(BO.Location))
            {
                repo = new LocationRepository(context);
            }
            else if (typeof(T) == typeof(BO.Invitation))
            {
                repo = new InvitationRepository(context);
            }
            else if (typeof(T) == typeof(BO.SaveLocation))
            {
                repo = new LocationRepository(context);
            }
            else if (typeof(T) == typeof(BO.AddUser))
            {
                repo = new UserRepository(context);
            }
            else if (typeof(T) == typeof(BO.ValidateOTP))
            {
                repo = new OTPRepository(context);
            }
            else if (typeof(T) == typeof(BO.Specialty))
            {
                repo = new SpecialityRepository(context);
            }
            else if (typeof(T) == typeof(BO.SpecialtyDetails))
            {
                repo = new SpecialityDetailsRepository(context);
            }
            else if (typeof(T) == typeof(BO.CompanySpecialtyDetails))
            {
                repo = new CompanySpecialityDetailsRepository(context);
            }
            else if (typeof(T) == typeof(BO.Doctor))
            {
                repo = new DoctorRepository(context);
            }
            else if (typeof(T) == typeof(BO.DoctorSpeciality))
            {
                repo = new DoctorSpecialityRepository(context);
            }
            else if (typeof(T) == typeof(BO.RoomTest))
            {
                repo = new RoomTestRepository(context);
            }
            else if (typeof(T) == typeof(BO.Room))
            {
                repo = new RoomRepository(context);
            }
            else if (typeof(T) == typeof(BO.Schedule))
            {
                repo = new ScheduleRepository(context);
            }
            else if (typeof(T) == typeof(BO.UserCompany))
            {
                repo = new UserCompanyRepository(context);
            }
            else if (typeof(T) == typeof(BO.DoctorLocationSchedule))
            {
                repo = new DoctorLocationScheduleRepository(context);
            }
            else if (typeof(T) == typeof(List <BO.DoctorLocationSchedule>))
            {
                repo = new DoctorLocationScheduleRepository(context);
            }
            //else if (typeof(T) == typeof(BO.Patient))
            //{
            //    repo = new PatientRepository(context);
            //}
            else if (typeof(T) == typeof(BO.Log))
            {
                repo = new LogRepository(context);
            }
            else if (typeof(T) == typeof(BO.UserCompany))
            {
                repo = new UserCompanyRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.State))
            {
                repo = new StateRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.City))
            {
                repo = new CityRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.MaritalStatus))
            {
                repo = new MaritalStatusRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.Gender))
            {
                repo = new GenderRepository(context);
            }
            else if (typeof(T) == typeof(BO.Patient))
            {
                repo = new PatientRepository(context);
            }
            else if (typeof(T) == typeof(BO.Case))
            {
                repo = new CaseRepository(context);
            }
            else if (typeof(T) == typeof(BO.PatientInsuranceInfo))
            {
                repo = new PatientInsuranceInfoRepository(context);
            }
            else if (typeof(T) == typeof(BO.PatientEmpInfo))
            {
                repo = new PatientEmpInfoRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.PolicyOwner))
            {
                repo = new PolicyOwnerRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.InsuranceType))
            {
                repo = new InsuranceTypeRepository(context);
            }
            else if (typeof(T) == typeof(BO.PatientAccidentInfo))
            {
                repo = new PatientAccidentInfoRepository(context);
            }
            else if (typeof(T) == typeof(BO.PatientFamilyMember))
            {
                repo = new PatientFamilyMemberRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.PatientType))
            {
                repo = new PatientTypeRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.Relation))
            {
                repo = new RelationRepository(context);
            }
            else if (typeof(T) == typeof(BO.RefferingOffice))
            {
                repo = new RefferingOfficeRepository(context);
            }
            else if (typeof(T) == typeof(BO.AttorneyMaster))
            {
                repo = new AttorneyMasterRepository(context);
            }
            else if (typeof(T) == typeof(BO.CaseInsuranceMapping))
            {
                repo = new CaseInsuranceMappingRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.CaseType))
            {
                repo = new CaseTypeRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.CaseStatus))
            {
                repo = new CaseStatusRepository(context);
            }
            else if (typeof(T) == typeof(BO.AdjusterMaster))
            {
                repo = new AdjusterMasterRepository(context);
            }
            else if (typeof(T) == typeof(BO.InsuranceMaster))
            {
                repo = new InsuranceMasterRepository(context);
            }
            //else if (typeof(T) == typeof(BO.PatientVisit))
            //{
            //    repo = new PatientVisitRepository(context);
            //}
            //else if (typeof(T) == typeof(BO.PatientVisitEvent))
            //{
            //    repo = new PatientVisitEventRepository(context);
            //}
            else if (typeof(T) == typeof(BO.PatientVisit))
            {
                repo = new PatientVisitRepository(context);
            }
            else if (typeof(T) == typeof(BO.CalendarEvent))
            {
                repo = new CalendarEventRepository(context);
            }
            else if (typeof(T) == typeof(BO.CaseCompanyMapping))
            {
                repo = new CaseCompanyMappingRepository(context);
            }
            else if (typeof(T) == typeof(BO.CompanyCaseConsentApproval))
            {
                repo = new CompanyCaseConsentApprovalRepository(context);
            }
            //else if (typeof(T) == typeof(BO.Referral))
            //{
            //    repo = new ReferralRepository(context);
            //}
            else if (typeof(T) == typeof(BO.Document))
            {
                repo = new FileUploadRepository(context);
            }
            else if (typeof(T) == typeof(BO.Notification))
            {
                repo = new NotificationRepository(context);
            }
            else if (typeof(T) == typeof(BO.AddPatient))
            {
                repo = new PatientRepository(context);
            }
            else if (typeof(T) == typeof(BO.DiagnosisType))
            {
                repo = new DiagnosisTypeRepository(context);
            }
            else if (typeof(T) == typeof(BO.DiagnosisCode))
            {
                repo = new DiagnosisCodeRepository(context);
            }
            else if (typeof(T) == typeof(BO.ProcedureCode))
            {
                repo = new ProcedureCodeRepository(context);
            }
            else if (typeof(T) == typeof(BO.CompanyCaseConsentBase64))
            {
                repo = new CompanyCaseConsentApprovalRepository(context);
            }
            else if (typeof(T) == typeof(BO.DocumentNodeObjectMapping))
            {
                repo = new DocumentNodeObjectMappingRepository(context);
            }
            else if (typeof(T) == typeof(BO.PreferredMedicalProviderSignUp))
            {
                repo = new PreferredMedicalProviderRepository(context);
            }
            else if (typeof(T) == typeof(BO.PreferredAttorneyProviderSignUp))
            {
                repo = new PreferredAttorneyProviderRepository(context);
            }
            else if (typeof(T) == typeof(BO.UserPersonalSetting))
            {
                repo = new UserPersonalSettingRepository(context);
            }
            else if (typeof(T) == typeof(BO.PendingReferral))
            {
                repo = new PendingReferralRepository(context);
            }
            else if (typeof(T) == typeof(BO.VisitReports))
            {
                repo = new ReportsRepository(context);
            }
            else if (typeof(T) == typeof(BO.Referral))
            {
                repo = new ReferralRepository(context);
            }
            else if (typeof(T) == typeof(BO.MergePDF) || typeof(T) == typeof(BO.Document) || typeof(T) == typeof(BO.Common.UploadInfo))
            {
                repo = new DocumentManagerRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.TemplateType))
            {
                repo = new TemplateTypeRepository(context);
            }
            else if (typeof(T) == typeof(BO.GeneralSetting))
            {
                repo = new GeneralSettingRepository(context);
            }
            else if (typeof(T) == typeof(BO.PreferredAncillarProviderSignUp))
            {
                repo = new PreferredAncillaryProviderRepository(context);
            }
            else if (typeof(T) == typeof(BO.ProcedureCodeCompanyMapping))
            {
                repo = new ProcedureCodeCompanyMappingRepository(context);
            }
            else if (typeof(T) == typeof(BO.CompanyICDTypeCode))
            {
                repo = new ICDTypeCodeRepository(context);
            }
            else if (typeof(T) == typeof(BO.IMEVisit))
            {
                repo = new IMEvisitRepository(context);
            }
            else if (typeof(T) == typeof(BO.EOVisit))
            {
                repo = new EOVisitRepository(context);
            }
            else if (typeof(T) == typeof(BO.AttorneyVisit))
            {
                repo = new AttorneyVisitRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.LanguagePreference))
            {
                repo = new LanguagePreferenceRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.SocialMedia))
            {
                repo = new SocialMediaRepository(context);
            }
            else if (typeof(T) == typeof(BO.PatientVisitUnscheduled))
            {
                repo = new PatientVisitUnscheduledRepository(context);
            }
            else if (typeof(T) == typeof(BO.SchoolInformation))
            {
                repo = new SchoolInformationRepository(context);
            }
            else if (typeof(T) == typeof(BO.PlaintiffVehicle))
            {
                repo = new PlaintiffVehicleRepository(context);
            }
            else if (typeof(T) == typeof(BO.DefendantVehicle))
            {
                repo = new DefendantVehicleRepository(context);
            }
            else if (typeof(T) == typeof(BO.PatientPriorAccidentInjury))
            {
                repo = new PatientPriorAccidentInjuryRepository(context);
            }
            else if (typeof(T) == typeof(BO.OTPCompanyMapping))
            {
                repo = new OTPCompanyMappingRepository(context);
            }
            else if (typeof(T) == typeof(BO.ReferralVisitUnscheduled))
            {
                repo = new PatientVisitUnscheduledRepository(context);
            }

            return(repo);
        }