Exemplo n.º 1
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5PR_GRPwADfTID_1145 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5PR_GRPwADfTID_1145 functionReturn = new FR_L5PR_GRPwADfTID_1145();

            try
            {
                if (cleanupConnection == true)
                {
                    Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }
                if (cleanupTransaction == true)
                {
                    Transaction = Connection.BeginTransaction();
                }

                functionReturn = Execute(Connection, Transaction, 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_RequestProposals_with_ArticleDetails_for_TenantID", ex);
            }
            return(functionReturn);
        }
Exemplo n.º 2
0
        protected static FR_L5PR_GRPwADfTID_1145 Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5PR_GRPwADfTID_1145();
            //Put your code here

            var proposalsParameter = new P_L5PR_GRPfTID_1136();
            proposalsParameter.IsEvent_ProposalRequest_Sent = true;

            var proposals = cls_Get_RequestProposals_for_TenantID.Invoke(Connection, Transaction, proposalsParameter, securityTicket).Result.ToList();

            List <Guid> articlesList = new List <Guid>();
            foreach (var proposal in proposals)
            {
                articlesList.Add(proposal.CMN_PRO_Product_RefID);
            }

            var articlesParameter = new P_L3AR_GAfAL_0942();
            articlesParameter.ProductID_List = articlesList.ToArray();

            var articles = new List <L3AR_GAfAL_0942>();

            if (articlesList.Count > 0)
            {
                articles = cls_Get_Articles_for_ArticleList.Invoke(Connection, Transaction, articlesParameter, securityTicket).Result.ToList();
            }

            List <L5PR_GRPwADfTID_1145a> proposalsWithDetails = new List <L5PR_GRPwADfTID_1145a>();

            foreach (var proposal in proposals)
            {
                L5PR_GRPwADfTID_1145a tempProposalWithDetails = new L5PR_GRPwADfTID_1145a();
                tempProposalWithDetails.Proposal = proposal;
                tempProposalWithDetails.Article  = articles.Where(ar => ar.CMN_PRO_ProductID == proposal.CMN_PRO_Product_RefID).Single();
                proposalsWithDetails.Add(tempProposalWithDetails);
            }

            returnValue.Result = new L5PR_GRPwADfTID_1145();
            returnValue.Result.ProposalsWithArticleDetails = proposalsWithDetails.ToArray();

            return(returnValue);

            #endregion UserCode
        }