///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L3ACAAD_GCAfT_1612_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L3ACAAD_GCAfCID_1612 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L3ACAAD_GCAfT_1612_Array functionReturn = new FR_L3ACAAD_GCAfT_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_CustomerAddresses_for_CustomerID", ex); } return(functionReturn); }
protected static FR_L3ACAAD_GCAfT_1612_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L3ACAAD_GCAfCID_1612 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L3ACAAD_GCAfT_1612_Array(); //Put your code here if (Parameter.CustomerID == Guid.Empty) { return(returnValue); } ORM_CMN_BPT_CTM_Customer customer; var customerQ = new ORM_CMN_BPT_CTM_Customer.Query(); customerQ.Tenant_RefID = securityTicket.TenantID; customerQ.IsDeleted = false; customerQ.CMN_BPT_CTM_CustomerID = Parameter.CustomerID; customer = ORM_CMN_BPT_CTM_Customer.Query.Search(Connection, Transaction, customerQ).FirstOrDefault(); if (customer == null) { return(returnValue); } ORM_CMN_BPT_BusinessParticipant bParticipant; var bParticipantQ = new ORM_CMN_BPT_BusinessParticipant.Query(); bParticipantQ.Tenant_RefID = securityTicket.TenantID; bParticipantQ.IsDeleted = false; bParticipantQ.CMN_BPT_BusinessParticipantID = customer.Ext_BusinessParticipant_RefID; bParticipant = ORM_CMN_BPT_BusinessParticipant.Query.Search(Connection, Transaction, bParticipantQ).FirstOrDefault(); if (bParticipant == null) { return(returnValue); } //L5ACAAD_GCAfT_1544 var list = new List <L3ACAAD_GCAfT_1612>(); if (bParticipant.IsCompany) { P_L3ACAAD_GCAfT_1607 param = new P_L3ACAAD_GCAfT_1607(); param.CompanyInfoID = bParticipant.IfCompany_CMN_COM_CompanyInfo_RefID; var addresses = cls_Get_CompanyAddresses_for_CompanyInfoID.Invoke(Connection, Transaction, param, securityTicket).Result; if (addresses != null) { foreach (var a in addresses) { L3ACAAD_GCAfT_1612 item = new L3ACAAD_GCAfT_1612(); item.AddressID = a.CMN_UniversalContactDetailID; item.Country_639_1_ISOCode = a.Country_639_1_ISOCode; item.IsBilling = a.IsBilling; item.IsShipping = a.IsShipping; item.IsContact = a.IsContact; item.Street_Name = a.Street_Name; item.Street_Number = a.Street_Number; item.Town = a.Town; item.ZIP = a.ZIP; item.AssignmentID = Guid.Empty; item.CMN_COM_CompanyInfo_AddressID = a.CMN_COM_CompanyInfo_AddressID; item.Country_Name = a.Country_Name; item.AddressName = a.Address_Description; item.IsDefault = a.IsDefault; item.IsCompany = true; list.Add(item); } } } else { P_L3ACAAD_GPAfT_1608 param = new P_L3ACAAD_GPAfT_1608(); param.PersonInfoID = bParticipant.IfNaturalPerson_CMN_PER_PersonInfo_RefID; var addresses = cls_Get_PersonAddresses_for_PersonInfoID.Invoke(Connection, Transaction, param, securityTicket).Result; if (addresses != null) { foreach (var a in addresses) { L3ACAAD_GCAfT_1612 item = new L3ACAAD_GCAfT_1612(); item.AddressID = a.CMN_AddressID; item.Country_639_1_ISOCode = a.Country_ISOCode; item.IsBilling = a.IsAddress_Billing; item.IsShipping = a.IsAddress_Shipping; item.IsContact = a.IsAddress_Contact; item.Street_Name = a.Street_Name; item.Street_Number = a.Street_Number; item.Town = a.City_Name; item.ZIP = a.City_PostalCode; item.AssignmentID = a.AssignmentID; item.CMN_COM_CompanyInfo_AddressID = Guid.Empty; item.Country_Name = a.Country_Name; item.AddressName = a.AddressLabel; item.IsDefault = a.IsPrimary; item.IsCompany = false; list.Add(item); } } } returnValue.Result = list.ToArray(); return(returnValue); return(returnValue); #endregion UserCode }