//**************************************************************************************** // File: PLSQLCommands.cs // Description: Demo of PLSQL Commands with .NET Access Provider // Created by: Stefan Arvidsson // // Compile with csc /reference:Ifs.Fnd.AccessProvider.dll;Ifs.Fnd.Data.dll;Ifs.Fnd.Core.dll PLSQLCommands.cs //**************************************************************************************** using System; using Ifs.Fnd; using Ifs.Fnd.Data; using Ifs.Fnd.AccessProvider; using Ifs.Fnd.AccessProvider.PLSQL; public abstract class PLSQLCommands { private static FndConnection conn; public static void Main(string [] pars) { try { if(pars.Length != 3) { Console.WriteLine("Syntax : PLSQLCommands.exe connectstring identity password"); Console.WriteLine("Press Enter to continue"); Console.Read(); return; } conn = new FndConnection(pars[0], pars[1], pars[2]); conn.CatchExceptions = false; Console.WriteLine("\n***** IFSAPP Description *****"); GetUserDescription(); Console.WriteLine("\n***** Prepare Profile *****"); PrepareProfile(); } catch(FndException err) { err.Show(); } } // This sample shows how to call a package method private static void GetUserDescription() { FndPLSQLCommand cmd = new FndPLSQLCommand(conn, ":DESC := FND_USER_API.GET_DESCRIPTION(:IDENTITY)"); cmd.BindVariables.Add(new FndBindVariable(FndBindVariableDirection.In, "IDENTITY", new FndTextAttribute("IFSAPP"))); cmd.BindVariables.Add(new FndBindVariable(FndBindVariableDirection.Out, "DESC", new FndTextAttribute())); cmd.ExecuteNonQuery(); Console.WriteLine(cmd.BindVariables["DESC"].Value.ToString()); } // This sample shows how to call a LU standard method "New Prepare" private static void PrepareProfile() { // The row needs to have OBJID, and OBJVERSION FndDataRow profile = new FndDataRow("PROFILE"); profile.Columns.Add("OBJID", FndAttributeType.Text); profile.Columns.Add("OBJVERSION", FndAttributeType.Text); // I also add OWNER since I want to receive the prepared value profile.Columns.Add("OWNER", FndAttributeType.Text); FndPLSQLBaseMethodCommand cmd = new FndPLSQLBaseMethodCommand(conn, FndBaseMethodType.New, "FNDRR_CLIENT_PROFILE_API", "New__", profile, FndBaseMethodAction.Prepare); cmd.ExecuteNonQuery(); // Check prepared value OWNER FndTextAttribute owner = (FndTextAttribute)profile["OWNER"]; if(owner.IsNull) Console.WriteLine("OWNER set in Prepare_Insert to null"); else Console.WriteLine("OWNER set in Prepare_Insert to " + owner.GetValue()); } }