public void Process(ref MessageTransaction trans, SegmentImpl parent, MovementIn_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 MovementIn_01Doc.OPCODE too long, max 1 chars");
                }

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

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


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

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

            if (p.ItemLoadIdentity != null)
            {
                if (p.ItemLoadIdentity.Length > 35)
                {
                    error.AppendLine("Value for MovementIn_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.ProductNumber != null)
            {
                if (p.ProductNumber.Length > 35)
                {
                    error.AppendLine("Value for MovementIn_01Doc.ProductNumber too long, max 35 chars");
                }

                (fStmt.Parameters["ProductNumber"] as IDbDataParameter).Value = p.ProductNumber;
            }
            else
            {
                (fStmt.Parameters["ProductNumber"] 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 MovementIn_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 (p.ProductionLotIdentity != null)
            {
                if (p.ProductionLotIdentity.Length > 40)
                {
                    error.AppendLine("Value for MovementIn_01Doc.ProductionLotIdentity too long, max 40 chars");
                }

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

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

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

            trans.TransSeq++;

            fStmt.ExecuteNonQuery();
        }
        public void Process(ref MessageTransaction trans, SegmentImpl parent, Product_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 Product_01Doc.OPCODE too long, max 1 chars");
                }

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

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


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

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

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

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

            if (p.BarCode != null)
            {
                if (p.BarCode.Length > 20)
                {
                    error.AppendLine("Value for Product_01Doc.BarCode too long, max 20 chars");
                }

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

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

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

            if (p.HandlingUnitIdentity != null)
            {
                if (p.HandlingUnitIdentity.Length > 6)
                {
                    error.AppendLine("Value for Product_01Doc.HandlingUnitIdentity too long, max 6 chars");
                }

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

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

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

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

            if (p.BatchType != null)
            {
                if (p.BatchType.Length > 100)
                {
                    error.AppendLine("Value for Product_01Doc.BatchType too long, max 100 chars");
                }

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

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

            trans.TransSeq++;

            fStmt.ExecuteNonQuery();
        }