Example #1
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L3_BPbAC_1616_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L3_BPbAC_1616 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L3_BPbAC_1616_Array functionReturn = new FR_L3_BPbAC_1616_Array();

            try
            {
                if (cleanupConnection == true)
                {
                    Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }
                if (cleanupTransaction == true)
                {
                    Transaction = Connection.BeginTransaction();
                }

                functionReturn = Execute(Connection, Transaction, Parameter, securityTicket);

                #region Cleanup Connection/Transaction
                //Commit the transaction
                if (cleanupTransaction == true)
                {
                    Transaction.Commit();
                }
                //Close the connection
                if (cleanupConnection == true)
                {
                    Connection.Close();
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                throw new Exception("Exception occured in method cls_BusinessParticipant_by_AccountCode", ex);
            }
            return(functionReturn);
        }
Example #2
0
        protected static FR_L3_BPbAC_1616_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L3_BPbAC_1616 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L3_BPbAC_1616_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL3_MeasurementsMisc.Atomic.Retrieval.SQL.cls_BusinessParticipant_by_AccountCode.sql";

            command.CommandText = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(commandLocation)).ReadToEnd();
            CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ticket", securityTicket);
            command.CommandTimeout = QueryTimeout;

            CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "AccountCode", Parameter.AccountCode);

            CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "DownloadCode", Parameter.DownloadCode);



            List <L3_BPbAC_1616> results = new List <L3_BPbAC_1616>();
            var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction);
            var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader());

            try
            {
                reader.SetOrdinals(new string[] { "CMN_BPT_BusinessParticipantID", "DisplayName", "IsNaturalPerson", "IsCompany", "IfNaturalPerson_CMN_PER_PersonInfo_RefID", "IfCompany_CMN_COM_CompanyInfo_RefID", "IsTenant", "IfTenant_Tenant_RefID", "Creation_Timestamp", "IsDeleted", "Tenant_RefID", "DisplayImage_RefID", "DefaultLanguage_RefID", "DefaultCurrency_RefID", "LastContacted_Date", "LastContacted_ByBusinessPartner_RefID", "Audit_UpdatedByAccount_RefID", "Audit_UpdatedOn", "Audit_CreatedByAccount_RefID", "BusinessParticipantITL" });
                while (reader.Read())
                {
                    L3_BPbAC_1616 resultItem = new L3_BPbAC_1616();
                    //0:Parameter CMN_BPT_BusinessParticipantID of type Guid
                    resultItem.CMN_BPT_BusinessParticipantID = reader.GetGuid(0);
                    //1:Parameter DisplayName of type String
                    resultItem.DisplayName = reader.GetString(1);
                    //2:Parameter IsNaturalPerson of type bool
                    resultItem.IsNaturalPerson = reader.GetBoolean(2);
                    //3:Parameter IsCompany of type bool
                    resultItem.IsCompany = reader.GetBoolean(3);
                    //4:Parameter IfNaturalPerson_CMN_PER_PersonInfo_RefID of type Guid
                    resultItem.IfNaturalPerson_CMN_PER_PersonInfo_RefID = reader.GetGuid(4);
                    //5:Parameter IfCompany_CMN_COM_CompanyInfo_RefID of type Guid
                    resultItem.IfCompany_CMN_COM_CompanyInfo_RefID = reader.GetGuid(5);
                    //6:Parameter IsTenant of type bool
                    resultItem.IsTenant = reader.GetBoolean(6);
                    //7:Parameter IfTenant_Tenant_RefID of type Guid
                    resultItem.IfTenant_Tenant_RefID = reader.GetGuid(7);
                    //8:Parameter Creation_Timestamp of type DateTime
                    resultItem.Creation_Timestamp = reader.GetDate(8);
                    //9:Parameter IsDeleted of type bool
                    resultItem.IsDeleted = reader.GetBoolean(9);
                    //10:Parameter Tenant_RefID of type Guid
                    resultItem.Tenant_RefID = reader.GetGuid(10);
                    //11:Parameter DisplayImage_RefID of type Guid
                    resultItem.DisplayImage_RefID = reader.GetGuid(11);
                    //12:Parameter DefaultLanguage_RefID of type Guid
                    resultItem.DefaultLanguage_RefID = reader.GetGuid(12);
                    //13:Parameter DefaultCurrency_RefID of type Guid
                    resultItem.DefaultCurrency_RefID = reader.GetGuid(13);
                    //14:Parameter LastContacted_Date of type DateTime
                    resultItem.LastContacted_Date = reader.GetDate(14);
                    //15:Parameter LastContacted_ByBusinessPartner_RefID of type Guid
                    resultItem.LastContacted_ByBusinessPartner_RefID = reader.GetGuid(15);
                    //16:Parameter Audit_UpdatedByAccount_RefID of type Guid
                    resultItem.Audit_UpdatedByAccount_RefID = reader.GetGuid(16);
                    //17:Parameter Audit_UpdatedOn of type DateTime
                    resultItem.Audit_UpdatedOn = reader.GetDate(17);
                    //18:Parameter Audit_CreatedByAccount_RefID of type Guid
                    resultItem.Audit_CreatedByAccount_RefID = reader.GetGuid(18);
                    //19:Parameter BusinessParticipantITL of type String
                    resultItem.BusinessParticipantITL = reader.GetString(19);

                    results.Add(resultItem);
                }
            }
            catch (Exception ex)
            {
                reader.Close();
                throw new Exception("Exception occured durng data retrieval in method cls_BusinessParticipant_by_AccountCode", ex);
            }
            reader.Close();
            //Load all the dictionaries from the datatables
            loader.Load();

            returnStatus.Result = results.ToArray();
            return(returnStatus);
        }