Exemplo n.º 1
0
        public Task <ConfigUpdateRequest> UpdateCompatibilityAsync(String compatibility, String subject)
        {
            ConfigUpdateRequest request = new ConfigUpdateRequest();

            request.Compatibility = compatibility;
            return(UpdateConfigAsync(request, subject));
        }
Exemplo n.º 2
0
        public Task <ConfigUpdateRequest> UpdateConfigAsync(
            ConfigUpdateRequest configUpdateRequest,
            String subject)
        {
            var path = subject != null ? $"/config/{subject}" : "/config";

            return(DoRequestAsync <ConfigUpdateRequest>(path, HttpMethod.Put, new StringContent(configUpdateRequest.ToJson())));
        }
Exemplo n.º 3
0
        public BasicResponse <ConfigInfo> UpdateConfig(ConfigUpdateRequest configrequest)
        {
            var _config = ObjectConverter.Copy <ConfigInfo, ConfigModel>(configrequest.ConfigInfo);

            _Repository.UpdateConfig(_config);
            var configresponse = new BasicResponse <ConfigInfo>();

            configresponse.Data = ObjectConverter.Copy <ConfigModel, ConfigInfo>(_config);
            return(configresponse);
        }
 public void Update(ConfigUpdateRequest model)
 {
     DataProvider.ExecuteNonQuery("dbo.Config_UpdateById"
                                  , inputParamMapper : delegate(SqlParameterCollection paramCollection)
     {
         paramCollection.AddWithValue("@Id", model.Id);
         paramCollection.AddWithValue("@ConfigName", model.ConfigName);
         paramCollection.AddWithValue("@ConfigValue", model.ConfigValue);
         paramCollection.AddWithValue("@Description", model.Description);
         paramCollection.AddWithValue("@ConfigTypeId", model.ConfigTypeId);
         paramCollection.AddWithValue("@ConfigCategoryId", model.ConfigCategoryId);
         paramCollection.AddWithValue("@ModifiedBy", model.ModifiedBy);
     });
     //HttpContext.Current.Cache.Remove(model.ConfigName);
 }
 public HttpResponseMessage Update(ConfigUpdateRequest model)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
         }
         _configService.Update(model);
         return(Request.CreateResponse(HttpStatusCode.OK, new SuccessResponse()));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
Exemplo n.º 6
0
        string handleConfigUpdate(ConfigUpdateRequest req)
        {
            if (config.WorkerConfig.HostEndpoint.UseHost)
            {
                throw new InvalidOperationException("Can not update configuration when using Host as Url source!");
            }

            string error = "";

            try
            {
                // update configuration and save it
                config.WorkerConfig.Urls                           = req.SeedUrls;
                config.WorkerConfig.UserAgent                      = req.UserAgent;
                config.WorkerConfig.AcceptAllFiles                 = req.AllFiles;
                config.WorkerConfig.DomainWhitelist                = req.Whitelist;
                config.WorkerConfig.DomainBlacklist                = req.Blacklist;
                config.WorkerConfig.AcceptedExtensions             = req.Extensions;
                config.WorkerConfig.AcceptedMediaTypes             = req.MediaTypes;
                config.WorkerConfig.ScanTargetsMediaTypes          = req.ScanTargets;
                config.WorkerConfig.MaximumAllowedFileSizekB       = req.MaxSize;
                config.WorkerConfig.MinimumAllowedFileSizekB       = req.MinSize;
                config.WorkerConfig.DontCreateSubfolders           = req.DontCreateSubfolders;
                config.WorkerConfig.BlacklistedURLPatterns         = req.BlacklistedURLPatterns;
                config.WorkerConfig.URLMustMatchPattern            = req.URLPatterns;
                config.WorkerConfig.FilenameMustContainEither      = req.FilenameCriteria;
                config.WorkerConfig.RespectRobotsExclusionStandard = req.RespectRobots;
                ConfigManager.SaveConfiguration(ConfigManager.LastLoaded);

                // reload seed urls
                workManager.ReloadUrlSource();

                // send new work config to connected clients
                workerManager.UpdateWorkerConfigurations(config.WorkerConfig);
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }

            return(JsonConvert.SerializeObject(new
            {
                Success = string.IsNullOrEmpty(error),
                Error = error
            }));
        }
Exemplo n.º 7
0
        public BasicResponse <ConfigInfo> UpdateConfig(ConfigUpdateRequest configrequest)
        {
            var responseStr = HttpClientHelper.Post(Webapi + "/v1/Config/Update?token=" + Token, JSONHelper.ToJSONString(configrequest));

            return(JSONHelper.ParseJSONString <BasicResponse <ConfigInfo> >(responseStr));
        }
Exemplo n.º 8
0
 public BasicResponse <ConfigInfo> UpdateConfig(ConfigUpdateRequest configrequest)
 {
     return(_configService.UpdateConfig(configrequest));
 }