Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4390 for trunk/sources


Ignore:
Timestamp:
09/14/10 17:24:54 (14 years ago)
Author:
swagner
Message:

Worked on OKB data model and services (#1174)

Location:
trunk/sources/HeuristicLab.Services.OKB/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Services.OKB/3.3/AdminService.cs

    r4388 r4390  
    209209
    210210
     211    public void AddAlgorithmClass(AlgorithmClass algorithmClass) {
     212      using (OKBDataContext okb = new OKBDataContext()) {
     213        okb.AlgorithmClasses.InsertOnSubmit(new AlgorithmClass() { Name = algorithmClass.Name, Description = algorithmClass.Description });
     214        okb.SubmitChanges();
     215      }
     216    }
     217
    211218    public AlgorithmClass[] GetAlgorithmClasses() {
    212219      using (OKBDataContext okb = new OKBDataContext()) {
     
    217224    public void UpdateAlgorithmClass(AlgorithmClass algorithmClass) {
    218225      using (OKBDataContext okb = new OKBDataContext()) {
    219         okb.AlgorithmClasses.Attach(algorithmClass);
    220         okb.SubmitChanges();
    221       }
    222     }
    223 
    224     public void UpdateAlgorithmClasses(AlgorithmClass[] algorithmClasses) {
    225       using (OKBDataContext okb = new OKBDataContext()) {
    226         foreach (AlgorithmClass a in algorithmClasses) {
    227           AlgorithmClass original = okb.AlgorithmClasses.FirstOrDefault(x => x.Id == a.Id);
    228           if (original != null) {
    229             original.Name = a.Name;
    230             original.Description = a.Description;
    231           } else {
    232             okb.AlgorithmClasses.InsertOnSubmit(a);
    233           }
    234         }
     226        AlgorithmClass original = okb.AlgorithmClasses.First(a => a.Id == algorithmClass.Id);
     227        original.Name = algorithmClass.Name;
     228        original.Description = algorithmClass.Description;
     229        okb.SubmitChanges();
     230      }
     231    }
     232
     233    public void DeleteAlgorithmClass(long algorithmClassId) {
     234      using (OKBDataContext okb = new OKBDataContext()) {
     235        okb.AlgorithmClasses.DeleteOnSubmit(okb.AlgorithmClasses.First(a => a.Id == algorithmClassId));
    235236        okb.SubmitChanges();
    236237      }
  • trunk/sources/HeuristicLab.Services.OKB/3.3/Interfaces/IAdminService.cs

    r4388 r4390  
    112112
    113113    [OperationContract]
     114    void AddAlgorithmClass(AlgorithmClass algorithmClass);
     115
     116    [OperationContract]
    114117    AlgorithmClass[] GetAlgorithmClasses();
    115118
     
    118121
    119122    [OperationContract]
    120     void UpdateAlgorithmClasses(AlgorithmClass[] algorithmClasses);
    121 
     123    void DeleteAlgorithmClass(long algorithmClassId);
    122124
    123125  }
Note: See TracChangeset for help on using the changeset viewer.