public void MovementIn_01(string MHId, string TransactionId, MovementIn_01Doc aMovementIn_01Doc) { EnterProc(); return; MovementIn_01Insert aMovementIn_01Handler; try { MessageTransaction mt = BeginWebmethod(MHId, TransactionId, "MAPI_OUT_MOVEMENT_IN_01"); try { aMovementIn_01Handler = new MovementIn_01Insert(this); } catch (Exception e) { Exception InternalError = new Exception("InternalError: Building insert handler", e); throw (InternalError); } try { if (aMovementIn_01Doc == null) { Exception InternalError = new Exception("DataError: Root object cannot be null"); throw (InternalError); } aMovementIn_01Handler.Process(ref mt, null, aMovementIn_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, 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(); }