6 61 3 C Example

LANSA Open Guide

6.61.3 C# Example

  

namespace LansaOpenNative

{

   class LansaOpen

   {

      [DllImport( "lcoew32.dll", CharSet = CharSet.Ansi )]

      public static extern int LceSetIBMiSignon(

         StringBuilder                             server,

         int                                       mapperPort,

         int                                       sslRequired,

         StringBuilder                             userId,

         StringBuilder                             password,

         StringBuilder                             newPassword,

         int                                       encryptPassword,

         StringBuilder                             returnCode );

   }

}

 

private void LOpenSample()

{

   String strServer = "myserver";

   int iMapperPort = 0;

   bool fSSLRequired = false;

   String strUserid = "myuser";

   String strPassword = "mypasswd";

   String strNewPassword = "mynewpassword";

   bool fEncryptPassword = true;

   StringBuilder strReturnCode = new StringBuilder( 3 );

   bool rc;

 

   rc = LansaOpen.LceSetIBMiSignon(

      new StringBuilder( strServer ),

      iMapperPort,

      ( fSSLRequired ? 1 : 0 ),

      new StringBuilder( strUserid ),

      new StringBuilder( strPassword ),

      new StringBuilder( strNewPassword ),

      ( fEncryptPassword ? 1 : 0 ),

      strReturnCode );

 

   if ( rc )

   {

      if ( strReturnCode.ToString() == "OK" )

      {

         txtStatusField.Text = "Signon details successfully changed";

      }

      else

      {

         txtStatusField.Text = String.Format( "The request to the server has failed with return code: {0}", strReturnCode );

      }

   }

   else

   {

      txtStatusField.Text = "The function failed to run successfully";

   }

}