protected static FR_Base Execute(DbConnection Connection, DbTransaction Transaction, P_L5ZL_DLPaAST_1523 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_Base();
            //Put your code here

            ORM_LOG_LogisticsProvider logisticProvider = new ORM_LOG_LogisticsProvider();
            logisticProvider.Load(Connection, Transaction, Parameter.LogisticProviderID);

            ORM_CMN_BPT_AvailableShipmentType.Query availableShipmentTypeQuery = new ORM_CMN_BPT_AvailableShipmentType.Query();
            availableShipmentTypeQuery.CMN_BPT_BusinessParticipant_RefID = logisticProvider.Ext_CMN_BPT_BusinessParticipant_RefID;
            availableShipmentTypeQuery.Tenant_RefID = securityTicket.TenantID;
            availableShipmentTypeQuery.IsDeleted    = false;

            // delete all shipment types for this logistic provider
            var numberOfDeletedTypes = ORM_CMN_BPT_AvailableShipmentType.Query.SoftDelete(Connection, Transaction, availableShipmentTypeQuery);

            // delete that logistic provider
            logisticProvider.IsDeleted = true;
            logisticProvider.Save(Connection, Transaction);

            return(returnValue);

            #endregion UserCode
        }
Esempio n. 2
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L3L_SLP_1114 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_Guid();
            //Put your code here

            // CREATE NEW
            if (Parameter.LogisticProviderID == Guid.Empty)
            {
                ORM_CMN_BPT_BusinessParticipant bp = new ORM_CMN_BPT_BusinessParticipant();
                bp.CMN_BPT_BusinessParticipantID = Guid.NewGuid();
                bp.DisplayName  = Parameter.Name;
                bp.IsCompany    = true;
                bp.Tenant_RefID = securityTicket.TenantID;
                bp.Save(Connection, Transaction);

                ORM_LOG_LogisticsProvider logisticProvider = new ORM_LOG_LogisticsProvider();
                logisticProvider.LOG_LogisticsProviderID = Guid.NewGuid();
                logisticProvider.Ext_CMN_BPT_BusinessParticipant_RefID = bp.CMN_BPT_BusinessParticipantID;
                logisticProvider.IsProviding_TransportServices         = Parameter.IsProvidingTransportServices;
                logisticProvider.IsTrackingAvailable = Parameter.IsTrackingAvailable;
                logisticProvider.Tenant_RefID        = securityTicket.TenantID;
                logisticProvider.Save(Connection, Transaction);

                returnValue.Result = logisticProvider.LOG_LogisticsProviderID;
            }
            // UPDATE EXISTING
            else
            {
                ORM_LOG_LogisticsProvider logisticProvider = new ORM_LOG_LogisticsProvider();
                logisticProvider.Load(Connection, Transaction, Parameter.LogisticProviderID);

                logisticProvider.IsProviding_TransportServices = Parameter.IsProvidingTransportServices;
                logisticProvider.IsTrackingAvailable           = Parameter.IsTrackingAvailable;
                logisticProvider.Save(Connection, Transaction);

                ORM_CMN_BPT_BusinessParticipant bp = new ORM_CMN_BPT_BusinessParticipant();
                bp.Load(Connection, Transaction, logisticProvider.Ext_CMN_BPT_BusinessParticipant_RefID);

                bp.DisplayName = Parameter.Name;
                bp.Save(Connection, Transaction);

                returnValue.Result = Parameter.LogisticProviderID;
            }

            return(returnValue);

            #endregion UserCode
        }