Пример #1
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L5AR_GWSAfAG_0908_Array Invoke(string ConnectionString, P_L5AR_GWSAfAG_0908 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_L5AR_GWSAfAG_0908_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5AR_GWSAfAG_0908 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5AR_GWSAfAG_0908_Array functionReturn = new FR_L5AR_GWSAfAG_0908_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_WebShopArticles_for_ArticleGroup", ex);
            }
            return(functionReturn);
        }
Пример #3
0
        protected static FR_L5AR_GWSAfAG_0908_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5AR_GWSAfAG_0908 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5AR_GWSAfAG_0908_Array();

            var paramArticles = new CL3_Articles.Atomic.Retrieval.P_L3AR_GAfT_0942
            {
                ActiveComponent                     = Parameter.ActiveComponent,
                ActiveComponentStartWith            = Parameter.ActiveComponentStartWith,
                CustomArticlesGroupGlobalPropertyID = Parameter.ArticlesGroupGlobalPropertyID,
                DosageFormQuery                     = Parameter.DosageFormQuery,
                GeneralQuery           = Parameter.GeneralQuery,
                IsAvailableForOrdering = true,
                LanguageID             = Parameter.LanguageID,
                ProducerName           = Parameter.ProducerName,
                ProductNameStartWith   = Parameter.ProductNameStartWith,
                PZNQuery  = Parameter.PZNQuery,
                UnitQuery = Parameter.UnitQuery,
            };

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

            #region Get Prices

            var subscribedCatalogID = articles.Select(i => i.IfImportedFromExternalCatalog_CatalogSubscription_RefID).Distinct().SingleOrDefault();

            var subscribedCatalog = new ORM_CMN_PRO_SubscribedCatalog();
            subscribedCatalog.Load(Connection, Transaction, subscribedCatalogID);

            var param = new P_L2PR_GPVfSC_1424()
            {
                SubscribedCatalogITL = subscribedCatalog.CatalogCodeITL
            };

            var prices = cls_Get_PriceValues_for_SubscribedCatalogITL.Invoke(Connection, Transaction, param, securityTicket).Result;
            #endregion

            List <L5AR_GWSAfAG_0908> results = new List <L5AR_GWSAfAG_0908>();
            foreach (var article in articles)
            {
                var articlesWithPrices = new L5AR_GWSAfAG_0908();

                articlesWithPrices.Article = article;
                articlesWithPrices.Price   = prices.Where(x => x.CMN_PRO_Product_RefID == article.CMN_PRO_ProductID).Select(j => j.PriceAmount).SingleOrDefault();
                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_L5AR_GWSAfAG_0908_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L5AR_GWSAfAG_0908 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }