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

            ORM_ORD_CUO_RFP_RequestForProposal_Header customerHeader = new ORM_ORD_CUO_RFP_RequestForProposal_Header();

            var incrNumberParam = new CL2_NumberRange.Complex.Retrieval.P_L2NR_GaIINfUA_1454()
            {
                GlobalStaticMatchingID = DLCore_DBCommons.Utils.EnumUtils.GetEnumDescription(DLCore_DBCommons.APODemand.ENumberRangeUsageAreaType.CUORequestProposalNumberCustomer)
            };

            var requestProposalNumber = CL2_NumberRange.Complex.Retrieval.
                                        cls_Get_and_Increase_IncreasingNumber_for_UsageArea.Invoke(Connection, Transaction, incrNumberParam, securityTicket).Result.Current_IncreasingNumber;

            customerHeader.ORD_CUO_RFO_RequestForProposal_HeaderID = Guid.NewGuid();
            customerHeader.CompleteDeliveryUntillDate          = Parameter.CompleteDeliveryUntil;
            customerHeader.RequestForProposalHeaderITPL        = Parameter.RequestForProposalHeaderITPL;
            customerHeader.ProposalDeadline                    = Parameter.ProposalDeadline;
            customerHeader.RequestingBusinessParticipant_RefID = Parameter.RequestingBusinessParticipant;
            customerHeader.RequestForProposal_Number           = requestProposalNumber;
            customerHeader.Tenant_RefID = securityTicket.TenantID;
            customerHeader.Save(Connection, Transaction);

            ORM_ORD_CUO_RFP_RequestForProposal_History customerProposalHistory = new ORM_ORD_CUO_RFP_RequestForProposal_History();
            customerProposalHistory.ORD_CUO_RFP_RequestForProposal_HistoryID = Guid.NewGuid();
            customerProposalHistory.RequestForProposal_Header_RefID          = customerHeader.ORD_CUO_RFO_RequestForProposal_HeaderID;
            customerProposalHistory.Tenant_RefID = securityTicket.TenantID;
            customerProposalHistory.Save(Connection, Transaction);

            ORM_HEC_CUO_RFP_RequestForProposal_Header hecHeader = new ORM_HEC_CUO_RFP_RequestForProposal_Header();
            hecHeader.HEC_CUO_RFP_RequestForProposal_HeaderID         = Guid.NewGuid();
            hecHeader.Ext_ORD_CUO_RFP_RequestForProposal_Header_RefID = customerHeader.ORD_CUO_RFO_RequestForProposal_HeaderID;
            hecHeader.Tenant_RefID = securityTicket.TenantID;
            hecHeader.Save(Connection, Transaction);

            foreach (var position in Parameter.Positions.ToList())
            {
                ORM_ORD_CUO_RFP_RequestForProposal_Position customerPosition = new ORM_ORD_CUO_RFP_RequestForProposal_Position();
                customerPosition.ORD_CUO_RFP_RequestForProposal_PositionID = Guid.NewGuid();
                customerPosition.RequestForProposalPositionITPL            = position.RequestForProposalPositionITPL;
                customerPosition.Quantity = position.Quantity;
                customerPosition.CMN_PRO_Product_RefID           = position.ProductID;
                customerPosition.DeliveryUntillDate              = position.LatestDateOfDelivery;
                customerPosition.IsReplacementPermitted          = position.IsReplacementAllowed;
                customerPosition.RequestForProposal_Header_RefID = customerHeader.ORD_CUO_RFO_RequestForProposal_HeaderID;
                customerPosition.Tenant_RefID = securityTicket.TenantID;
                customerPosition.Save(Connection, Transaction);

                ORM_HEC_CUO_RFP_RequestForProposal_Position hecPosition = new ORM_HEC_CUO_RFP_RequestForProposal_Position();
                hecPosition.HEC_CUO_RFP_RequestForProposal_PositionID         = Guid.NewGuid();
                hecPosition.Ext_ORD_CUO_RFP_RequestForProposal_Position_RefID = customerPosition.ORD_CUO_RFP_RequestForProposal_PositionID;
                hecPosition.Tenant_RefID = securityTicket.TenantID;
                hecPosition.Save(Connection, Transaction);
            }

            returnValue.Result = customerHeader.ORD_CUO_RFO_RequestForProposal_HeaderID;

            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_Guid Invoke(DbConnection Connection, DbTransaction Transaction, P_L5PR_CCRP_1631 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_Guid Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5PR_CCRP_1631 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_Guid functionReturn = new FR_Guid();

            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_Create_CustomerRequestProposal", 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_Guid Invoke(string ConnectionString, P_L5PR_CCRP_1631 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }