Example #1
0
 public AnnonceController(IWebHostEnvironment env, IFavoris favoris, IUpload uploadService, ILogin login)
 {
     _env            = env;
     _favorisService = favoris;
     _uploadService  = uploadService;
     _login          = login;
 }
Example #2
0
 /// <summary>
 /// Upload image
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> UploadImagesAsync(this IUpload operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.UploadImagesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Example #3
0
 public ProfileController(UserManager <User> userManager, IUser userService, IUpload uploadService, IConfiguration configuration)
 {
     this._userManager   = userManager;
     this._userService   = userService;
     this._uploadService = uploadService;
     _configuration      = configuration;
 }
Example #4
0
 public ProfileController(UserManager <ApplicationUser> userManager, IApplicationUser userService, IUpload uploadService, IConfiguration configuration)
 {
     _userManager   = userManager;
     _userService   = userService;
     _uploadService = uploadService;
     _configuration = configuration;
 }
 public PraticienController(IWebHostEnvironment env, IRdv rdv, IUpload uploadService, ILogin login)
 {
     _env          = env;
     _rdvService   = rdv;
     _uploadSerice = uploadService;
     _login        = login;
 }
Example #6
0
        private void AttachNotifications(BackgroundUploader uploader, IUpload upload)
        {
            var successToast = ToastContentFactory.CreateToastText02();

            successToast.Audio.Content     = ToastAudioContent.SMS;
            successToast.TextHeading.Text  = _locService["Toast_Uploads_SuccessReturn_Text"];
            successToast.TextBodyWrap.Text = upload.Uploadable.Name;

            var successXml = successToast.GetXml();

            ToastAudioHelper.SetSuccessAudio(successXml);

            var successNotification = new ToastNotification(successXml);

            var failToast = ToastContentFactory.CreateToastText02();

            failToast.Audio.Content     = ToastAudioContent.IM;
            failToast.TextHeading.Text  = _locService["Toast_Uploads_Fail_Text"];
            failToast.TextBodyWrap.Text = upload.Uploadable.Name;

            var failXml = failToast.GetXml();

            ToastAudioHelper.SetFailAudio(failXml);

            var failNotification = new ToastNotification(failXml);

            uploader.SuccessToastNotification = successNotification;
            uploader.FailureToastNotification = failNotification;
        }
        public async Task <ActionResult> UploadPost <T>(IUpload uploadViewModel)
        {
            // Get EXCEL File
            var fileBase = Request.Files.Get(0);

            if (fileBase != null && fileBase.ContentLength > 0)
            {
                // Check file type
                if (ExcelHelper.CheckIsExcel(fileBase))
                {
                    // Save to TABLE GenerateUploadRecord
                    await DbManager.Add(GenerateUploadRecord(uploadViewModel));

                    var entity = GetEntityListFromExcel(fileBase.InputStream, uploadViewModel);

                    // Save to database
                    if (entity.Any())
                    {
                        DbManager.AddRange(entity as List <T>);
                    }

                    await DbManager.GetContext().SaveChangesAsync().ConfigureAwait(continueOnCapturedContext: false);

                    return(new HttpStatusCodeResult(HttpStatusCode.Accepted));
                }
            }
            return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError));
        }
Example #8
0
 public DocumentBuilder(
     WebClient webClient, DocumentConverter documentConverter, IUpload upload)
 {
     this.webClient         = webClient;
     this.documentConverter = documentConverter;
     iUpload = upload;
 }
Example #9
0
        private void ProcessTraceFile(TraceFile trace, Archive archive, Config config, LineCoverageMerger coverageMerger)
        {
            if (trace.IsEmpty())
            {
                logger.Info("Archiving {trace} because it does not contain any coverage", trace.FilePath);
                archive.ArchiveEmptyFile(trace.FilePath);
                return;
            }

            string processPath = trace.FindProcessPath();

            if (processPath == null)
            {
                logger.Info("Archiving {trace} because it does not contain a Process= line", trace.FilePath);
                archive.ArchiveFileWithoutProcess(trace.FilePath);
                return;
            }

            Config.ConfigForProcess processConfig = config.CreateConfigForProcess(processPath);
            IUpload upload = uploadFactory.CreateUpload(processConfig, fileSystem);

            if (processConfig.PdbDirectory == null)
            {
                ProcessMethodCoverage(trace, archive, processConfig, upload);
            }
            else
            {
                ProcessLineCoverage(trace, archive, config, processConfig, upload, coverageMerger);
            }
        }
