public void MovementDrop_01(string MHId, string TransactionId, MovementDrop_01Doc aMovementDrop_01Doc)
        {
            EnterProc();

            MovementDrop_01Insert aMovementDrop_01Handler;

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

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

                try
                {
                    if (aMovementDrop_01Doc == null)
                    {
                        Exception InternalError = new Exception("DataError: Root object cannot be null");
                        throw (InternalError);
                    }
                    aMovementDrop_01Handler.Process(ref mt, null, aMovementDrop_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;
        }
Ejemplo n.º 2
0
    public void Process(ref MessageTransaction trans, SegmentImpl parent, MovementDrop_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 MovementDrop_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 MovementDrop_01Doc.MaterialHandlingSystemId too long, max 35 chars");

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

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


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


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


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

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

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


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

        trans.TransSeq++;

        fStmt.ExecuteNonQuery();

      }