Esempio n. 1
0
        public void StatusUpdate_01(string MHId, string TransactionId, StatusUpdate_01Doc aStatusUpdate_01Doc)
        {
            EnterProc();

            return;

            StatusUpdate_01Insert aStatusUpdate_01Handler;

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

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

                try
                {
                    if (aStatusUpdate_01Doc == null)
                    {
                        Exception InternalError = new Exception("DataError: Root object cannot be null");
                        throw (InternalError);
                    }
                    aStatusUpdate_01Handler.Process(ref mt, null, aStatusUpdate_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;
        }
        public void Process(ref MessageTransaction trans, SegmentImpl parent, StatusUpdate_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;

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

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

                if (p.OPCODE.Length == 0)
                {
                    error.AppendLine("Zero length for mandatory parameter StatusUpdate_01Doc.OPCODE not allowed");
                }

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


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

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

            if (p.FifoDate != null)
            {
                (fStmt.Parameters["FifoDate"] as IDbDataParameter).Value = p.FifoDate;
            }
            else
            {
                (fStmt.Parameters["FifoDate"] as IDbDataParameter).Value = DBNull.Value;
            }

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

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

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

            trans.TransSeq++;

            fStmt.ExecuteNonQuery();
        }