Session class

Parent Previous Next

The creation of a Session object is always the first step in the communication between a client application and the IYOPRO back-end. It is required for all following API calls and objects.  


Namespace:

IYOPRO.Api

Assembly:

IYOPRO.Api (in IYOPRO.Api.dll)


Syntax

       class Session(string serviceurl, string username, string password)


Members

Session(string servicepath, string username, string password)

Initializes a new instance of the Session class. The servicepath specifies the location of the IYOPRO backend webservice. For the SaaS version of IYOPRO you must specify
 https://www.iyopro.com/iyopro/

Username and password represent the credentials which where used on user registration

void Login(object Userdata=null)

Performs the Login process. You may provide user data which will be provided in the resulting LoginCompletedEventEventArgs

void Login(Guid sessionId,object Userdata=null)

Validate session id. Perform this operation to validate if a previously received session is still valid

void AutoLogin(object userdata = null)

Perform automatic login. This methode uses NTLM to perform the login at the IYOPRO Server

bool IsLoggedIn()

Returns true if the user was logged in, false otherwise. This method does not verify if the session is still valid

void Logout()

Performs the Logout process

string GetServiceUrl()

Gets the service URL that is used to connect to IYOPRO

string GetNtlmServiceUrl()

Gets the service URL that is used to connect to IYOPRO with NTLM credentials

string GetWebSocketServiceUrl()

Gets the service URL that is used to connect to IYOPRO via WebSocket

void GetProjectTasks(int workflowid, object userdata = null)

Read all tasks of a workflow definition which are marked as project task. Userdata will be provided in the GetProjectTasksFinishedEventArgs

void CreateWorkflow(ProjectTasks tasks, Roles roles, object userdata = null)

Creates a workflow from a given hierarchy of tasks and roles. Userdata will be provided in the CreateWorkflowFinishedEventArgs

void GetAccountForSession(Guid sessionId, object userdata = null)

Gets the account for the specified session id. Userdata will be provided in the GetAccountCompletedEventArgs

string UserName

Gets the user name which was specified in the constructor

string ServicePath

Gets the service url which was specified in the constructor

Guid SessionId

Gets the session id which is provided by the Login() method

Workflows Workflows

Gets a reference to the Workflows class which provides managing workflow objects.

Tasks Tasks

Gets a reference to the Tasks class which provides managing task objects.

ProcessInstances ProcessInstances

Gets a reference to the ProcessInstances class which provides managing process instance objects

event LoginCompletedEvent LoginCompleted

The LoginCompleted event is triggered if the Login has finished

event GetProjectTasksFinishedEvent GetProjectTasksFinished

The GetProjectTasksFinished event is triggered if the GetProjectTasks method has finished

event CreateWorkflowFinishedEvent CreateWorkflowFinished

The CreateWorkflowFinished event is triggered if the CreateWorkflow method has finished

event GetAccountCompletedEvent GetAccountCompleted

The GetAccountCompleted event is triggered if the GetAccountForSession method has finished



A typical way to log in is

  1. Verify if a previously received sessionid is still valid To do this use
    void Login(Guid sessionId,object Userdata=null)
  2. If the sessionid is not valid try AutoLogin
    void AutoLogin(object userdata = null)
  3. If Autologin failed ask for Username and password and perform a manual login
    Session(string servicepath, string username, string password)


Sample to log in

Session session = new Session("https://www.iyopro.com/iyopro/" , "username" , "password");

session.LoginCompleted += (s, args) =>

{

if (args.Error != null)

{ string msg=args.Error.Message;

 MessageBox.Show(msg);

 return;

}

};

session.Login();