Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/20/12 13:00:30 (12 years ago)
Author:
fschoepp
Message:

#1888:

  • Web project now creates custom html for each type we want to enter / display
  • Added endpointConfigurationName to HiveServiceLocator (because Web Project contains more than one endpoint configuration)
  • Removed logging statement from ConfigurationService to prevent exception during failure of loading ConfigurationSettings
  • ApplicationManager: Changed default implementation to WebApplicationManager (instead of LightWeight) for testing purposes within Web Project
  • WebApplicationManager: The application manager which returns plugin descriptors from the currently loaded assemblies (instead of LightweightAppManager)
  • HiveService: Fixed a transaction bug
  • IControllerService: Created a method to dispatch Scenarios to certain IScenarioManager (in this case HiveScenarioManager)
  • Added more mappable types to ControllerModel
  • PlaceholderControllerService dispatches all Scenarios to the HiveScenarioManager
  • Web project now dispatches the scenario to the controller after pressing "Run Job"
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Models/OptimizationModels.cs

    r8384 r8506  
    77
    88namespace HeuristicLab.Services.Optimization.Web.Models {
    9   public class OptimizationModelBinder : IModelBinder {
     9
     10  public class ProblemParametersModelBinder : IModelBinder {
    1011    public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) {
    11       var scenario = new Optimization.ControllerService.Model.OptimizationScenario();
     12      var scenario = controllerContext.HttpContext.Session["scenario"] as OptimizationScenario;
    1213      foreach (var key in controllerContext.RequestContext.HttpContext.Request.Form.AllKeys) {
    13         var value = bindingContext.ValueProvider.GetValue(key);       
    14         scenario.InputParameters.Add(new HeuristicLab.Services.Optimization.ControllerService.Model.Parameter() { });
     14        var value = bindingContext.ValueProvider.GetValue(key);
     15        string realKey = key;
     16        string realValue = value.AttemptedValue;
     17
     18        if (key.Contains("_")) {
     19          var tableEntry = key.Split('_');
     20          realKey = tableEntry[0];
     21          //var param2 = (from par in scenario.InputParameters.Items where par.Name == tableEntry[0] select par).FirstOrDefault();
     22          realValue = "";
     23          for (int i = 1; i < tableEntry.Length; i++) {
     24            realValue += tableEntry[i] + ":";
     25          }
     26          realValue += value.AttemptedValue;
     27        }
     28        var param = (from par in scenario.InputParameters.Items where par.Value.Name == realKey select par).FirstOrDefault();
     29        if (!param.Value.TrySetFromString(realValue)) {
     30          bindingContext.ModelState.AddModelError(bindingContext.ModelName, new Exception(string.Format("Unable to parse {0} into destination type {1}", value, param.Type)));
     31        }
    1532      }
    16       return new Optimization.ControllerService.Model.OptimizationScenario();
     33      return scenario.InputParameters;
     34    }
     35  }
     36
     37  public class AlgorithmParametersModelBinder : IModelBinder {
     38    public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) {
     39      var scenario = controllerContext.HttpContext.Session["scenario"] as OptimizationScenario;
     40      foreach (var key in controllerContext.RequestContext.HttpContext.Request.Form.AllKeys) {
     41        var value = bindingContext.ValueProvider.GetValue(key);
     42        var param = (from par in scenario.AlgorithmParameters.Items where par.Value.Name == key select par).FirstOrDefault();
     43        if (!param.Value.TrySetFromString(value.AttemptedValue)) {
     44          bindingContext.ModelState.AddModelError(bindingContext.ModelName, new Exception(string.Format("Unable to parse {0} into destination type {1}", value, param.Type)));
     45        }
     46      }
     47      return scenario.AlgorithmParameters;
    1748    }
    1849  }
Note: See TracChangeset for help on using the changeset viewer.