Esempio n. 1
0
        protected static FR_Guids Execute(DbConnection Connection, DbTransaction Transaction, P_L5PR_URR_1402 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guids();
            //Put your code here

            #region DeletePreviousResponseAndPositions

            var supplierProposalResponseHeader = new ORM_ORD_PRC_RFP_SupplierProposalResponse_Header();
            supplierProposalResponseHeader.Load(Connection, Transaction, Guid.Parse(Parameter.RequestResponseITPL));

            var responseProposalPositions = ORM_ORD_PRC_RFP_SupplierProposalResponse_Position.Query.Search(Connection, Transaction,
                                                                                                           new ORM_ORD_PRC_RFP_SupplierProposalResponse_Position.Query()
            {
                SupplierProposalResponseHeader_RefID = supplierProposalResponseHeader.ORD_PRC_RFP_SupplierProposalResponse_HeaderID,
                Tenant_RefID = securityTicket.TenantID
            }
                                                                                                           );

            foreach (var responseProposalPosition in responseProposalPositions)
            {
                responseProposalPosition.Save(Connection, Transaction);
            }
            supplierProposalResponseHeader.Save(Connection, Transaction);

            #endregion

            //TO DO - CHECK IF HISTORY NEED TO BE UPDATED FOR INITIAL REQUEST PROPOSAL
            //ORM_ORD_PRC_RFP_RequestForProposal_Header requestHeader = new ORM_ORD_PRC_RFP_RequestForProposal_Header();
            //requestHeader.Load(Connection, Transaction, Guid.Parse(Parameter.RequestForProposalITPL));

            var responseCreationParameter = new P_L5PR_CRR_1429();
            responseCreationParameter.CreatedFor_RequestForProposal_Header_RefID = Guid.Parse(Parameter.RequestForProposalITPL);
            responseCreationParameter.ProposalResponseHeaderITPL = Parameter.RequestResponseITPL;
            responseCreationParameter.OfferReceivedFrom_RegisteredBusinessParticipant_RefID = Guid.NewGuid(); //TO DO - registered business participant
            responseCreationParameter.ValidThrough = DateTime.Now;                                            //TO DO - check what ValidThrough time should be

            List <P_L5PR_CRR_1429a> creationResponsePositions = new List <P_L5PR_CRR_1429a>();

            foreach (var position in Parameter.RequestResponsePositions.ToList())
            {
                P_L5PR_CRR_1429a tempResponsePosition = new P_L5PR_CRR_1429a();
                tempResponsePosition.Quantity = position.Quantity;
                tempResponsePosition.ProposalResponsePositionITPL = position.RequestResponsePositionITPL;
                tempResponsePosition.ProductID            = Guid.NewGuid(); //TO DO - find ProductID using ProductITL
                tempResponsePosition.IsReplacementProduct = position.IsReplacementProduct;
                tempResponsePosition.Created_From_RequestForProposal_Position_RefID = Guid.Parse(Parameter.RequestForProposalITPL);

                creationResponsePositions.Add(tempResponsePosition);
            }

            responseCreationParameter.ProposalRequestPositions = creationResponsePositions.ToArray();

            var savedResponseHeader = cls_Create_RequestResponse.Invoke(Connection, Transaction, responseCreationParameter, securityTicket).Result;

            returnValue.Result = new Guid[] { savedResponseHeader };

            return(returnValue);

            #endregion UserCode
        }
Esempio n. 2
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_URR_1402 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
Esempio n. 3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_Guids Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5PR_URR_1402 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_Update_RequestResponse", ex);
            }
            return(functionReturn);
        }
Esempio n. 4
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_URR_1402 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }