private static RegisterCompleteEventArgs RegisterEx(Func <ISessionData> data) { RegisterCompleteEventArgs registerCompleteEventArgs = null; try { AssureSessionData(); var target = TargetFactory.Get(); target.RegisterSession(data()); registerCompleteEventArgs = new RegisterCompleteEventArgs(true); _registeredOnServer = true; //TODO: This is true, also if an issue has been returned from the server. (Even though the session was never started explicitly) } catch (InvalidOperationException exception) { registerCompleteEventArgs = new RegisterCompleteEventArgs(true, exception); } catch (Exception exception) { registerCompleteEventArgs = new RegisterCompleteEventArgs(false, exception); } finally { InvokeRegisterComplete(registerCompleteEventArgs); } _registerCompleteEventArgs = registerCompleteEventArgs; return(registerCompleteEventArgs); }
private static RegisterCompleteEventArgs RegisterEx(string message, List <ICheckpoint> checkpoints, string userHandle, IDictionary <string, string> data, Action <RegisterCompleteEventArgs> completeAction) { RegisterCompleteEventArgs registerCompleteEventArgs = null; try { var target = TargetFactory.Get(); var response = target.RegisterCounter(new CounterData(Guid.NewGuid(), DateTime.UtcNow, Session.GetSessionData(), userHandle, message, data, checkpoints)); Session.RegisteredOnServer = true; //TODO: This is true, also if an issue has been returned from the server registerCompleteEventArgs = new RegisterCompleteEventArgs(true, response); } catch (InvalidOperationException exception) { registerCompleteEventArgs = new RegisterCompleteEventArgs(false, exception); } catch (Exception exception) { registerCompleteEventArgs = new RegisterCompleteEventArgs(false, exception); } finally { InvokeRegisterComplete(registerCompleteEventArgs); } if (completeAction != null) { completeAction.Invoke(registerCompleteEventArgs); } _registerCompleteEventArgs = registerCompleteEventArgs; return(registerCompleteEventArgs); }
private static RegisterCompleteEventArgs RegisterEx(IssueData issueData, Action <RegisterCompleteEventArgs> completeAction) { RegisterCompleteEventArgs registerCompleteEventArgs = null; try { var target = TargetFactory.Get(); var reponse = target.RegisterIssue(issueData); Session.RegisteredOnServer = true; //TODO: This is true, also if an issue has been returned from the server //TODO: Make it possible to append a user comment on an issue (Ither on the initial call, or afterwords as a second call) registerCompleteEventArgs = new RegisterCompleteEventArgs(true, reponse, new OriginalData(issueData)); } catch (InvalidOperationException exception) { registerCompleteEventArgs = new RegisterCompleteEventArgs(false, exception, new OriginalData(issueData)); } catch (Exception exception) { registerCompleteEventArgs = new RegisterCompleteEventArgs(false, exception, new OriginalData(issueData)); } finally { InvokeRegisterComplete(registerCompleteEventArgs); } if (completeAction != null) { completeAction.Invoke(registerCompleteEventArgs); } _registerCompleteEventArgs = registerCompleteEventArgs; return(registerCompleteEventArgs); }
public static string Execute(string jsonData, string controller, string action) { var target = TargetFactory.Get() as ServiceTarget; return(target.ExecuteQuery(jsonData, controller, action)); }
private static void EndSessionEx(Guid sessionId) { var target = TargetFactory.Get(); target.EndSession(sessionId); }