Example #10
0
 public ForumController(IForum forumService, IPost postService, IUpload uploadService, IConfiguration configuration) //it's not a concrete instance of our forum service but rather we are passing in this IForum interface and then we are gonna use dependency injection here and we are gonna tell that anytime we as for something that implements this IForum interface to go ahead and pass that concrete instance of our forum service
 {
     _forumService  = forumService;
     _postService   = postService;
     _uploadService = uploadService;
     _configuration = configuration;
 }
 public ForumController(IForum forumService, IPost postService, IUpload uploadService, IConfiguration configuration)
 {
     _forumService  = forumService;
     _postService   = postService;
     _uploadService = uploadService;
     _configuration = configuration;
 }
Example #12
0
 public ForumController(IForum forumService, IConfiguration configuration, IApplicationUser userService, IUpload uploadService)
 {
     _forumService  = forumService;
     _configuration = configuration;
     _userService   = userService;
     _uploadService = uploadService;
 }
Example #13
0
        public async Task FinalizeUploadAsync(IUpload upload, IUploadBlock[] blocks)
        {
            int       retryCount = 0;
            Exception lastException;

            do
            {
                if (retryCount > 0)
                {
                    await Task.Delay(retryPolicy.GetDelay(retryCount)).ConfigureAwait(false);
                }

                try
                {
                    var request = new CompleteMultipartUploadRequest(client.Host, upload, blocks);

                    await client.CompleteMultipartUploadAsync(request).ConfigureAwait(false);

                    return;
                }
                catch (S3Exception ex) when(ex.IsTransient)
                {
                    lastException = ex;
                }

                retryCount++;
            }while (retryPolicy.ShouldRetry(retryCount));

            throw lastException;
        }
Example #14
0
 public ProfileController(UserManager <ApplicationUser> userManager, IApplicationUser userService, IUpload uploadService, IHostingEnvironment he)
 {
     this.userManager   = userManager;
     this.userService   = userService;
     this.uploadService = uploadService;
     this._hosting      = he;
 }
Example #15
0
 public CFDIController(ApplicationDbContext context, IUpload upload, IWebHostEnvironment environment, IEmailSender emailSender)
 {
     _context     = context;
     _upload      = upload;
     _environment = environment;
     EmailSender  = emailSender;
 }
 public PlatformController(IPlatform platformService, IMail mailService, IUpload uploadService, IConfiguration configuration)
 {
     _platformService = platformService;
     _mailService     = mailService;
     _uploadService   = uploadService;
     _configuration   = configuration;
 }
Example #17
0
 public ForumController(IForum forumService, IPost postService, IUpload uploadService, IHostingEnvironment he)
 {
     this.forumService  = forumService;
     this.postService   = postService;
     this.uploadService = uploadService;
     this._hosting      = he;
 }
Example #18
0
        public void SetUpMocks()
        {
            var uploadMock = new Mock <IUpload>();

            uploadMock.Setup(upload => upload.GetTargetId()).Returns("constant-string");
            Upload = uploadMock.Object;
        }
Example #19
0
        public static IUpload GetInstance(string assemlyName, bool isFormat)
        {
            //IUpload upload = null;
            //try
            //{
            //    upload = (IUpload)Activator.CreateInstance(Type.GetType(string.Format("OceanCMS.Plugin.Upload.{0}.UtilUpload, OceanCMS.Plugin.Upload.{0}", assemlyName), false, true));
            //}
            //catch
            //{
            //    upload = new UtilUpload();
            //}
            if (!_instance.ContainsKey(assemlyName))
            {
                lock (lockHelper)
                {
                    if (!_instance.ContainsKey(assemlyName))
                    {
                        IUpload p = null;
                        try
                        {
                            p = (IUpload)Activator.CreateInstance(Type.GetType(string.Format("Ocean.Plugins.Upload.{0}.UtilUpload, Ocean.Plugins", assemlyName), false, true));
                        }
                        catch
                        {
                            p = new UtilUpload();
                        }
                        _instance.Add(assemlyName, p);
                    }
                }
            }
            IUpload upload = (IUpload)_instance[assemlyName];

            return(upload);
        }
