///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L3DC_GDAfSaP_0949 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L3DC_GDAfSaP_0949 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L3DC_GDAfSaP_0949 functionReturn = new FR_L3DC_GDAfSaP_0949(); 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_DiscountAmounts_for_SupplierID_and_ProductID", ex); } return(functionReturn); }
protected static FR_L3DC_GDAfSaP_0949 Execute(DbConnection Connection, DbTransaction Transaction, P_L3DC_GDAfSaP_0949 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L3DC_GDAfSaP_0949(); returnValue.Result = new L3DC_GDAfSaP_0949(); #region Discount Types var discountTypeParam = new CL2_DiscountType.Atomic.Retrieval.P_L2DT_GDTfGPMIL_1546(); discountTypeParam.GlobalPropertyMatchingID_List = DLCore_DBCommons.Utils.EnumUtils.GetAllEnumDescriptions <DLCore_DBCommons.APODemand.EDiscountType>().ToArray(); var discountTypes = CL2_DiscountType.Atomic.Retrieval.cls_Get_DiscountTypes_for_GlobalPropertyMatchingID_List.Invoke( Connection, Transaction, discountTypeParam, securityTicket).Result; #endregion #region Supplier Discounts var supplierDiscountValues = CL1_CMN_BPT.ORM_CMN_BPT_Supplier_DiscountValue.Query.Search(Connection, Transaction, new CL1_CMN_BPT.ORM_CMN_BPT_Supplier_DiscountValue.Query { Supplier_RefID = Parameter.SupplierID, IsDeleted = false, Tenant_RefID = securityTicket.TenantID }); #endregion #region Product Supplier Discounts var paramProductSupplierDiscount = new CL3_Discount.Atomic.Retrieval.P_L3DC_GPSDAfSoP_0957 { SupplierID = Parameter.SupplierID, ProductID = Parameter.ProductID }; var productSupplierDiscounts = CL3_Discount.Atomic.Retrieval.cls_Get_Product_Supplier_DiscountAmounts_for_SupplierID_or_ProductID.Invoke( Connection, Transaction, paramProductSupplierDiscount, securityTicket).Result; #endregion #region Bind data to returnValue returnValue.Result.SupplierDiscounts = supplierDiscountValues.Select(x => new L3DC_GDAfSaP_0949a { ORD_PRC_DiscountType_RefID = x.ORD_PRC_DiscountType_RefID, DiscountValue = x.DiscountValue_in_percent, DiscountType_GlobalPropertyMatchingID = discountTypes.Single(y => y.ORD_PRC_DiscountTypeID == x.ORD_PRC_DiscountType_RefID).GlobalPropertyMatchingID }).ToArray(); returnValue.Result.ProductSupplierDiscounts = productSupplierDiscounts.ToArray(); #endregion return(returnValue); #endregion UserCode }