public void MethodOfShipment(string CommPartnerId, string TransactionId, MethodOfShipmentDoc aMethodOfShipmentDoc)
        {
            EnterProc();

            MethodOfShipmentInsert aMethodOfShipmentHandler;

            try
            {
                MessageTransaction mt = BeginWebmethod(CommPartnerId, TransactionId, "MOS");

                try
                {
                    aMethodOfShipmentHandler = new MethodOfShipmentInsert(this);
                }
                catch (Exception e)
                {
                    Exception InternalError = new Exception("InternalError: Building insert handler", e);
                    throw (InternalError);
                }

                try
                {
                    if (aMethodOfShipmentDoc == null)
                    {
                        Exception InternalError = new Exception("DataError: Root object cannot be null");
                        throw (InternalError);
                    }
                    aMethodOfShipmentHandler.Process(ref mt, null, aMethodOfShipmentDoc);
                    GetDataBase().Commit();
                }
                catch (Exception e)
                {
                    try
                    {
                        GetDataBase().Rollback();
                    }
                    catch (Exception)
                    {}
                    Exception InternalError = new Exception("DataError: Error processing data", e);
                    throw (InternalError);
                }
            }

            finally
            {
                EndWebmethod();
            }

            ExitProc();

            return;
        }
        public void CustomerOrder(string CommPartnerId, string TransactionId, CustomerOrderDoc aCustomerOrderDoc)
        {
            EnterProc();

            CustomerOrderInsert aCustomerOrderHandler;

            try
            {
                MessageTransaction mt = BeginWebmethod(CommPartnerId, TransactionId, "CUSORD");

                try
                {
                    aCustomerOrderHandler = new CustomerOrderInsert(this);
                }
                catch (Exception e)
                {
                    Exception InternalError = new Exception("InternalError: Building insert handler", e);
                    throw (InternalError);
                }

                try
                {
                    if (aCustomerOrderDoc == null)
                    {
                        Exception InternalError = new Exception("DataError: Root object cannot be null");
                        throw (InternalError);
                    }
                    aCustomerOrderHandler.Process(ref mt, null, aCustomerOrderDoc);
                    GetDataBase().Commit();
                }
                catch (Exception e)
                {
                    try
                    {
                        GetDataBase().Rollback();
                    }
                    catch (Exception)
                    {}
                    Exception InternalError = new Exception("DataError: Error processing data", e);
                    throw (InternalError);
                }
            }

            finally
            {
                EndWebmethod();
            }

            ExitProc();

            return;
        }
        public void VehicleTypePTT(string CommPartnerId, string TransactionId, VehicleTypePTTDoc aVehicleTypePTTDoc)
        {
            EnterProc();

            VehicleTypePTTInsert aVehicleTypePTTHandler;

            try
            {
                MessageTransaction mt = BeginWebmethod(CommPartnerId, TransactionId, "VEHTYP_PTT");

                try
                {
                    aVehicleTypePTTHandler = new VehicleTypePTTInsert(this);
                }
                catch (Exception e)
                {
                    Exception InternalError = new Exception("InternalError: Building insert handler", e);
                    throw (InternalError);
                }

                try
                {
                    if (aVehicleTypePTTDoc == null)
                    {
                        Exception InternalError = new Exception("DataError: Root object cannot be null");
                        throw (InternalError);
                    }
                    aVehicleTypePTTHandler.Process(ref mt, null, aVehicleTypePTTDoc);
                    GetDataBase().Commit();
                }
                catch (Exception e)
                {
                    try
                    {
                        GetDataBase().Rollback();
                    }
                    catch (Exception)
                    {}
                    Exception InternalError = new Exception("DataError: Error processing data", e);
                    throw (InternalError);
                }
            }

            finally
            {
                EndWebmethod();
            }

            ExitProc();

            return;
        }
        public void DepartureNodeTransitNode(string CommPartnerId, string TransactionId, DepartureNodeTransitNodeDoc aDepartureNodeTransitNodeDoc)
        {
            EnterProc();

            DepartureNodeTransitNodeInsert aDepartureNodeTransitNodeHandler;

            try
            {
                MessageTransaction mt = BeginWebmethod(CommPartnerId, TransactionId, "NEW_DEP_NODTRNOD");

                try
                {
                    aDepartureNodeTransitNodeHandler = new DepartureNodeTransitNodeInsert(this);
                }
                catch (Exception e)
                {
                    Exception InternalError = new Exception("InternalError: Building insert handler", e);
                    throw (InternalError);
                }

                try
                {
                    if (aDepartureNodeTransitNodeDoc == null)
                    {
                        Exception InternalError = new Exception("DataError: Root object cannot be null");
                        throw (InternalError);
                    }
                    aDepartureNodeTransitNodeHandler.Process(ref mt, null, aDepartureNodeTransitNodeDoc);
                    GetDataBase().Commit();
                }
                catch (Exception e)
                {
                    try
                    {
                        GetDataBase().Rollback();
                    }
                    catch (Exception)
                    {}
                    Exception InternalError = new Exception("DataError: Error processing data", e);
                    throw (InternalError);
                }
            }

            finally
            {
                EndWebmethod();
            }

            ExitProc();

            return;
        }
Esempio n. 5
0
        protected MessageTransaction BeginWebmethod(string commPartnerId, string msgSendId, string objectName)
        {
            string ConnectionString;

            try
            {
                ConnectionString = GetWebConfig(commPartnerId);
            }
            catch (Exception e)
            {
                Exception WebConfigError = new Exception("WebConfigError: File format error", e);
                throw (WebConfigError);
            }

            if (ConnectionString == null)
            {
                Exception WebConfigContentsMissing = new Exception("WebConfigError: No ConnectionString matches the received identity");
                throw (WebConfigContentsMissing);
            }

            try
            {
                db = new Database(ConnectionString);
            }
            catch (Exception e)
            {
                Exception WebConfigContentsError = new Exception("WebConfigError: Database connection failed", e);
                throw (WebConfigContentsError);
            }

            db.StartTransaction();

            MessageTransaction mt = new MessageTransaction(commPartnerId, msgSendId, objectName, db);

            return(mt);
        }