GreenshadesOnline Integration Help
Example Code

This C# code is provided for sample purposes only.  You may develop similar code in any language that is capable of calling a webservice over https. 

void linkGreenEmployee_Click(object sender, EventArgs ea) { //employee clicks link

 

        // set up variables for use when calling webmethod

        Guid authenticationKey = new Guid("00000000-0000-0000-0000-000000000000");  // provided by Greenshades

        int gsCompanyID = 0;  // provided by Greenshades

 

        // information gathered by the client

        string ourCompanyID = "TWO"; // the company ID stored in our payroll system

 

//get the employee ID of the person currently logged in.  This function must get the credentials of the current //user and then look up their employeeID within our payroll system.

        string employeeID = GetEmployeeIDOfCurrentUser(“EMP0001");

 

        string targetPortal = “GreenEmployee”; 

 

        string ipAddress = Request.UserHostAddress; // get the IP of the client computer for security tracking

        string userAgent = Request.UserAgent; // and the user agent of the client's browser

 

        try { // in case something goes wrong, such as loss of connectivity

 

                // create an instance of the web service

                using (SampleApp.com.greenshades.www.SignOnService passThroughInstance =

                        new SampleApp.com.greenshades.www.SignOnService()) {

 

                        // and call the authentication function

                        string targetURL = passThroughInstance.AuthenticateEmployee3(authenticationKey, gsCompanyID,

                                ourCompanyID, employeeID, targetPortal, ipAddress, userAgent);

 

                        // and now redirect to GreenEmployee

                        Response.Redirect(targetURL, false);

                        return;

                }

        }

        catch (System.Exception) {

                // something went wrong. Handle error per corporate guidelines.

        }

}