Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4566


Ignore:
Timestamp:
10/07/10 01:49:31 (14 years ago)
Author:
swagner
Message:

Worked on OKB (#1174)

Location:
branches/OKB
Files:
9 added
10 edited

Legend:

Unmodified
Added
Removed
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/HeuristicLab.Clients.OKB-3.3.csproj

    r4553 r4566  
    8989    <Compile Include="ServiceClients\AuthenticationServiceClient.cs" />
    9090    <Compile Include="ServiceClients\AlgorithmData.cs" />
     91    <Compile Include="ServiceClients\AlgorithmParameter.cs" />
     92    <Compile Include="ServiceClients\Result.cs" />
     93    <Compile Include="ServiceClients\ProblemParameter.cs" />
    9194    <Compile Include="ServiceClients\OKBServiceClient.cs" />
    9295    <Compile Include="ServiceClients\ProblemData.cs" />
     
    134137    <Compile Include="Views\AlgorithmDataView.Designer.cs">
    135138      <DependentUpon>AlgorithmDataView.cs</DependentUpon>
     139    </Compile>
     140    <Compile Include="Views\AlgorithmParameterCollectionView.cs">
     141      <SubType>UserControl</SubType>
     142    </Compile>
     143    <Compile Include="Views\AlgorithmParameterCollectionView.Designer.cs">
     144      <DependentUpon>AlgorithmParameterCollectionView.cs</DependentUpon>
     145    </Compile>
     146    <Compile Include="Views\ResultCollectionView.cs">
     147      <SubType>UserControl</SubType>
     148    </Compile>
     149    <Compile Include="Views\ResultCollectionView.Designer.cs">
     150      <DependentUpon>ResultCollectionView.cs</DependentUpon>
     151    </Compile>
     152    <Compile Include="Views\ProblemParameterCollectionView.cs">
     153      <SubType>UserControl</SubType>
     154    </Compile>
     155    <Compile Include="Views\ProblemParameterCollectionView.Designer.cs">
     156      <DependentUpon>ProblemParameterCollectionView.cs</DependentUpon>
    136157    </Compile>
    137158    <Compile Include="Views\OKBExperimentView.cs">
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/OKBClient.cs

    r4559 r4566  
    2727using HeuristicLab.Common;
    2828using HeuristicLab.Core;
     29using HeuristicLab.Data;
    2930using HeuristicLab.Optimization;
    3031using HeuristicLab.PluginInfrastructure;
     
    133134          else if (item is Algorithm)
    134135            item.Id = CallAdminService<long>(s => s.AddAlgorithm((Algorithm)item));
     136          else if (item is AlgorithmParameter)
     137            item.Id = CallAdminService<long>(s => s.AddAlgorithmParameter((AlgorithmParameter)item));
    135138          else if (item is ProblemClass)
    136139            item.Id = CallAdminService<long>(s => s.AddProblemClass((ProblemClass)item));
    137140          else if (item is Problem)
    138141            item.Id = CallAdminService<long>(s => s.AddProblem((Problem)item));
     142          else if (item is ProblemParameter)
     143            item.Id = CallAdminService<long>(s => s.AddProblemParameter((ProblemParameter)item));
     144          else if (item is Result)
     145            item.Id = CallAdminService<long>(s => s.AddResult((Result)item));
    139146        } else {
    140147          if (item is Platform)
     
    146153          else if (item is Algorithm)
    147154            CallAdminService(s => s.UpdateAlgorithm((Algorithm)item));
     155          else if (item is AlgorithmParameter)
     156            CallAdminService(s => s.UpdateAlgorithmParameter((AlgorithmParameter)item));
    148157          else if (item is ProblemClass)
    149158            CallAdminService(s => s.UpdateProblemClass((ProblemClass)item));
    150159          else if (item is Problem)
    151160            CallAdminService(s => s.UpdateProblem((Problem)item));
     161          else if (item is ProblemParameter)
     162            CallAdminService(s => s.UpdateProblemParameter((ProblemParameter)item));
     163          else if (item is Result)
     164            CallAdminService(s => s.UpdateResult((Result)item));
    152165        }
    153166        return true;
     
    158171      }
    159172    }
    160     public bool Store(long algorithmId, long probleId, Run run) {
    161       return true;
    162     }
     173    public bool Store(long algorithmId, long problemId, Run run) {
     174      try {
     175        IAlgorithm algorithm = run.Algorithm;
     176        IProblem problem = algorithm.Problem;
     177
     178        ItemCollection<AlgorithmParameter> algorithmParameters = GetAlgorithmParameters(algorithmId);
     179        AddAlgorithmParamters(algorithmId, algorithmParameters, algorithm, "");
     180        ItemCollection<ProblemParameter> problemParameters = GetProblemParameters(problemId);
     181        AddProblemParamters(problemId, problemParameters, problem, "");
     182
     183        return true;
     184      }
     185      catch (Exception ex) {
     186        ErrorHandling.ShowErrorDialog("Store run failed.", ex);
     187        return false;
     188      }
     189    }
     190
     191    private void AddAlgorithmParamters(long algorithmId, ItemCollection<AlgorithmParameter> parameters, IParameterizedItem item, string prefix) {
     192      foreach (IValueParameter param in item.Parameters.OfType<IValueParameter>()) {
     193        if (param.GetsCollected && (param.Value != null) && (parameters.FirstOrDefault(x => x.Name == param.Name) == null)) {
     194          AlgorithmParameter p = new AlgorithmParameter();
     195          p.Name = prefix + param.Name;
     196          p.Alias = prefix + param.Name;
     197          p.Description = param.Description;
     198          p.AlgorithmId = algorithmId;
     199          p.DataTypeId = GetDataType(param.DataType).Id;
     200          p.Store();
     201          parameters.Add(p);
     202        }
     203        if (param.Value is IParameterizedItem)
     204          AddAlgorithmParamters(algorithmId, parameters, (IParameterizedItem)param.Value, (string.IsNullOrEmpty(prefix) ? param.Name : prefix + param.Name) + ".");
     205      }
     206    }
     207    private void AddProblemParamters(long problemId, ItemCollection<ProblemParameter> parameters, IParameterizedItem item, string prefix) {
     208      foreach (IValueParameter param in item.Parameters.OfType<IValueParameter>()) {
     209        if (param.GetsCollected && (param.Value != null) && (parameters.FirstOrDefault(x => x.Name == param.Name) == null)) {
     210          ProblemParameter p = new ProblemParameter();
     211          p.Name = prefix + param.Name;
     212          p.Alias = prefix + param.Name;
     213          p.Description = param.Description;
     214          p.ProblemId = problemId;
     215          p.DataTypeId = GetDataType(param.DataType).Id;
     216          p.Store();
     217          parameters.Add(p);
     218        }
     219        if (param.Value is IParameterizedItem)
     220          AddProblemParamters(problemId, parameters, (IParameterizedItem)param.Value, (string.IsNullOrEmpty(prefix) ? param.Name : prefix + param.Name) + ".");
     221      }
     222    }
     223
     224    public DataType GetDataType(Type type) {
     225      DataType dataType = DataTypes.FirstOrDefault(x => x.Name == type.AssemblyQualifiedName);
     226      if (dataType == null) {
     227        dataType = new DataType();
     228        dataType.Name = type.AssemblyQualifiedName;
     229        dataType.PlatformId = Platforms.FirstOrDefault(x => x.Name == "HeuristicLab 3.3").Id;
     230
     231        if (typeof(BoolValue).IsAssignableFrom(type))
     232          dataType.SqlName = "bit";
     233        else if (typeof(IntValue).IsAssignableFrom(type))
     234          dataType.SqlName = "bigint";
     235        else if (typeof(DoubleValue).IsAssignableFrom(type))
     236          dataType.SqlName = "float";
     237        else if (typeof(StringValue).IsAssignableFrom(type) || typeof(IStringConvertibleValue).IsAssignableFrom(type))
     238          dataType.SqlName = "nvarchar";
     239        else
     240          dataType.SqlName = "varbinary";
     241
     242        dataType.Store();
     243        DataTypes.Add(dataType);
     244      }
     245      return dataType;
     246    }
     247
    163248    #endregion
    164249
     
    202287      }
    203288    }
     289    public ItemCollection<AlgorithmParameter> GetAlgorithmParameters(long algorithmId) {
     290      try {
     291        ItemCollection<AlgorithmParameter> parameters = new ItemCollection<AlgorithmParameter>();
     292        parameters.AddRange(CallAdminService<AlgorithmParameter[]>(s => s.GetAlgorithmParameters(algorithmId)).OrderBy(x => x.Name));
     293        return parameters;
     294      }
     295      catch (Exception ex) {
     296        ErrorHandling.ShowErrorDialog("Refresh algorithm parameters failed.", ex);
     297        return null;
     298      }
     299    }
     300    public ItemCollection<Result> GetResults(long algorithmId) {
     301      try {
     302        ItemCollection<Result> results = new ItemCollection<Result>();
     303        results.AddRange(CallAdminService<Result[]>(s => s.GetResults(algorithmId)).OrderBy(x => x.Name));
     304        return results;
     305      }
     306      catch (Exception ex) {
     307        ErrorHandling.ShowErrorDialog("Refresh results failed.", ex);
     308        return null;
     309      }
     310    }
    204311    #endregion
    205312
     
    241348        ErrorHandling.ShowErrorDialog("Update problem data failed.", ex);
    242349        return false;
     350      }
     351    }
     352    public ItemCollection<ProblemParameter> GetProblemParameters(long problemId) {
     353      try {
     354        ItemCollection<ProblemParameter> parameters = new ItemCollection<ProblemParameter>();
     355        parameters.AddRange(CallAdminService<ProblemParameter[]>(s => s.GetProblemParameters(problemId)).OrderBy(x => x.Name));
     356        return parameters;
     357      }
     358      catch (Exception ex) {
     359        ErrorHandling.ShowErrorDialog("Refresh problem parameters failed.", ex);
     360        return null;
    243361      }
    244362    }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/OKBExperiment.cs

    r4559 r4566  
    171171            using (MemoryStream stream = new MemoryStream(algorithmData.Data)) {
    172172              Algorithm = XmlParser.Deserialize<IAlgorithm>(stream);
     173              Algorithm.StoreAlgorithmInEachRun = true;
    173174            }
    174175          }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/ServiceClients/Algorithm.cs

    r4492 r4566  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324
     
    3031      AlgorithmClassId = 1;
    3132    }
     33
     34    public override IDeepCloneable Clone(Cloner cloner) {
     35      Algorithm clone = (Algorithm)base.Clone(cloner);
     36      clone.PlatformId = PlatformId;
     37      clone.AlgorithmClassId = AlgorithmClassId;
     38      return clone;
     39    }
    3240  }
    3341}
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/ServiceClients/DataType.cs

    r4492 r4566  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324
     
    3132    }
    3233
     34    public override IDeepCloneable Clone(Cloner cloner) {
     35      DataType clone = (DataType)base.Clone(cloner);
     36      clone.Name = Name;
     37      clone.SqlName = SqlName;
     38      clone.PlatformId = PlatformId;
     39      return clone;
     40    }
     41
    3342    public override string ToString() {
    3443      return Name;
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/ServiceClients/OKBItem.cs

    r4549 r4566  
    7777      OKBItem clone = (OKBItem)Activator.CreateInstance(this.GetType(), true);
    7878      cloner.RegisterClonedObject(this, clone);
    79       //      clone.Id = Id;
    8079      return clone;
    8180    }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/ServiceClients/OKBServiceClient.cs

    r4548 r4566  
    1010
    1111namespace HeuristicLab.Clients.OKB {
    12 
    13 
    14   [System.Diagnostics.DebuggerStepThroughAttribute()]
    15   [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    16   [System.Runtime.Serialization.DataContractAttribute(Name = "ProblemClass", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")]
    17   public partial class ProblemClass : HeuristicLab.Clients.OKB.NamedOKBItem {
    18   }
     12  using System.Runtime.Serialization;
     13
    1914
    2015  [System.Diagnostics.DebuggerStepThroughAttribute()]
     
    2318  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.DataType))]
    2419  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.NamedOKBItem))]
     20  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.AlgorithmParameter))]
     21  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.ProblemClass))]
    2522  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.Problem))]
     23  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.ProblemParameter))]
    2624  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.Platform))]
    2725  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.AlgorithmClass))]
    2826  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.Algorithm))]
    29   [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.ProblemClass))]
     27  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.Result))]
    3028  public partial class OKBItem : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {
    3129
     
    113111  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    114112  [System.Runtime.Serialization.DataContractAttribute(Name = "NamedOKBItem", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")]
     113  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.AlgorithmParameter))]
     114  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.ProblemClass))]
    115115  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.Problem))]
     116  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.ProblemParameter))]
    116117  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.Platform))]
    117118  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.AlgorithmClass))]
    118119  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.Algorithm))]
    119   [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.ProblemClass))]
     120  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.Result))]
    120121  public partial class NamedOKBItem : HeuristicLab.Clients.OKB.OKBItem {
    121122
     
    153154  [System.Diagnostics.DebuggerStepThroughAttribute()]
    154155  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
     156  [System.Runtime.Serialization.DataContractAttribute(Name = "AlgorithmParameter", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")]
     157  public partial class AlgorithmParameter : HeuristicLab.Clients.OKB.NamedOKBItem {
     158
     159    private long AlgorithmIdField;
     160
     161    private string AliasField;
     162
     163    private long DataTypeIdField;
     164
     165    [System.Runtime.Serialization.DataMemberAttribute()]
     166    public long AlgorithmId {
     167      get {
     168        return this.AlgorithmIdField;
     169      }
     170      set {
     171        if ((this.AlgorithmIdField.Equals(value) != true)) {
     172          this.AlgorithmIdField = value;
     173          this.RaisePropertyChanged("AlgorithmId");
     174        }
     175      }
     176    }
     177
     178    [System.Runtime.Serialization.DataMemberAttribute()]
     179    public string Alias {
     180      get {
     181        return this.AliasField;
     182      }
     183      set {
     184        if ((object.ReferenceEquals(this.AliasField, value) != true)) {
     185          this.AliasField = value;
     186          this.RaisePropertyChanged("Alias");
     187        }
     188      }
     189    }
     190
     191    [System.Runtime.Serialization.DataMemberAttribute()]
     192    public long DataTypeId {
     193      get {
     194        return this.DataTypeIdField;
     195      }
     196      set {
     197        if ((this.DataTypeIdField.Equals(value) != true)) {
     198          this.DataTypeIdField = value;
     199          this.RaisePropertyChanged("DataTypeId");
     200        }
     201      }
     202    }
     203  }
     204
     205  [System.Diagnostics.DebuggerStepThroughAttribute()]
     206  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
     207  [System.Runtime.Serialization.DataContractAttribute(Name = "ProblemClass", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")]
     208  public partial class ProblemClass : HeuristicLab.Clients.OKB.NamedOKBItem {
     209  }
     210
     211  [System.Diagnostics.DebuggerStepThroughAttribute()]
     212  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    155213  [System.Runtime.Serialization.DataContractAttribute(Name = "Problem", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")]
    156214  public partial class Problem : HeuristicLab.Clients.OKB.NamedOKBItem {
     
    189247  [System.Diagnostics.DebuggerStepThroughAttribute()]
    190248  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
     249  [System.Runtime.Serialization.DataContractAttribute(Name = "ProblemParameter", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")]
     250  public partial class ProblemParameter : HeuristicLab.Clients.OKB.NamedOKBItem {
     251
     252    private string AliasField;
     253
     254    private long DataTypeIdField;
     255
     256    private long ProblemIdField;
     257
     258    [System.Runtime.Serialization.DataMemberAttribute()]
     259    public string Alias {
     260      get {
     261        return this.AliasField;
     262      }
     263      set {
     264        if ((object.ReferenceEquals(this.AliasField, value) != true)) {
     265          this.AliasField = value;
     266          this.RaisePropertyChanged("Alias");
     267        }
     268      }
     269    }
     270
     271    [System.Runtime.Serialization.DataMemberAttribute()]
     272    public long DataTypeId {
     273      get {
     274        return this.DataTypeIdField;
     275      }
     276      set {
     277        if ((this.DataTypeIdField.Equals(value) != true)) {
     278          this.DataTypeIdField = value;
     279          this.RaisePropertyChanged("DataTypeId");
     280        }
     281      }
     282    }
     283
     284    [System.Runtime.Serialization.DataMemberAttribute()]
     285    public long ProblemId {
     286      get {
     287        return this.ProblemIdField;
     288      }
     289      set {
     290        if ((this.ProblemIdField.Equals(value) != true)) {
     291          this.ProblemIdField = value;
     292          this.RaisePropertyChanged("ProblemId");
     293        }
     294      }
     295    }
     296  }
     297
     298  [System.Diagnostics.DebuggerStepThroughAttribute()]
     299  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    191300  [System.Runtime.Serialization.DataContractAttribute(Name = "Platform", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")]
    192301  public partial class Platform : HeuristicLab.Clients.OKB.NamedOKBItem {
     
    230339          this.PlatformIdField = value;
    231340          this.RaisePropertyChanged("PlatformId");
     341        }
     342      }
     343    }
     344  }
     345
     346  [System.Diagnostics.DebuggerStepThroughAttribute()]
     347  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
     348  [System.Runtime.Serialization.DataContractAttribute(Name = "Result", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")]
     349  public partial class Result : HeuristicLab.Clients.OKB.NamedOKBItem {
     350
     351    private long AlgorithmIdField;
     352
     353    private string AliasField;
     354
     355    private long DataTypeIdField;
     356
     357    [System.Runtime.Serialization.DataMemberAttribute()]
     358    public long AlgorithmId {
     359      get {
     360        return this.AlgorithmIdField;
     361      }
     362      set {
     363        if ((this.AlgorithmIdField.Equals(value) != true)) {
     364          this.AlgorithmIdField = value;
     365          this.RaisePropertyChanged("AlgorithmId");
     366        }
     367      }
     368    }
     369
     370    [System.Runtime.Serialization.DataMemberAttribute()]
     371    public string Alias {
     372      get {
     373        return this.AliasField;
     374      }
     375      set {
     376        if ((object.ReferenceEquals(this.AliasField, value) != true)) {
     377          this.AliasField = value;
     378          this.RaisePropertyChanged("Alias");
     379        }
     380      }
     381    }
     382
     383    [System.Runtime.Serialization.DataMemberAttribute()]
     384    public long DataTypeId {
     385      get {
     386        return this.DataTypeIdField;
     387      }
     388      set {
     389        if ((this.DataTypeIdField.Equals(value) != true)) {
     390          this.DataTypeIdField = value;
     391          this.RaisePropertyChanged("DataTypeId");
    232392        }
    233393      }
     
    381541  public interface IOKBService {
    382542
     543    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/AddResult", ReplyAction = "http://tempuri.org/IOKBService/AddResultResponse")]
     544    long AddResult(HeuristicLab.Clients.OKB.Result dto);
     545
     546    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/UpdateResult", ReplyAction = "http://tempuri.org/IOKBService/UpdateResultResponse")]
     547    void UpdateResult(HeuristicLab.Clients.OKB.Result dto);
     548
     549    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/DeleteResult", ReplyAction = "http://tempuri.org/IOKBService/DeleteResultResponse")]
     550    void DeleteResult(long id);
     551
     552    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/GetAlgorithmParameters", ReplyAction = "http://tempuri.org/IOKBService/GetAlgorithmParametersResponse")]
     553    HeuristicLab.Clients.OKB.AlgorithmParameter[] GetAlgorithmParameters(long algorithmId);
     554
     555    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/AddAlgorithmParameter", ReplyAction = "http://tempuri.org/IOKBService/AddAlgorithmParameterResponse")]
     556    long AddAlgorithmParameter(HeuristicLab.Clients.OKB.AlgorithmParameter dto);
     557
     558    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/UpdateAlgorithmParameter", ReplyAction = "http://tempuri.org/IOKBService/UpdateAlgorithmParameterResponse")]
     559    void UpdateAlgorithmParameter(HeuristicLab.Clients.OKB.AlgorithmParameter dto);
     560
     561    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/DeleteAlgorithmParameter", ReplyAction = "http://tempuri.org/IOKBService/DeleteAlgorithmParameterResponse")]
     562    void DeleteAlgorithmParameter(long id);
     563
     564    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/GetProblemClass", ReplyAction = "http://tempuri.org/IOKBService/GetProblemClassResponse")]
     565    HeuristicLab.Clients.OKB.ProblemClass GetProblemClass(long id);
     566
    383567    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/GetProblemClasses", ReplyAction = "http://tempuri.org/IOKBService/GetProblemClassesResponse")]
    384568    HeuristicLab.Clients.OKB.ProblemClass[] GetProblemClasses();
     
    420604    void UpdateProblemData(HeuristicLab.Clients.OKB.ProblemData dto);
    421605
     606    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/GetProblemParameter", ReplyAction = "http://tempuri.org/IOKBService/GetProblemParameterResponse")]
     607    HeuristicLab.Clients.OKB.ProblemParameter GetProblemParameter(long id);
     608
     609    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/GetProblemParameters", ReplyAction = "http://tempuri.org/IOKBService/GetProblemParametersResponse")]
     610    HeuristicLab.Clients.OKB.ProblemParameter[] GetProblemParameters(long problemId);
     611
     612    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/AddProblemParameter", ReplyAction = "http://tempuri.org/IOKBService/AddProblemParameterResponse")]
     613    long AddProblemParameter(HeuristicLab.Clients.OKB.ProblemParameter dto);
     614
     615    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/UpdateProblemParameter", ReplyAction = "http://tempuri.org/IOKBService/UpdateProblemParameterResponse")]
     616    void UpdateProblemParameter(HeuristicLab.Clients.OKB.ProblemParameter dto);
     617
     618    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/DeleteProblemParameter", ReplyAction = "http://tempuri.org/IOKBService/DeleteProblemParameterResponse")]
     619    void DeleteProblemParameter(long id);
     620
     621    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/GetResult", ReplyAction = "http://tempuri.org/IOKBService/GetResultResponse")]
     622    HeuristicLab.Clients.OKB.Result GetResult(long id);
     623
     624    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/GetResults", ReplyAction = "http://tempuri.org/IOKBService/GetResultsResponse")]
     625    HeuristicLab.Clients.OKB.Result[] GetResults(long algorithmId);
     626
    422627    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/GetPlatform", ReplyAction = "http://tempuri.org/IOKBService/GetPlatformResponse")]
    423628    HeuristicLab.Clients.OKB.Platform GetPlatform(long id);
     
    492697    void UpdateAlgorithmData(HeuristicLab.Clients.OKB.AlgorithmData dto);
    493698
    494     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/GetProblemClass", ReplyAction = "http://tempuri.org/IOKBService/GetProblemClassResponse")]
    495     HeuristicLab.Clients.OKB.ProblemClass GetProblemClass(long id);
     699    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/GetAlgorithmParameter", ReplyAction = "http://tempuri.org/IOKBService/GetAlgorithmParameterResponse")]
     700    HeuristicLab.Clients.OKB.AlgorithmParameter GetAlgorithmParameter(long id);
    496701  }
    497702
     
    523728    }
    524729
     730    public long AddResult(HeuristicLab.Clients.OKB.Result dto) {
     731      return base.Channel.AddResult(dto);
     732    }
     733
     734    public void UpdateResult(HeuristicLab.Clients.OKB.Result dto) {
     735      base.Channel.UpdateResult(dto);
     736    }
     737
     738    public void DeleteResult(long id) {
     739      base.Channel.DeleteResult(id);
     740    }
     741
     742    public HeuristicLab.Clients.OKB.AlgorithmParameter[] GetAlgorithmParameters(long algorithmId) {
     743      return base.Channel.GetAlgorithmParameters(algorithmId);
     744    }
     745
     746    public long AddAlgorithmParameter(HeuristicLab.Clients.OKB.AlgorithmParameter dto) {
     747      return base.Channel.AddAlgorithmParameter(dto);
     748    }
     749
     750    public void UpdateAlgorithmParameter(HeuristicLab.Clients.OKB.AlgorithmParameter dto) {
     751      base.Channel.UpdateAlgorithmParameter(dto);
     752    }
     753
     754    public void DeleteAlgorithmParameter(long id) {
     755      base.Channel.DeleteAlgorithmParameter(id);
     756    }
     757
     758    public HeuristicLab.Clients.OKB.ProblemClass GetProblemClass(long id) {
     759      return base.Channel.GetProblemClass(id);
     760    }
     761
    525762    public HeuristicLab.Clients.OKB.ProblemClass[] GetProblemClasses() {
    526763      return base.Channel.GetProblemClasses();
     
    575812    }
    576813
     814    public HeuristicLab.Clients.OKB.ProblemParameter GetProblemParameter(long id) {
     815      return base.Channel.GetProblemParameter(id);
     816    }
     817
     818    public HeuristicLab.Clients.OKB.ProblemParameter[] GetProblemParameters(long problemId) {
     819      return base.Channel.GetProblemParameters(problemId);
     820    }
     821
     822    public long AddProblemParameter(HeuristicLab.Clients.OKB.ProblemParameter dto) {
     823      return base.Channel.AddProblemParameter(dto);
     824    }
     825
     826    public void UpdateProblemParameter(HeuristicLab.Clients.OKB.ProblemParameter dto) {
     827      base.Channel.UpdateProblemParameter(dto);
     828    }
     829
     830    public void DeleteProblemParameter(long id) {
     831      base.Channel.DeleteProblemParameter(id);
     832    }
     833
     834    public HeuristicLab.Clients.OKB.Result GetResult(long id) {
     835      return base.Channel.GetResult(id);
     836    }
     837
     838    public HeuristicLab.Clients.OKB.Result[] GetResults(long algorithmId) {
     839      return base.Channel.GetResults(algorithmId);
     840    }
     841
    577842    public HeuristicLab.Clients.OKB.Platform GetPlatform(long id) {
    578843      return base.Channel.GetPlatform(id);
     
    671936    }
    672937
    673     public HeuristicLab.Clients.OKB.ProblemClass GetProblemClass(long id) {
    674       return base.Channel.GetProblemClass(id);
     938    public HeuristicLab.Clients.OKB.AlgorithmParameter GetAlgorithmParameter(long id) {
     939      return base.Channel.GetAlgorithmParameter(id);
    675940    }
    676941  }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/ServiceClients/Problem.cs

    r4492 r4566  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324
     
    3031      ProblemClassId = 1;
    3132    }
     33
     34    public override IDeepCloneable Clone(Cloner cloner) {
     35      Problem clone = (Problem)base.Clone(cloner);
     36      clone.PlatformId = PlatformId;
     37      clone.ProblemClassId = ProblemClassId;
     38      return clone;
     39    }
    3240  }
    3341}
  • branches/OKB/HeuristicLab.Services.OKB/3.3/Interfaces/IOKBService.cs

    r4548 r4566  
    9595    #endregion
    9696
     97    #region AlgorithmParameter Methods
     98    [OperationContract]
     99    AlgorithmParameter GetAlgorithmParameter(long id);
     100    [OperationContract]
     101    IEnumerable<AlgorithmParameter> GetAlgorithmParameters(long algorithmId);
     102    [OperationContract]
     103    long AddAlgorithmParameter(AlgorithmParameter dto);
     104    [OperationContract]
     105    void UpdateAlgorithmParameter(AlgorithmParameter dto);
     106    [OperationContract]
     107    void DeleteAlgorithmParameter(long id);
     108    #endregion
     109
    97110    #region ProblemClass Methods
    98111    [OperationContract]
     
    131144    void UpdateProblemData(ProblemData dto);
    132145    #endregion
     146
     147    #region ProblemParameter Methods
     148    [OperationContract]
     149    ProblemParameter GetProblemParameter(long id);
     150    [OperationContract]
     151    IEnumerable<ProblemParameter> GetProblemParameters(long problemId);
     152    [OperationContract]
     153    long AddProblemParameter(ProblemParameter dto);
     154    [OperationContract]
     155    void UpdateProblemParameter(ProblemParameter dto);
     156    [OperationContract]
     157    void DeleteProblemParameter(long id);
     158    #endregion
     159
     160    #region Result Methods
     161    [OperationContract]
     162    Result GetResult(long id);
     163    [OperationContract]
     164    IEnumerable<Result> GetResults(long algorithmId);
     165    [OperationContract]
     166    long AddResult(Result dto);
     167    [OperationContract]
     168    void UpdateResult(Result dto);
     169    [OperationContract]
     170    void DeleteResult(long id);
     171    #endregion
    133172  }
    134173}
  • branches/OKB/HeuristicLab.Services.OKB/3.3/OKBService.cs

    r4548 r4566  
    200200    #endregion
    201201
     202    #region AlgorithmParameter Methods
     203    public DataTransfer.AlgorithmParameter GetAlgorithmParameter(long id) {
     204      using (OKBDataContext okb = new OKBDataContext()) {
     205        return Convert.ToDto(okb.AlgorithmParameters.FirstOrDefault(x => x.Id == id));
     206      }
     207    }
     208    public IEnumerable<DataTransfer.AlgorithmParameter> GetAlgorithmParameters(long algorithmId) {
     209      using (OKBDataContext okb = new OKBDataContext()) {
     210        return okb.AlgorithmParameters.Where(x => x.AlgorithmId == algorithmId).Select(x => Convert.ToDto(x)).ToArray();
     211      }
     212    }
     213    public long AddAlgorithmParameter(DataTransfer.AlgorithmParameter dto) {
     214      using (OKBDataContext okb = new OKBDataContext()) {
     215        DataAccess.AlgorithmParameter entity = Convert.ToEntity(dto); entity.Id = 0;
     216        okb.AlgorithmParameters.InsertOnSubmit(entity);
     217        okb.SubmitChanges();
     218        return entity.Id;
     219      }
     220    }
     221    public void UpdateAlgorithmParameter(DataTransfer.AlgorithmParameter dto) {
     222      using (OKBDataContext okb = new OKBDataContext()) {
     223        DataAccess.AlgorithmParameter entity = okb.AlgorithmParameters.FirstOrDefault(x => x.Id == dto.Id);
     224        Convert.ToEntity(dto, entity);
     225        okb.SubmitChanges();
     226      }
     227    }
     228    public void DeleteAlgorithmParameter(long id) {
     229      using (OKBDataContext okb = new OKBDataContext()) {
     230        DataAccess.AlgorithmParameter entity = okb.AlgorithmParameters.FirstOrDefault(x => x.Id == id);
     231        if (entity != null) okb.AlgorithmParameters.DeleteOnSubmit(entity);
     232        okb.SubmitChanges();
     233      }
     234    }
     235    #endregion
     236
    202237    #region ProblemClass Methods
    203238    public DataTransfer.ProblemClass GetProblemClass(long id) {
     
    293328        if (entity == null) okb.ProblemDatas.InsertOnSubmit(Convert.ToEntity(dto));
    294329        else Convert.ToEntity(dto, entity);
     330        okb.SubmitChanges();
     331      }
     332    }
     333    #endregion
     334
     335    #region ProblemParameter Methods
     336    public DataTransfer.ProblemParameter GetProblemParameter(long id) {
     337      using (OKBDataContext okb = new OKBDataContext()) {
     338        return Convert.ToDto(okb.ProblemParameters.FirstOrDefault(x => x.Id == id));
     339      }
     340    }
     341    public IEnumerable<DataTransfer.ProblemParameter> GetProblemParameters(long problemId) {
     342      using (OKBDataContext okb = new OKBDataContext()) {
     343        return okb.ProblemParameters.Where(x => x.ProblemId == problemId).Select(x => Convert.ToDto(x)).ToArray();
     344      }
     345    }
     346    public long AddProblemParameter(DataTransfer.ProblemParameter dto) {
     347      using (OKBDataContext okb = new OKBDataContext()) {
     348        DataAccess.ProblemParameter entity = Convert.ToEntity(dto); entity.Id = 0;
     349        okb.ProblemParameters.InsertOnSubmit(entity);
     350        okb.SubmitChanges();
     351        return entity.Id;
     352      }
     353    }
     354    public void UpdateProblemParameter(DataTransfer.ProblemParameter dto) {
     355      using (OKBDataContext okb = new OKBDataContext()) {
     356        DataAccess.ProblemParameter entity = okb.ProblemParameters.FirstOrDefault(x => x.Id == dto.Id);
     357        Convert.ToEntity(dto, entity);
     358        okb.SubmitChanges();
     359      }
     360    }
     361    public void DeleteProblemParameter(long id) {
     362      using (OKBDataContext okb = new OKBDataContext()) {
     363        DataAccess.ProblemParameter entity = okb.ProblemParameters.FirstOrDefault(x => x.Id == id);
     364        if (entity != null) okb.ProblemParameters.DeleteOnSubmit(entity);
     365        okb.SubmitChanges();
     366      }
     367    }
     368    #endregion
     369
     370    #region Result Methods
     371    public DataTransfer.Result GetResult(long id) {
     372      using (OKBDataContext okb = new OKBDataContext()) {
     373        return Convert.ToDto(okb.Results.FirstOrDefault(x => x.Id == id));
     374      }
     375    }
     376    public IEnumerable<DataTransfer.Result> GetResults(long algorithmId) {
     377      using (OKBDataContext okb = new OKBDataContext()) {
     378        return okb.Results.Where(x => x.AlgorithmId == algorithmId).Select(x => Convert.ToDto(x)).ToArray();
     379      }
     380    }
     381    public long AddResult(DataTransfer.Result dto) {
     382      using (OKBDataContext okb = new OKBDataContext()) {
     383        DataAccess.Result entity = Convert.ToEntity(dto); entity.Id = 0;
     384        okb.Results.InsertOnSubmit(entity);
     385        okb.SubmitChanges();
     386        return entity.Id;
     387      }
     388    }
     389    public void UpdateResult(DataTransfer.Result dto) {
     390      using (OKBDataContext okb = new OKBDataContext()) {
     391        DataAccess.Result entity = okb.Results.FirstOrDefault(x => x.Id == dto.Id);
     392        Convert.ToEntity(dto, entity);
     393        okb.SubmitChanges();
     394      }
     395    }
     396    public void DeleteResult(long id) {
     397      using (OKBDataContext okb = new OKBDataContext()) {
     398        DataAccess.Result entity = okb.Results.FirstOrDefault(x => x.Id == id);
     399        if (entity != null) okb.Results.DeleteOnSubmit(entity);
    295400        okb.SubmitChanges();
    296401      }
Note: See TracChangeset for help on using the changeset viewer.