Esempio n. 1
0
        /// <summary>
        /// Initializes the RegisterForm and creates a new instance of UploadHandler
        /// </summary>
        /// <param name="login">A reference to the LoginForm</param>
        public RegisterForm(LoginForm login)
        {
            _loginForm = login;
            InitializeComponent();

            HideAllStatusLabels();
            _uploader = new UploadHandler();
        }
Esempio n. 2
0
 public UeditorService(UploadDBContext dbContext, INotSupportedHandler NotSupportedHandler, IConfigHandler configHandler, IUploadHandler uploadHandler, IEditorConfig editorConfig, IListFileHandler listFileHandler, ICrawlerHandler crawlerHandler)
 {
     this._notSupportedHandler = NotSupportedHandler;
     this._configHandler       = configHandler;
     this._uploadHandler       = uploadHandler;
     this._editorConfig        = editorConfig;
     this._listFileHandler     = listFileHandler;
     this._crawlerHandler      = crawlerHandler;
 }
Esempio n. 3
0
        public async Task <UploadResult> HandleUpload(string fileName, string contentType, Stream stream)
        {
            IUploadHandler handler = _fileUploadHandlers.FirstOrDefault(c => c.IsValid(fileName, contentType));

            if (handler == null)
            {
                return(null);
            }

            return(await handler.UploadFile(fileName, contentType, stream));
        }
Esempio n. 4
0
 public AccountController(
     ISecurityRepository securityRepository,
     IUserRepository userRepository,
     IUploadHandler uploadHandler,
     IFileManager fileManager)
 {
     _securityRepository = securityRepository;
     _fileManager = fileManager;
     _uploadHandler = uploadHandler;
     _userRepository = userRepository;
 }
Esempio n. 5
0
 public IssuesController(IUserAuthHelper userSessionHelper,
                         IProjectManager projectManager, IIssueManager issueManager,
                         ITeamManager teamManager, IUploadHandler uploadHandler,
                         IUploadManager uploadManager, IUrlHelperFactory urlHelperFactory, IActionContextAccessor actionContextAccessor) //: base(repositary)
 {
     this.issueManager      = issueManager;
     this.projectManager    = projectManager;
     this.userSessionHelper = userSessionHelper;
     this.teamManager       = teamManager;
     this.uploadHandler     = uploadHandler;
     this.uploadManager     = uploadManager;
     this.urlHelper         = urlHelperFactory.GetUrlHelper(actionContextAccessor.ActionContext);
 }
        public IssuesController(IUserAuthHelper userSessionHelper,
                                IProjectManager projectManager, IIssueManager issueManager,
                                ITeamManager teamManager, IUploadHandler uploadHandler,
                                IUploadManager uploadManager, IUrlHelperFactory urlHelperFactory, IActionContextAccessor actionContextAccessor, IOptions <AppSettings> settings) : base(settings)
        {
            this._issueManager      = issueManager;
            this._projectManager    = projectManager;
            this._userSessionHelper = userSessionHelper;
            this._teamManager       = teamManager;
            this._uploadHandler     = uploadHandler;
            this._uploadManager     = uploadManager;

            this._urlHelper = urlHelperFactory.GetUrlHelper(actionContextAccessor.ActionContext);
        }
        public IssuesController(IUserAuthHelper userSessionHelper,
            IProjectManager projectManager, IIssueManager issueManager,
            ITeamManager teamManager, IUploadHandler uploadHandler,
            IUploadManager uploadManager, IUrlHelperFactory urlHelperFactory, IActionContextAccessor actionContextAccessor) //: base(repositary)
        {
            this._issueManager = issueManager;
            this._projectManager = projectManager;
            this._userSessionHelper = userSessionHelper;
            this._teamManager = teamManager;
            this._uploadHandler = uploadHandler;
            this._uploadManager = uploadManager;
            this._urlHelper = urlHelperFactory.GetUrlHelper(actionContextAccessor.ActionContext);

        }
Esempio n. 8
0
        public async Task <UploadResult> HandleUpload(string fileName, string contentType, Stream stream, long contentLength)
        {
            var settings = _kernel.Get <ApplicationSettings>();

            if (contentLength > settings.MaxFileUploadBytes)
            {
                return(null);
            }

            IUploadHandler handler = _fileUploadHandlers.FirstOrDefault(c => c.IsValid(fileName, contentType));

            if (handler == null)
            {
                return(null);
            }

            return(await handler.UploadFile(fileName, contentType, stream));
        }
Esempio n. 9
0
        public async Task <UploadResult> HandleUpload(string fileName, string contentType, Stream stream, long contentLength)
        {
            var settings = _kernel.Get <ApplicationSettings>();

            if (contentLength > settings.MaxFileUploadBytes)
            {
                return(new UploadResult {
                    UploadTooLarge = true, MaxUploadSize = settings.MaxFileUploadBytes
                });
            }

            string fileNameSlug = fileName.ToFileNameSlug();

            IUploadHandler handler = _fileUploadHandlers.FirstOrDefault(c => c.IsValid(fileNameSlug, contentType));

            if (handler == null)
            {
                return(null);
            }

            return(await handler.UploadFile(fileNameSlug, contentType, stream));
        }
        public PowerShellResults ProcessFileUploadRequest(HttpContext httpContext)
        {
            HttpPostedFile httpPostedFile = httpContext.Request.Files["uploadFile"];

            if (httpPostedFile != null && !string.IsNullOrEmpty(httpPostedFile.FileName) && httpPostedFile.ContentLength > 0)
            {
                string         text          = httpContext.Request.Form["handlerClass"];
                IUploadHandler uploadHandler = this.CreateInstance(text);
                if (httpPostedFile.ContentLength <= uploadHandler.MaxFileSize)
                {
                    string            text2   = httpContext.Request.Form["parameters"];
                    object            obj     = text2.JsonDeserialize(uploadHandler.SetParameterType, null);
                    UploadFileContext context = new UploadFileContext(httpPostedFile.FileName, httpPostedFile.InputStream);
                    try
                    {
                        EcpEventLogConstants.Tuple_UploadRequestStarted.LogEvent(new object[]
                        {
                            EcpEventLogExtensions.GetUserNameToLog(),
                            text,
                            text2
                        });
                        return(uploadHandler.ProcessUpload(context, (WebServiceParameters)obj));
                    }
                    finally
                    {
                        EcpEventLogConstants.Tuple_UploadRequestCompleted.LogEvent(new object[]
                        {
                            EcpEventLogExtensions.GetUserNameToLog()
                        });
                    }
                }
                ByteQuantifiedSize byteQuantifiedSize = new ByteQuantifiedSize((ulong)((long)uploadHandler.MaxFileSize));
                throw new HttpException(Strings.FileExceedsLimit(byteQuantifiedSize.ToString()));
            }
            throw new HttpException(Strings.UploadFileCannotBeEmpty);
        }
        /// <summary>
        /// Updates all relevant information in the form.
        /// </summary>
        private void UpdateInfo()
        {
            usernameBox.Text  = _user.Username;
            firstnameBox.Text = _user.Firstname;
            lastnameBox.Text  = _user.Lastname;
            phoneBox.Text     = _user.Phone;
            emailBox.Text     = _user.Email;
            addressBox.Text   = _user.Address;
            zipBox.Text       = _user.Zip;
            cityBox.Text      = _user.City;

            if (!string.IsNullOrEmpty(_user.PicturePath))
            {
                pictureBox.Load(_user.PicturePath);
            }
            else
            {
                pictureBox.Image = Resources.avataricon;
            }

            if (!string.IsNullOrEmpty(_user.SignaturePath))
            {
                signatureBox.Load(_user.SignaturePath);
            }

            if (Session.LoggedInUser.Sysmin)
            {
                instructorCheckBox.Visible = true;
                if (_user.Sysmin)
                {
                    instructorCheckBox.Checked = true;
                }
            }

            uploader = new UploadHandler();
        }
Esempio n. 12
0
 public UploadValidationDecorator(
     IEnumerable <IValidator <TUpload> > validators,
     IUploadHandler <TUpload, TResult> inner)
     : base(validators, inner)
 {
 }
 /// <summary>
 /// Initialises a new instance of the <see cref="HomeController" /> class.
 /// </summary>
 ///
 /// <param name="logger"> The logger. </param>
 /// <param name="materialHandler"> The Material service handler. </param>
 /// <param name="packHandler"> The Pack service handler. </param>
 /// <param name="planHandler"> The Plan service handler. </param>
 /// <param name="uploadHandler"> The Upload service handler. </param>
 /// <param name="drawHandler"> The Draw service handler. </param>
 public HomeController(ILogger <HomeController> logger, DbServiceHandler <PackIt.Material.Material> materialHandler, DbServiceHandler <PackIt.Pack.Pack> packHandler, DbServiceHandler <PackIt.Plan.Plan> planHandler, IUploadHandler uploadHandler, Packs.DTO.DrawHandler drawHandler)
 {
     this.logger   = logger;
     this.services = new()
     {
         { "Materials", materialHandler },
         { "Packs", packHandler },
Esempio n. 14
0
 public UploadPostprocessingDecorator(
     IUploadHandler <TUpload, TResult> inner,
     IEnumerable <IPostprocessor <TUpload, TResult> > postprocessors)
     : base(inner, postprocessors)
 {
 }
Esempio n. 15
0
 public UploadPreprocessingDecorator(
     IEnumerable <IPreprocessor <TUpload> > preprocessors,
     IUploadHandler <TUpload, TResult> inner)
     : base(preprocessors, inner)
 {
 }
Esempio n. 16
0
 public TipsController(ITipRepository tipRepository, IUploadHandler uploadHandler, IFileManager fileManager)
 {
     _tipRepository = tipRepository;
     _uploadHandler = uploadHandler;
     _fileManager = fileManager;
 }