コード例 #1
0
        protected static FR_L2ADD_GADDfToI_1447_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L2ADD_GADDfToI_1447 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L2ADD_GADDfToI_1447_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL2_Address.Atomic.Retrieval.SQL.cls_Get_Address_for_TenantID_or_ID.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, "AddressID", Parameter.AddressID);



            List <L2ADD_GADDfToI_1447> results = new List <L2ADD_GADDfToI_1447>();
            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_AddressID", "Street_Name", "Street_Number", "City_AdministrativeDistrict", "City_Region", "City_Name", "City_PostalCode", "Province_Name", "Country_Name", "Country_ISOCode", "Creation_Timestamp", "IsDeleted", "Tenant_RefID", "Province_EconomicRegion_RefID" });
                while (reader.Read())
                {
                    L2ADD_GADDfToI_1447 resultItem = new L2ADD_GADDfToI_1447();
                    //0:Parameter CMN_AddressID of type Guid
                    resultItem.CMN_AddressID = reader.GetGuid(0);
                    //1:Parameter Street_Name of type String
                    resultItem.Street_Name = reader.GetString(1);
                    //2:Parameter Street_Number of type String
                    resultItem.Street_Number = reader.GetString(2);
                    //3:Parameter City_AdministrativeDistrict of type String
                    resultItem.City_AdministrativeDistrict = reader.GetString(3);
                    //4:Parameter City_Region of type String
                    resultItem.City_Region = reader.GetString(4);
                    //5:Parameter City_Name of type String
                    resultItem.City_Name = reader.GetString(5);
                    //6:Parameter City_PostalCode of type String
                    resultItem.City_PostalCode = reader.GetString(6);
                    //7:Parameter Province_Name of type String
                    resultItem.Province_Name = reader.GetString(7);
                    //8:Parameter Country_Name of type String
                    resultItem.Country_Name = reader.GetString(8);
                    //9:Parameter Country_ISOCode of type String
                    resultItem.Country_ISOCode = reader.GetString(9);
                    //10:Parameter Creation_Timestamp of type DateTime
                    resultItem.Creation_Timestamp = reader.GetDate(10);
                    //11:Parameter IsDeleted of type bool
                    resultItem.IsDeleted = reader.GetBoolean(11);
                    //12:Parameter Tenant_RefID of type Guid
                    resultItem.Tenant_RefID = reader.GetGuid(12);
                    //13:Parameter Province_EconomicRegion_RefID of type Guid
                    resultItem.Province_EconomicRegion_RefID = reader.GetGuid(13);

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

            returnStatus.Result = results.ToArray();
            return(returnStatus);
        }
コード例 #2
0
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_L2ADD_GADDfToI_1447_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L2ADD_GADDfToI_1447 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
コード例 #3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L2ADD_GADDfToI_1447_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L2ADD_GADDfToI_1447 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L2ADD_GADDfToI_1447_Array functionReturn = new FR_L2ADD_GADDfToI_1447_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_Get_Address_for_TenantID_or_ID", ex);
            }
            return(functionReturn);
        }
コード例 #4
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L2ADD_GADDfToI_1447_Array Invoke(string ConnectionString, P_L2ADD_GADDfToI_1447 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }