Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7634


Ignore:
Timestamp:
03/19/12 14:18:15 (11 years ago)
Author:
ascheibe
Message:

#1174 prevent storing of runs without a valid client id

Location:
branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/RunCreation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/RunCreation/OKBAlgorithm.cs

    r7592 r7634  
    251251    }
    252252    public void Start() {
     253      if (!ClientInformation.Instance.ClientExists && storeRunsAutomatically) {
     254        throw new Exception("To be able to store runs automatically, you need to register your client first.");
     255      }
    253256      Algorithm.Start();
    254257    }
  • branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/RunCreation/OKBRun.cs

    r7604 r7634  
    126126      this.stored = false;
    127127      this.UserId = userId;
    128       this.ClientId = ClientInformation.Instance.ClientInfo.Id;
     128      if (ClientInformation.Instance.ClientExists) {
     129        this.ClientId = ClientInformation.Instance.ClientInfo.Id;
     130      } else {
     131        this.ClientId = Guid.Empty;
     132      }
    129133    }
    130134
     
    135139    public void Store() {
    136140      if (Stored) throw new InvalidOperationException("Cannot store already stored run.");
     141      if (!ClientInformation.Instance.ClientExists) {
     142        throw new Exception("To be able to store runs, you need to register your client first.");
     143      }
     144
     145      //if user has now registered his client...
     146      if (ClientId == Guid.Empty) {
     147        ClientId = ClientInformation.Instance.ClientInfo.Id;
     148      }
    137149
    138150      Run run = new Run();
Note: See TracChangeset for help on using the changeset viewer.