Example #20
0
 public ApplicationUserService(IConfiguration configuration, ApplicationDbContext context, UserManager <ApplicationUser> userManager, IUpload uploadService)
 {
     _config                    = configuration;
     _context                   = context;
     _userManager               = userManager;
     _uploadService             = uploadService;
     AzureBlobStorageConnection = _config.GetConnectionString("AZURE_BLOB_STORAGE_USER_IMAGES");
 }
        public ProfileController(UserManager <ApplicationUser> userManager, IApplicationUser userService, IUpload uploadService, IConfiguration configService)
        {
            _userManager   = userManager;
            _userService   = userService;
            _uploadService = uploadService;             //For file upload handling, ex. profile pictures.

            _configuration = configService;
        }
Example #22
0
 public SettingService(ApplicationDbContext context,
                       IUpload upload,
                       IHostingEnvironment env)
 {
     _context = context;
     _upload  = upload;
     _env     = env;
 }
Example #23
0
 public ProfileController(UserManager <ApplicationUsers> userManager,
                          IApplicationUser userService,
                          IUpload uploadService)
 {
     _userManager   = userManager;
     _userService   = userService;
     _uploadService = uploadService;
 }
Example #24
0
        private BackgroundTransferContentPart CreateContentPart(IUpload upload, string fieldName)
        {
            var part = new BackgroundTransferContentPart(fieldName, $"{upload.Uploadable.Name}{upload.Uploadable.Extension}");

            part.SetHeader("Content-Type", upload.Uploadable.Source.GetContentType());
            part.SetFile(upload.Uploadable.Source.GetFile());
            return(part);
        }
Example #25
0
 public GameService(IConfiguration configuration, ApplicationDbContext context, IUserGame userGameServices, IUpload uploadService)
 {
     _config                    = configuration;
     _context                   = context;
     _userGameServices          = userGameServices;
     _uploadService             = uploadService;
     AzureBlobStorageConnection = _config.GetConnectionString("AZURE_BLOB_STORAGE_USER_IMAGES");
 }
Example #26
0
 public ForumControllerTest()
 {
     _forumService  = Substitute.For <IForum>();
     _postService   = Substitute.For <IPost>();
     _cofigService  = Substitute.For <IConfiguration>();
     _uploadService = Substitute.For <IUpload>();
     _controller    = new ForumController(_forumService, _postService, _cofigService, _uploadService);
 }
Example #27
0
        public async Task <IUploadBlock> UploadBlock(IUpload upload, int number, Stream stream)
        {
            var partRequest = new UploadPartRequest(client.Region, upload, number);

            partRequest.SetStream(stream);

            return(await client.UploadPartAsync(partRequest).ConfigureAwait(false));
        }
Example #28
0
 public HomeController(ILogger <HomeController> logger, ITransientInterface transientService, IScopedInterface scopedService, ISingeletonInterface singletonService, IUpload uploadService)
 {
     _logger           = logger;
     _transientService = transientService;
     _scopedService    = scopedService;
     _singletonService = singletonService;
     _uploadService    = uploadService;
 }
Example #29
0
 public ProfileController(UserManager <ApplicationUser> userManager,
                          IApplicationUser userService,
                          IUpload uploadService)
 {
     this.userManager   = userManager;
     this.userService   = userService;
     this.uploadService = uploadService;
 }
Example #30
0
 public ProfileController(UserManager <ApplicationUser> userManager, IApplicationUser userService, IUpload upload, IConfiguration configuration, IPost postService, ApplicationDbContext context)
 {
     _userManager   = userManager;
     _userService   = userService;
     _uploadService = upload;
     _configuration = configuration;
     _postService   = postService;
     _context       = context;
 }
Example #31
0
 public CommonController(IUpload upload)
 {
     this._upload = upload;
 }
Example #32
0
 public ScreenshotService()
 {
     upload = new Upload();
     repository = new ScreenshotRepository();
 }