///<summary> /// Opens the connection/transaction for the given connectionString, and closes them when complete ///<summary> public static FR_L5AS_GVBDfAP_2226_Array Invoke(string ConnectionString, P_L5AS_GVBDfAP_2226 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(null, null, ConnectionString, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5AS_GVBDfAP_2226_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5AS_GVBDfAP_2226 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5AS_GVBDfAP_2226_Array functionReturn = new FR_L5AS_GVBDfAP_2226_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_VariantBindingData_for_AssortmentProductID", ex); } return(functionReturn); }
protected static FR_L5AS_GVBDfAP_2226_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5AS_GVBDfAP_2226 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5AS_GVBDfAP_2226_Array(); //Put your code here #region Get product id from assortmentProduct ORM_CMN_PRO_ASS_AssortmentProduct assortmentProduct = new ORM_CMN_PRO_ASS_AssortmentProduct(); assortmentProduct.Load(Connection, Transaction, Parameter.AssortmentProductID); var productID = assortmentProduct.Ext_CMN_PRO_Product_RefID; #endregion #region Get all assortmentVariants var assortmentVariants = cls_Get_AssortmentVariants_for_ProductID.Invoke(Connection, Transaction, new P_L5AS_GAVfP_2216() { ProductID = productID }, securityTicket).Result.ToList(); #endregion List <L5AS_GVBDfAP_2226> resultList = new List <L5AS_GVBDfAP_2226>(); foreach (var assortmentVariant in assortmentVariants) { L5AS_GVBDfAP_2226 resultItem = new L5AS_GVBDfAP_2226(); resultItem.AssProductVariantID = assortmentVariant.CMN_PRO_Product_VariantID; resultItem.AssProductVariantName = assortmentVariant.VariantName_DictID; resultItem.AssVariantID = assortmentVariant.CMN_PRO_ASS_AssortmentVariantID; var assortmentVendorVariants = cls_Get_AssortmentVendorVariants_for_AssortmentVariant.Invoke(Connection, Transaction, new P_L5AS_GAVVfAV_2218() { AssortmentVariantID = assortmentVariant.CMN_PRO_ASS_AssortmentVariantID }, securityTicket).Result; List <L5AS_GVBDfAP_2226a> assVendorVariants = new List <L5AS_GVBDfAP_2226a>(); if (assortmentVendorVariants != null && assortmentVendorVariants.Count() > 0) { foreach (var assortmentVendorVariant in assortmentVendorVariants) { L5AS_GVBDfAP_2226a assVendorVariant = new L5AS_GVBDfAP_2226a(); assVendorVariant.BoundedProductID = assortmentVendorVariant.BoundToProductID; assVendorVariant.BoundedVariantID = assortmentVendorVariant.BoundToVariantID; assVendorVariants.Add(assVendorVariant); } } resultItem.VendorVariants = assVendorVariants.ToArray(); resultList.Add(resultItem); } returnValue.Result = resultList.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_L5AS_GVBDfAP_2226_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L5AS_GVBDfAP_2226 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, Transaction, null, Parameter, securityTicket)); }