Example #1
0
        public string ExecutePlSql(string partNo, string description, string unitCode)
        {
            string resultString;

            //            CREATE OR REPLACE PACKAGE BODY C_PART_CATALOG_API IS
            //-----------------------------------------------------------------------------
            //-------------------- LU SPECIFIC PUBLIC METHODS -----------------------------
            //-----------------------------------------------------------------------------
            //          PROCEDURE Create_Part_Catalog(part_no_ IN VARCHAR2,
            //                              description_ IN VARCHAR2,
            //                              unit_code_ IN VARCHAR2)
            string sqlCommand = @"C_PART_CATALOG_API.Create_Part_Catalog(:PART_NO,:DESC,:UNIT_CODE)";

            try
            {
                FndPLSQLCommand command = new FndPLSQLCommand(_connection, sqlCommand);
                command.BindVariables.AddFndTextVariable("PART_NO", partNo, FndBindVariableDirection.In);
                command.BindVariables.AddFndTextVariable("DESC", description, FndBindVariableDirection.In);
                command.BindVariables.AddFndTextVariable("UNIT_CODE", unitCode, FndBindVariableDirection.In);

                command.ExecuteNonQuery();

                resultString = "SUSCCESS";
            }
            catch (Exception ex)
            {
                resultString = String.Format("{0}\n{1}", ex.Message, (ex.InnerException != null ? ex.InnerException.Message : ""));
            }

            return(resultString);
        }
        /// <summary>
        /// Task for performing commands using IFS Access Provider: http://ifsscan-odemo-2.cloudapp.net/ifsdoc/f1doc/foundation1/050_development/default.htm
        /// See documentation at https://github.com/CommunityHiQ/Frends.Community.IFSAccessProvider
        /// </summary>
        /// <param name="commandInput"></param>
        /// <param name="connection"></param>
        /// <param name="cancellationToken"></param>
        /// <returns>Object { bool Success, string Result, string Message }</returns>
        public static Output Command([PropertyTab] CommandProperties commandInput, [PropertyTab] ConnectionProperties connection, CancellationToken cancellationToken)
        {
            var conn = new FndConnection(connection.Address, connection.Username, connection.Password)
            {
                AsynchronousMode  = connection.AsynchronousMode,
                ConnectionTimeout = connection.TimeoutSeconds,
                CatchExceptions   = false
            };

            var command = new FndPLSQLCommand(conn, commandInput.Command);

            foreach (var param in commandInput.Parameters)
            {
                command.BindVariables.Add(Extensions.CreateFndParameter(param));
            }

            command.ExecuteNonQuery();

            return(new Output {
                Result = "Command executed", Success = true, Message = null
            });
        }
Example #3
0
        public string ExecutePlSql(string partNo, string description, string unitCode )
        {
            string resultString;

            //            CREATE OR REPLACE PACKAGE BODY C_PART_CATALOG_API IS
            //-----------------------------------------------------------------------------
            //-------------------- LU SPECIFIC PUBLIC METHODS -----------------------------
            //-----------------------------------------------------------------------------
            //          PROCEDURE Create_Part_Catalog(part_no_ IN VARCHAR2,
            //                              description_ IN VARCHAR2,
            //                              unit_code_ IN VARCHAR2)
            string sqlCommand = @"C_PART_CATALOG_API.Create_Part_Catalog(:PART_NO,:DESC,:UNIT_CODE)";

            try
            {
                FndPLSQLCommand command = new FndPLSQLCommand(_connection, sqlCommand);
                command.BindVariables.AddFndTextVariable("PART_NO", partNo, FndBindVariableDirection.In);
                command.BindVariables.AddFndTextVariable("DESC", description, FndBindVariableDirection.In);
                command.BindVariables.AddFndTextVariable("UNIT_CODE", unitCode, FndBindVariableDirection.In);

                command.ExecuteNonQuery();

                resultString = "SUSCCESS";
            }
            catch (Exception ex)
            {
                resultString = String.Format("{0}\n{1}", ex.Message, (ex.InnerException != null ? ex.InnerException.Message : ""));
            }

            return resultString;
        }