예제 #1
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5AR_GPDfASP_1604 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5AR_GPDfASP_1604 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5AR_GPDfASP_1604 functionReturn = new FR_L5AR_GPDfASP_1604();

            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_PreloadingData_for_ArticleSellingPrice", ex);
            }
            return(functionReturn);
        }
예제 #2
0
        protected static FR_L5AR_GPDfASP_1604 Execute(DbConnection Connection, DbTransaction Transaction, P_L5AR_GPDfASP_1604 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5AR_GPDfASP_1604();
            returnValue.Result = new L5AR_GPDfASP_1604();

            #region DefaultCurrency

            var dafaultCurrency = cls_Get_DefaultCurrency_for_Tenant.Invoke(Connection, Transaction, securityTicket).Result;

            #endregion

            #region Prices

            P_L5AR_GPaPfAaCID_1020 pricesParam = new P_L5AR_GPaPfAaCID_1020();
            pricesParam.ArticleID  = Parameter.ArticleID;
            pricesParam.CurrencyID = dafaultCurrency.CMN_CurrencyID;
            var pricesAndPricelists = cls_Get_Pricelists_and_Prices_for_Article_and_Currency_ID.Invoke(Connection, Transaction, pricesParam, securityTicket).Result;

            returnValue.Result.PricesAndPricelists = pricesAndPricelists;
            #endregion

            #region Articles

            var article = cls_Get_Product_for_TenantID.Invoke(Connection, Transaction, securityTicket).Result.Where(a => a.CMN_PRO_ProductID == Parameter.ArticleID).Single();
            returnValue.Result.Product = article;

            #endregion

            #region Formulas

            var formulas = cls_Get_AllDynamicPricingFormulas_for_TenantID.Invoke(Connection, Transaction, securityTicket).Result;
            returnValue.Result.Formulas = formulas;

            #endregion

            #region Standard Prices

            var standardPricesParam = new P_L3PR_GSPfPIL_1645()
            {
                ProductIDList = new Guid[1] {
                    Parameter.ArticleID
                }
            };
            var standardprice = cls_Get_StandardPrices_for_ProductIDList.Invoke(Connection, Transaction, standardPricesParam, securityTicket).Result.SingleOrDefault();
            returnValue.Result.StandardPrices = standardprice;
            #endregion

            return(returnValue);

            #endregion UserCode
        }