Пример #1
0
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_Guids Invoke(DbConnection Connection, DbTransaction Transaction, P_L5PR_RPHA_1546 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
Пример #2
0
        protected static FR_Guids Execute(DbConnection Connection, DbTransaction Transaction, P_L5PR_RPHA_1546 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guids();
            //Put your code here

            var updatedHeaders = new List <Guid>();

            foreach (var headerID in Parameter.HeaderIDs.Distinct().ToList())
            {
                var header = new ORM_ORD_PRC_RFP_RequestForProposal_Header().Load(Connection, Transaction, headerID);

                var potentialSuppliers = ORM_ORD_PRC_RFP_PotentialSupplier.Query.Search(Connection, Transaction,
                                                                                        new ORM_ORD_PRC_RFP_PotentialSupplier.Query()
                {
                    Tenant_RefID = securityTicket.TenantID,
                    RequestForProposal_Header_RefID = headerID,
                    IsDeleted = false
                }
                                                                                        );

                foreach (var supplier in Parameter.PotentialSuppliers.ToList())
                {
                    ORM_ORD_PRC_RFP_PotentialSupplier_History history = new ORM_ORD_PRC_RFP_PotentialSupplier_History();
                    history.ORD_PRC_RFP_PotentialSupplier_HistoryID = Guid.NewGuid();
                    history.ORD_PRC_RFP_PotentialSupplier_RefID     = supplier;
                    history.Comment = Parameter.HistoryModel.Comment;
                    history.IsEvent_ProposalRequest_Sent      = Parameter.HistoryModel.IsEvent_ProposalRequest_Sent;
                    history.IsEvent_ProposalResponse_Declined = Parameter.HistoryModel.IsEvent_ProposalResponse_Declined;
                    history.IsEvent_ProposalRequest_Revoked   = Parameter.HistoryModel.IsEvent_ProposalRequest_Revoked;
                    history.Tenant_RefID = securityTicket.TenantID;

                    history.Save(Connection, Transaction);
                }

                updatedHeaders.Add(headerID);
            }

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

            #endregion UserCode
        }
Пример #3
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_Guids Invoke(string ConnectionString, P_L5PR_RPHA_1546 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }
Пример #4
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_Guids Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5PR_RPHA_1546 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_Guids functionReturn = new FR_Guids();

            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_RequestProposal_HistoryAlteration", ex);
            }
            return(functionReturn);
        }