public void MovementPickUp_01(string MHId, string TransactionId, MovementPickUp_01Doc aMovementPickUp_01Doc)
        {
            EnterProc();

            MovementPickUp_01Insert aMovementPickUp_01Handler;

            try
            {
                MessageTransaction mt = BeginWebmethod(MHId, TransactionId, "MOVM_PICKUP_01");

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

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

            finally
            {
                EndWebmethod();
            }

            ExitProc();

            return;
        }
예제 #2
0
        protected MessageTransaction BeginWebmethod(string mhId, string msgSendId, string objectName)
        {
            string ConnectionString;

            try
            {
                ConnectionString = GetWebConfig(mhId);
            }
            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(mhId, msgSendId, objectName, db);

            return(mt);
        }
예제 #3
0
    public void Process(ref MessageTransaction trans, SegmentImpl parent, MovementPickUp_01Doc p)
    {
        StringBuilder error = new StringBuilder();

        if (p == null)
        {
            // No data is available - abort
            throw new NullReferenceException("Failed to process message " + p.GetType() + ". Message structure is empty (null).");
        }

        fStmt.Transaction = trans.Transaction;

        if (p.OPCODE == null)
        {
            error.AppendLine("Invalid Opcode (null) in " + p.GetType());
        }
        else
        {
            bool OpcodeValid = false;
            OpcodeValid |= (p.OPCODE == "0");
            OpcodeValid |= (p.OPCODE == "1");

            if (!OpcodeValid)
            {
                error.AppendLine("Opcode not supported/invalid (" + p.OPCODE + ") in " + p.GetType());
            }
        }

        (fStmt.Parameters["MAPI_IN_ID"] as IDbDataParameter).Value = StringValue(trans.MapiInId);

        (fStmt.Parameters["SEQNUM"] as IDbDataParameter).Value = NumberValue(trans.TransSeq);

        if (p.OPCODE != null)
        {
            if (p.OPCODE.Length > 1)
                error.AppendLine("Value for MovementPickUp_01Doc.OPCODE too long, max 1 chars");

            (fStmt.Parameters["OPCODE"] as IDbDataParameter).Value = p.OPCODE;
        }
        else
            (fStmt.Parameters["OPCODE"] as IDbDataParameter).Value = DBNull.Value;

        if (p.MaterialHandlingSystemId != null)
        {
            if (p.MaterialHandlingSystemId.Length > 35)
                error.AppendLine("Value for MovementPickUp_01Doc.MaterialHandlingSystemId too long, max 35 chars");

            if (p.MaterialHandlingSystemId.Length == 0)
                error.AppendLine("Zero length for mandatory parameter MovementPickUp_01Doc.MaterialHandlingSystemId not allowed");

            (fStmt.Parameters["MaterialHandlingSystemId"] as IDbDataParameter).Value = p.MaterialHandlingSystemId;
        }
        else
            error.AppendLine("Null value for mandatory parameter MovementPickUp_01Doc.MaterialHandlingSystemId not allowed");


        if (p.MovementOrder != null)
        {
            (fStmt.Parameters["MovementOrder"] as IDbDataParameter).Value = p.MovementOrder;
        }
        else
            error.AppendLine("Null value for mandatory parameter MovementPickUp_01Doc.MovementOrder not allowed");


        if (p.SequenceNumber != null)
        {
            (fStmt.Parameters["SequenceNumber"] as IDbDataParameter).Value = p.SequenceNumber;
        }
        else
            error.AppendLine("Null value for mandatory parameter MovementPickUp_01Doc.SequenceNumber not allowed");


        if (p.MovementTaskStatus != null)
        {
            if (p.MovementTaskStatus.Length > 255)
                error.AppendLine("Value for MovementPickUp_01Doc.MovementTaskStatus too long, max 255 chars");

            if (p.MovementTaskStatus.Length == 0)
                error.AppendLine("Zero length for mandatory parameter MovementPickUp_01Doc.MovementTaskStatus not allowed");

            (fStmt.Parameters["MovementTaskStatus"] as IDbDataParameter).Value = p.MovementTaskStatus;
        }
        else
            error.AppendLine("Null value for mandatory parameter MovementPickUp_01Doc.MovementTaskStatus not allowed");


        if (error.Length > 0)
        {
            throw (new Exception(error.ToString()));
        }

        trans.TransSeq++;

        fStmt.ExecuteNonQuery();

      }