protected static FR_L3SO_GAAfSHI_1612_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L3SO_GAAfSHI_1612 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L3SO_GAAfSHI_1612_Array(); //Put your code here var list = new List <L3SO_GAAfSHI_1612>(); #region Organization Addresses var param = new P_L3OS_GOAfSHI_1407 { ShipmentHeaderID = Parameter.ShipmentHeaderID }; var OrganizationAddress = cls_Get_OrganizationAddress_for_ShipmentHeaderID.Invoke(Connection, Transaction, param, securityTicket).Result; if (OrganizationAddress.Any()) { foreach (var address in OrganizationAddress) { L3SO_GAAfSHI_1612 item = new L3SO_GAAfSHI_1612(); item.AddressID = address.CMN_UniversalContactDetailID; item.Street_Name = address.Street_Name; item.Street_Number = address.Street_Number; item.IsDefault = address.IsPrimary; item.Town = address.Town; item.ZIP = address.ZIP; item.hasOrganizationUnit = true; item.IsCompany = address.IsCompany; list.Add(item); } } #endregion #region Customer Addresses var Shipment = new ORM_LOG_SHP_Shipment_Header(); Shipment.Load(Connection, Transaction, Parameter.ShipmentHeaderID); var Customer = CL1_CMN_BPT_CTM.ORM_CMN_BPT_CTM_Customer.Query.Search(Connection, Transaction, new CL1_CMN_BPT_CTM.ORM_CMN_BPT_CTM_Customer.Query { IsDeleted = false, Tenant_RefID = securityTicket.TenantID, Ext_BusinessParticipant_RefID = Shipment.RecipientBusinessParticipant_RefID }).SingleOrDefault(); List <L3ACAAD_GCAfT_1612> CustomerAddress = new List <L3ACAAD_GCAfT_1612>(); CustomerAddress = cls_Get_CustomerAddresses_for_CustomerID.Invoke(Connection, Transaction, new P_L3ACAAD_GCAfCID_1612 { CustomerID = Customer.CMN_BPT_CTM_CustomerID }, securityTicket).Result.ToList(); if (CustomerAddress.Any()) { foreach (var address in CustomerAddress) { if (!string.IsNullOrEmpty(address.Street_Name)) { L3SO_GAAfSHI_1612 item = new L3SO_GAAfSHI_1612(); item.AddressID = address.AddressID; item.Street_Name = address.Street_Name; item.Street_Number = address.Street_Number; item.IsDefault = address.IsDefault; item.IsBilling = address.IsBilling; item.IsShipping = address.IsShipping; item.IsContact = address.IsContact; item.IsCompany = address.IsCompany; item.Town = address.Town; item.ZIP = address.ZIP; item.hasOrganizationUnit = false; list.Add(item); } } } #endregion returnValue.Result = list.ToArray(); return(returnValue); #endregion UserCode }
///<summary> /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured ///<summary> public static FR_L3SO_GAAfSHI_1612_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L3SO_GAAfSHI_1612 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, Transaction, null, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L3SO_GAAfSHI_1612_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L3SO_GAAfSHI_1612 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L3SO_GAAfSHI_1612_Array functionReturn = new FR_L3SO_GAAfSHI_1612_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_AllAddresses_for_ShipmentHeaderID", ex); } return(functionReturn); }
///<summary> /// Opens the connection/transaction for the given connectionString, and closes them when complete ///<summary> public static FR_L3SO_GAAfSHI_1612_Array Invoke(string ConnectionString, P_L3SO_GAAfSHI_1612 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(null, null, ConnectionString, Parameter, securityTicket)); }