Example #1
0
        public virtual FileUploadServiceClient GetFileUploadWebService(TblFileServers fileServer)
        {
            var binding = new BasicHttpBinding()
            {
                Security =
                {
                    Mode    = BasicHttpSecurityMode.TransportWithMessageCredential,
                    Message =
                    {
                        ClientCredentialType = BasicHttpMessageCredentialType.UserName,
                        AlgorithmSuite       = SecurityAlgorithmSuite.Default
                    }
                },
                AllowCookies           = true,
                MaxReceivedMessageSize = 100000000,
                MaxBufferPoolSize      = 100000000,
                MessageEncoding        = WSMessageEncoding.Mtom,
                ReaderQuotas           = { MaxArrayLength = 100000000, MaxStringContentLength = 100000000, MaxDepth = 32 }
            };

            binding.OpenTimeout      = binding.ReceiveTimeout =
                binding.CloseTimeout = binding.SendTimeout = TimeSpan.FromSeconds(25);

            var endPoint =
                new EndpointAddress(fileServer.FileUploadServerUrl);
            var uploadWebService = new FileUploadServiceClient(binding, endPoint);

            if (uploadWebService.ClientCredentials != null)
            {
                uploadWebService.ClientCredentials.UserName.UserName = fileServer.ServiceUserName;
                uploadWebService.ClientCredentials.UserName.Password = fileServer.ServicePassword;
            }

            return(uploadWebService);
        }
Example #2
0
        public virtual FileManagerServiceClient GetWebService(TblFileServers fileServer)
        {
            var binding = new WSHttpBinding
            {
                Security =
                {
                    Mode    = SecurityMode.TransportWithMessageCredential,
                    Message =
                    {
                        ClientCredentialType     = MessageCredentialType.UserName,
                        EstablishSecurityContext = false
                    }
                },
                AllowCookies           = true,
                MaxReceivedMessageSize = 100000000,
                MaxBufferPoolSize      = 100000000,
                ReaderQuotas           = { MaxArrayLength = 100000000, MaxStringContentLength = 100000000, MaxDepth = 32 }
            };

            binding.OpenTimeout      = binding.ReceiveTimeout =
                binding.CloseTimeout = binding.SendTimeout = TimeSpan.FromSeconds(25);

            var endPoint    = new EndpointAddress(fileServer.FileServerUrl);
            var fileManager = new FileManagerServiceClient(binding, endPoint);

            if (fileManager.ClientCredentials != null)
            {
                fileManager.ClientCredentials.UserName.UserName = fileServer.ServiceUserName;
                fileManager.ClientCredentials.UserName.Password = fileServer.ServicePassword;
            }

            return(fileManager);
        }
Example #3
0
        public virtual async Task UpdateAsync(TblFileServers record)
        {
            var oldRecord = await FindByIdAsync(record.Id);

            _dbContext.FileServers.AddOrUpdate(record);
            await _dbContext.SaveChangesAsync();

            QueryCacheManager.ExpireTag(CacheTags.FileServer);

            _eventPublisher.EntityUpdated(record, oldRecord);
        }
Example #4
0
        public virtual async Task <int> AddAsync(TblFileServers record)
        {
            _dbContext.FileServers.Add(record);
            await _dbContext.SaveChangesAsync();

            QueryCacheManager.ExpireTag(CacheTags.FileServer);

            _eventPublisher.EntityInserted(record);

            return(record.Id);
        }
Example #5
0
        public virtual FileServerModel PrepareFileServerModel(TblFileServers fileServer)
        {
            var result = fileServer == null ? new FileServerModel() : fileServer.Adapt <FileServerModel>();

            return(result);
        }