コード例 #1
0
        protected static FR_L6AD_GDfPR_1535_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L6AD_GDfPR_1535 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L6AD_GDfPR_1535_Array();
            //Put your code here
            returnValue.Result = new FR_L6AD_GDfPR_1535_Array().Result;

            var ShippedArticles = cls_Get_ProductList_for_ShipmentPositionsByFilterDate.Invoke(Connection, Transaction, new P_L6AD_GPLfSPBFD_1828 {
                DateFrom = Parameter.DateFrom, DateTo = Parameter.DateTo, CustomerID = Parameter.Customer
            }, securityTicket).Result.ToList();

            var returnResultList = new List <L6AD_GDfPR_1535>();

            L6AD_GDfPR_1535 result = null;
            if (ShippedArticles.Any())
            {
                var ProductGuidList = ShippedArticles.Select(x => x.CMN_PRO_ProductID).ToArray();


                var averageProcurementPrices = cls_Get_AverageProcurementPrices_for_ArticleList.Invoke(Connection, Transaction, new P_L6AD_GAPPfAL_1842 {
                    ProductIDList = ProductGuidList
                }, securityTicket).Result.ToList();
                var procurementPricesFromProductSuppliers = cls_Get_ProcurementPricesFromProductSuppliers_for_ArticleList.Invoke(Connection, Transaction, new P_L6AD_GPFPSfAL_1027 {
                    ProductIDList = ProductGuidList
                }, securityTicket).Result.ToList();
                var ABDAPrices = cls_Get_StandardPrices_for_ProductIDList.Invoke(Connection, Transaction, new P_L3PR_GSPfPIL_1645 {
                    ProductIDList = ProductGuidList
                }, securityTicket).Result.ToList();

                foreach (var product in ShippedArticles)
                {
                    var averageProcurementPrice = averageProcurementPrices.SingleOrDefault(x => x.Product_RefID == product.CMN_PRO_ProductID);
                    if (averageProcurementPrice != null && averageProcurementPrice.PriceValue_Amount != 0)
                    {
                        if (averageProcurementPrice.PriceValue_Amount > Parameter.ProcurementPrice && averageProcurementPrice.PriceValue_Amount > 0)
                        {
                            result                 = new L6AD_GDfPR_1535();
                            result.Price           = Math.Round((decimal)averageProcurementPrice.PriceValue_Amount, 2);
                            result.PZN             = product.Product_Number;
                            result.ProductName     = product.Product_Name.Contents[0].Content;
                            result.ShippedQuantity = product.QuantityToShip;
                            returnResultList.Add(result);
                        }
                        continue;
                    }
                    else
                    {
                        var procurementPrice_FromProductSuppliers = procurementPricesFromProductSuppliers.SingleOrDefault(x => x.CMN_PRO_Product_RefID == product.CMN_PRO_ProductID);
                        if (procurementPrice_FromProductSuppliers != null && procurementPrice_FromProductSuppliers.PriceValue_Amount != 0)
                        {
                            if (procurementPrice_FromProductSuppliers.PriceValue_Amount > Parameter.ProcurementPrice && procurementPrice_FromProductSuppliers.PriceValue_Amount > 0)
                            {
                                result                 = new L6AD_GDfPR_1535();
                                result.Price           = Math.Round((decimal)procurementPrice_FromProductSuppliers.PriceValue_Amount, 2);
                                result.PZN             = product.Product_Number;
                                result.ProductName     = product.Product_Name.Contents[0].Content;
                                result.ShippedQuantity = product.QuantityToShip;
                                returnResultList.Add(result);
                            }
                            continue;
                        }
                        else
                        {
                            var ABDAPrice = ABDAPrices.SingleOrDefault(x => x.ProductID == product.CMN_PRO_ProductID);
                            if (ABDAPrice != null && ABDAPrice.AbdaPrice != 0)
                            {
                                if (ABDAPrice.AbdaPrice > (decimal)Parameter.ProcurementPrice && ABDAPrice.AbdaPrice > 0)
                                {
                                    result                 = new L6AD_GDfPR_1535();
                                    result.Price           = Math.Round(ABDAPrice.AbdaPrice, 2);
                                    result.PZN             = product.Product_Number;
                                    result.ProductName     = product.Product_Name.Contents[0].Content;
                                    result.ShippedQuantity = product.QuantityToShip;
                                    returnResultList.Add(result);
                                }
                            }
                        }
                    }
                }

                returnValue.Result = returnResultList.ToArray();
            }
            else
            {
                returnValue.Result = null;
            }

            return(returnValue);

            #endregion UserCode
        }
コード例 #2
0
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_L6AD_GDfPR_1535_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L6AD_GDfPR_1535 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
コード例 #3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L6AD_GDfPR_1535_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L6AD_GDfPR_1535 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L6AD_GDfPR_1535_Array functionReturn = new FR_L6AD_GDfPR_1535_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_Data_for_ProcurementPrices", ex);
            }
            return(functionReturn);
        }
コード例 #4
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L6AD_GDfPR_1535_Array Invoke(string ConnectionString, P_L6AD_GDfPR_1535 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }