예제 #1
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L3PR_GAwSPfT_1535_Array Invoke(string ConnectionString, P_L3PR_GAwSPfT_1535 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }
예제 #2
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L3PR_GAwSPfT_1535_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L3PR_GAwSPfT_1535 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L3PR_GAwSPfT_1535_Array functionReturn = new FR_L3PR_GAwSPfT_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_Articles_with_StandardPrices_for_Tenant", ex);
            }
            return(functionReturn);
        }
예제 #3
0
        protected static FR_L3PR_GAwSPfT_1535_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L3PR_GAwSPfT_1535 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L3PR_GAwSPfT_1535_Array();
            //Put your code here

            List <Guid> productList   = new List <Guid>();
            var         paramArticles = new CL3_Articles.Atomic.Retrieval.P_L3AR_GAfT_0942
            {
                ActiveComponent                     = Parameter.ActiveComponent,
                ActiveComponentStartWith            = Parameter.ActiveComponentStartWith,
                CustomArticlesGroupGlobalPropertyID = Parameter.CustomArticlesGroupGlobalPropertyID,
                DosageFormQuery                     = Parameter.DosageFormQuery,
                GeneralQuery           = Parameter.GeneralQuery,
                IsAvailableForOrdering = Parameter.IsAvailableForOrdering,
                LanguageID             = Parameter.LanguageID,
                ProducerName           = Parameter.ProducerName,
                ProductID            = Parameter.ProductID,
                ProductNameStartWith = Parameter.ProductNameStartWith,
                PZNQuery             = Parameter.PZNQuery,
                UnitQuery            = Parameter.UnitQuery,
                IsDefaultStock       = Parameter.IsPartOfDefaultStock
            };

            List <L3AR_GAfT_0942> articles = cls_Get_Articles_for_Tenant.Invoke(Connection, Transaction, paramArticles, securityTicket).Result.ToList();

            foreach (var item in articles)
            {
                productList.Add(item.CMN_PRO_ProductID);
            }

            List <L3PR_GAwSPfT_1535> results = new List <L3PR_GAwSPfT_1535>();

            if (productList.Count > 0)
            {
                var paramPrices = new CL3_Price.Complex.Retrieval.P_L3PR_GSPfPIL_1645
                {
                    ProductIDList = productList.ToArray()
                };

                var prices = CL3_Price.Complex.Retrieval.cls_Get_StandardPrices_for_ProductIDList.Invoke(Connection, Transaction, paramPrices, securityTicket).Result.ToList();

                foreach (var articl in articles)
                {
                    var articlesWithPrices = new L3PR_GAwSPfT_1535();

                    articlesWithPrices.Article = articl;
                    articlesWithPrices.Prices  = prices.Where(x => x.ProductID == articl.CMN_PRO_ProductID).Single();
                    results.Add(articlesWithPrices);
                }
            }

            returnValue.Result = results.ToArray();
            return(returnValue);

            #endregion UserCode
        }
예제 #4
0
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_L3PR_GAwSPfT_1535_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L3PR_GAwSPfT_1535 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }