Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/22/11 03:08:43 (14 years ago)
Author:
swagner
Message:

Worked on OKB (#1174)

Location:
branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Administration
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Administration/AdministrationService.cs

    r5482 r5534  
    134134    public byte[] GetAlgorithmData(long algorithmId) {
    135135      using (OKBDataContext okb = new OKBDataContext()) {
    136         return okb.Algorithms.Where(x => x.Id == algorithmId).Select(x => x.BinaryData.Data.ToArray()).FirstOrDefault();
     136        var data = okb.Algorithms.Where(x => x.Id == algorithmId).Select(x => x.BinaryData).FirstOrDefault();
     137        if (data != null) return data.Data.ToArray();
     138        else return null;
    137139      }
    138140    }
     
    219221    public byte[] GetProblemData(long problemId) {
    220222      using (OKBDataContext okb = new OKBDataContext()) {
    221         return okb.Problems.Where(x => x.Id == problemId).Select(x => x.BinaryData.Data.ToArray()).FirstOrDefault();
     223        var data = okb.Problems.Where(x => x.Id == problemId).Select(x => x.BinaryData).FirstOrDefault();
     224        if (data != null) return data.Data.ToArray();
     225        else return null;
    222226      }
    223227    }
  • branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Administration/Convert.cs

    r5482 r5534  
    6262    public static DT.Algorithm ToDto(DA.Algorithm source) {
    6363      if (source == null) return null;
    64       return new DT.Algorithm { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, AlgorithmClassId = source.AlgorithmClassId, DataType = Convert.ToDto(source.DataType) };
     64      return new DT.Algorithm { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, AlgorithmClassId = source.AlgorithmClassId, DataTypeName = source.DataType.Name, DataTypeTypeName = source.DataType.TypeName };
    6565    }
    6666    public static DA.Algorithm ToEntity(DT.Algorithm source, DA.OKBDataContext okb) {
    6767      if (source == null) return null;
    68       return new DA.Algorithm { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, AlgorithmClassId = source.AlgorithmClassId, DataType = Convert.ToEntity(source.DataType, okb) };
     68      return new DA.Algorithm { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, AlgorithmClassId = source.AlgorithmClassId, DataType = Convert.ToEntity(source.DataTypeName, source.DataTypeTypeName, okb) };
    6969    }
    7070    public static void ToEntity(DT.Algorithm source, DA.Algorithm target, DA.OKBDataContext okb) {
    7171      if ((source != null) && (target != null)) {
    72         target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.PlatformId = source.PlatformId; target.AlgorithmClassId = source.AlgorithmClassId; target.DataType = Convert.ToEntity(source.DataType, okb);
     72        target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.PlatformId = source.PlatformId; target.AlgorithmClassId = source.AlgorithmClassId; target.DataType = Convert.ToEntity(source.DataTypeName, source.DataTypeTypeName, okb);
    7373      }
    7474    }
     
    9494    public static DT.Problem ToDto(DA.Problem source) {
    9595      if (source == null) return null;
    96       return new DT.Problem { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, ProblemClassId = source.ProblemClassId, DataType = Convert.ToDto(source.DataType) };
     96      return new DT.Problem { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, ProblemClassId = source.ProblemClassId, DataTypeName = source.DataType.Name, DataTypeTypeName = source.DataType.TypeName };
    9797    }
    9898    public static DA.Problem ToEntity(DT.Problem source, DA.OKBDataContext okb) {
    9999      if (source == null) return null;
    100       return new DA.Problem { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, ProblemClassId = source.ProblemClassId, DataType = Convert.ToEntity(source.DataType, okb) };
     100      return new DA.Problem { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, ProblemClassId = source.ProblemClassId, DataType = Convert.ToEntity(source.DataTypeName, source.DataTypeTypeName, okb) };
    101101    }
    102102    public static void ToEntity(DT.Problem source, DA.Problem target, DA.OKBDataContext okb) {
    103103      if ((source != null) && (target != null)) {
    104         target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.PlatformId = source.PlatformId; target.ProblemClassId = source.ProblemClassId; target.DataType = Convert.ToEntity(source.DataType, okb);
     104        target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.PlatformId = source.PlatformId; target.ProblemClassId = source.ProblemClassId; target.DataType = Convert.ToEntity(source.DataTypeName, source.DataTypeTypeName, okb);
    105105      }
    106106    }
     
    108108
    109109    #region DataType
    110     private static DT.DataType ToDto(DA.DataType source) {
    111       if (source == null) return null;
    112       return new DT.DataType { Name = source.Name, TypeName = source.TypeName };
    113     }
    114     private static DA.DataType ToEntity(DT.DataType source, DA.OKBDataContext okb) {
    115       if (source == null) return null;
    116       var entity = okb.DataTypes.Where(x => (x.Name == source.Name) && (x.TypeName == source.TypeName)).FirstOrDefault();
     110    private static DA.DataType ToEntity(string dataTypeName, string dataTypeTypeName, DA.OKBDataContext okb) {
     111      if ((dataTypeName == null) || (dataTypeTypeName == null)) return null;
     112      var entity = okb.DataTypes.Where(x => (x.Name == dataTypeName) && (x.TypeName == dataTypeTypeName)).FirstOrDefault();
    117113      if (entity == null)
    118         entity = new DA.DataType() { Id = 0, Name = source.Name, TypeName = source.TypeName };
     114        entity = new DA.DataType() { Id = 0, Name = dataTypeName, TypeName = dataTypeTypeName };
    119115      return entity;
    120116    }
  • branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Administration/DataTransfer/Algorithm.cs

    r5482 r5534  
    3030    public long AlgorithmClassId { get; set; }
    3131    [DataMember]
    32     public DataType DataType { get; set; }
     32    public string DataTypeName { get; set; }
     33    [DataMember]
     34    public string DataTypeTypeName { get; set; }
    3335  }
    3436}
  • branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Administration/DataTransfer/Problem.cs

    r5482 r5534  
    3030    public long ProblemClassId { get; set; }
    3131    [DataMember]
    32     public DataType DataType { get; set; }
     32    public string DataTypeName { get; set; }
     33    [DataMember]
     34    public string DataTypeTypeName { get; set; }
    3335  }
    3436}
Note: See TracChangeset for help on using the changeset viewer.