protected static FR_L5PS_GSSAwSfT_1720 Execute(DbConnection Connection, DbTransaction Transaction, P_L5PS_GSSAwSfT_1720 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5PS_GSSAwSfT_1720(); //Put your code here L5PS_GSSAwSfT_1720 retVal = new L5PS_GSSAwSfT_1720(); List <L5PS_GSSAwSfT_1720a> supplierSelectionAreaWithSuppliers = new List <L5PS_GSSAwSfT_1720a>(); L2SP_GSfPaT_2351[] productSuppliers = new L2SP_GSfPaT_2351[0]; #region Get Supplier Selection Areas var supplierSelectionAreasResult = cls_Get_SupplierSelectionAreas_for_Tenant.Invoke(Connection, Transaction, securityTicket); if (supplierSelectionAreasResult != null && supplierSelectionAreasResult.Result != null) { supplierSelectionAreaWithSuppliers.AddRange(supplierSelectionAreasResult.Result.Select(i => new L5PS_GSSAwSfT_1720a() { SupplierID = Guid.Empty, SupplierSelectionArea = i }).ToList()); } #endregion #region Get Product Suppliers P_L2SP_GSfPaT_2351 productSupplierParameter = new P_L2SP_GSfPaT_2351(); productSupplierParameter.ProductID = Parameter.ProductID; var productSuppliersResult = cls_Get_Suppliers_for_Product_and_Tenant.Invoke(Connection, Transaction, productSupplierParameter, securityTicket); if (productSuppliersResult != null && productSuppliersResult.Result != null) { productSuppliers = productSuppliersResult.Result; } #endregion #region Get Supplier Area Bindings ORM_CMN_PRO_Product_SupplierAreaBinding.Query supplierAreaBindingQuery = new ORM_CMN_PRO_Product_SupplierAreaBinding.Query(); supplierAreaBindingQuery.CMN_PRO_Product_RefID = Parameter.ProductID; supplierAreaBindingQuery.Tenant_RefID = securityTicket.TenantID; supplierAreaBindingQuery.IsDeleted = false; List <ORM_CMN_PRO_Product_SupplierAreaBinding> supplierAreaBindingList = ORM_CMN_PRO_Product_SupplierAreaBinding.Query.Search(Connection, Transaction, supplierAreaBindingQuery); foreach (var supplierArea in supplierAreaBindingList) { if (supplierArea.LOG_REG_SupplierSelectionArea_RefID == Guid.Empty) { supplierSelectionAreaWithSuppliers.Add(new L5PS_GSSAwSfT_1720a() { SupplierID = supplierArea.CMN_BPT_Supplier_RefID, SupplierSelectionArea = new L3SA_GSSAfT_1734() { LOG_REG_SupplierSelectionAreaID = Guid.Empty } }); } else if (supplierSelectionAreaWithSuppliers.Any(i => i.SupplierSelectionArea.LOG_REG_SupplierSelectionAreaID == supplierArea.LOG_REG_SupplierSelectionArea_RefID)) { supplierSelectionAreaWithSuppliers .First(i => i.SupplierSelectionArea.LOG_REG_SupplierSelectionAreaID == supplierArea.LOG_REG_SupplierSelectionArea_RefID) .SupplierID = supplierArea.CMN_BPT_Supplier_RefID; } } #endregion retVal.SupplierSelectionAreaWithSuppliers = supplierSelectionAreaWithSuppliers.ToArray(); retVal.Suppliers = productSuppliers; returnValue.Result = retVal; 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_L5PS_GSSAwSfT_1720 Invoke(DbConnection Connection, DbTransaction Transaction, P_L5PS_GSSAwSfT_1720 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, Transaction, null, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5PS_GSSAwSfT_1720 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5PS_GSSAwSfT_1720 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5PS_GSSAwSfT_1720 functionReturn = new FR_L5PS_GSSAwSfT_1720(); 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_SupplierSelectionArea_with_Suppliers_for_Tenant", ex); } return(functionReturn); }
///<summary> /// Opens the connection/transaction for the given connectionString, and closes them when complete ///<summary> public static FR_L5PS_GSSAwSfT_1720 Invoke(string ConnectionString, P_L5PS_GSSAwSfT_1720 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(null, null, ConnectionString, Parameter, securityTicket)); }