public void Process(ref MessageTransaction trans, SegmentImpl parent, RemoveDepartureNodeDoc 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["MSG_IN_ID"] as IDbDataParameter).Value = StringValue(trans.MsgInId); if (p.OPCODE != null) { if (p.OPCODE.Length > 1) { error.AppendLine("Value for RemoveDepartureNodeDoc.OPCODE too long, max 1 chars"); } if (p.OPCODE.Length == 0) { error.AppendLine("Zero length for mandatory parameter RemoveDepartureNodeDoc.OPCODE not allowed"); } (fStmt.Parameters["OPCODE"] as IDbDataParameter).Value = p.OPCODE; } else { error.AppendLine("Null value for mandatory parameter RemoveDepartureNodeDoc.OPCODE not allowed"); } if (p.DepartureIdentity != null) { if (p.DepartureIdentity.Length > 35) { error.AppendLine("Value for RemoveDepartureNodeDoc.DepartureIdentity too long, max 35 chars"); } (fStmt.Parameters["DepartureIdentity"] as IDbDataParameter).Value = p.DepartureIdentity; } else { (fStmt.Parameters["DepartureIdentity"] as IDbDataParameter).Value = DBNull.Value; } (fStmt.Parameters["SEQNUM"] as IDbDataParameter).Value = NumberValue(trans.TransSeq); if (error.Length > 0) { throw (new Exception(error.ToString())); } trans.TransSeq++; fStmt.ExecuteNonQuery(); }
public void Process(ref MessageTransaction trans, SegmentImpl parent, DepartureDoc 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["MSG_IN_ID"] as IDbDataParameter).Value = StringValue(trans.MsgInId); if (p.OPCODE != null) { if (p.OPCODE.Length > 1) { error.AppendLine("Value for DepartureDoc.OPCODE too long, max 1 chars"); } if (p.OPCODE.Length == 0) { error.AppendLine("Zero length for mandatory parameter DepartureDoc.OPCODE not allowed"); } (fStmt.Parameters["OPCODE"] as IDbDataParameter).Value = p.OPCODE; } else { error.AppendLine("Null value for mandatory parameter DepartureDoc.OPCODE not allowed"); } if (p.DepartureIdentity != null) { if (p.DepartureIdentity.Length > 35) { error.AppendLine("Value for DepartureDoc.DepartureIdentity too long, max 35 chars"); } (fStmt.Parameters["DepartureIdentity"] as IDbDataParameter).Value = p.DepartureIdentity; } else { (fStmt.Parameters["DepartureIdentity"] as IDbDataParameter).Value = DBNull.Value; } if (p.DepartureIdentityReference != null) { if (p.DepartureIdentityReference.Length > 35) { error.AppendLine("Value for DepartureDoc.DepartureIdentityReference too long, max 35 chars"); } (fStmt.Parameters["DepartureIdentityReference"] as IDbDataParameter).Value = p.DepartureIdentityReference; } else { (fStmt.Parameters["DepartureIdentityReference"] as IDbDataParameter).Value = DBNull.Value; } if (p.FromNodeIdentity != null) { if (p.FromNodeIdentity.Length > 35) { error.AppendLine("Value for DepartureDoc.FromNodeIdentity too long, max 35 chars"); } (fStmt.Parameters["FromNodeIdentity"] as IDbDataParameter).Value = p.FromNodeIdentity; } else { (fStmt.Parameters["FromNodeIdentity"] as IDbDataParameter).Value = DBNull.Value; } if (p.DeliveryMethod != null) { if (p.DeliveryMethod.Length > 17) { error.AppendLine("Value for DepartureDoc.DeliveryMethod too long, max 17 chars"); } (fStmt.Parameters["DeliveryMethod"] as IDbDataParameter).Value = p.DeliveryMethod; } else { (fStmt.Parameters["DeliveryMethod"] as IDbDataParameter).Value = DBNull.Value; } if (p.RouteIdentity != null) { if (p.RouteIdentity.Length > 17) { error.AppendLine("Value for DepartureDoc.RouteIdentity too long, max 17 chars"); } (fStmt.Parameters["RouteIdentity"] as IDbDataParameter).Value = p.RouteIdentity; } else { (fStmt.Parameters["RouteIdentity"] as IDbDataParameter).Value = DBNull.Value; } if (p.RouteDescription != null) { if (p.RouteDescription.Length > 35) { error.AppendLine("Value for DepartureDoc.RouteDescription too long, max 35 chars"); } (fStmt.Parameters["RouteDescription"] as IDbDataParameter).Value = p.RouteDescription; } else { (fStmt.Parameters["RouteDescription"] as IDbDataParameter).Value = DBNull.Value; } if (p.CustomerOrderReleaseDateTime != null) { (fStmt.Parameters["CustomerOrderReleaseDateTime"] as IDbDataParameter).Value = p.CustomerOrderReleaseDateTime; } else { (fStmt.Parameters["CustomerOrderReleaseDateTime"] as IDbDataParameter).Value = DBNull.Value; } if (p.CustomerOrderStopDateTime != null) { (fStmt.Parameters["CustomerOrderStopDateTime"] as IDbDataParameter).Value = p.CustomerOrderStopDateTime; } else { (fStmt.Parameters["CustomerOrderStopDateTime"] as IDbDataParameter).Value = DBNull.Value; } if (p.TransitStopDateTime != null) { (fStmt.Parameters["TransitStopDateTime"] as IDbDataParameter).Value = p.TransitStopDateTime; } else { (fStmt.Parameters["TransitStopDateTime"] as IDbDataParameter).Value = DBNull.Value; } if (p.PlannedDepartureDateTime != null) { (fStmt.Parameters["PlannedDepartureDateTime"] as IDbDataParameter).Value = p.PlannedDepartureDateTime; } else { (fStmt.Parameters["PlannedDepartureDateTime"] as IDbDataParameter).Value = DBNull.Value; } if (p.CheckProductTransportType != null) { if (p.CheckProductTransportType.Length > 1) { error.AppendLine("Value for DepartureDoc.CheckProductTransportType too long, max 1 chars"); } (fStmt.Parameters["CheckProductTransportType"] as IDbDataParameter).Value = p.CheckProductTransportType; } else { (fStmt.Parameters["CheckProductTransportType"] as IDbDataParameter).Value = DBNull.Value; } if (p.VehicleIdentity != null) { if (p.VehicleIdentity.Length > 35) { error.AppendLine("Value for DepartureDoc.VehicleIdentity too long, max 35 chars"); } (fStmt.Parameters["VehicleIdentity"] as IDbDataParameter).Value = p.VehicleIdentity; } else { (fStmt.Parameters["VehicleIdentity"] 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, ConfirmDoc 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["MSG_IN_ID"] as IDbDataParameter).Value = StringValue(trans.MsgInId); if (p.OPCODE != null) { if (p.OPCODE.Length > 1) { error.AppendLine("Value for ConfirmDoc.OPCODE too long, max 1 chars"); } if (p.OPCODE.Length == 0) { error.AppendLine("Zero length for mandatory parameter ConfirmDoc.OPCODE not allowed"); } (fStmt.Parameters["OPCODE"] as IDbDataParameter).Value = p.OPCODE; } else { error.AppendLine("Null value for mandatory parameter ConfirmDoc.OPCODE not allowed"); } if (p.TransactionId != null) { if (p.TransactionId.Length > 35) { error.AppendLine("Value for ConfirmDoc.TransactionId too long, max 35 chars"); } (fStmt.Parameters["Transaction_id"] as IDbDataParameter).Value = p.TransactionId; } else { (fStmt.Parameters["Transaction_id"] as IDbDataParameter).Value = DBNull.Value; } if (p.TransactionStatus != null) { if (p.TransactionStatus.Length > 1) { error.AppendLine("Value for ConfirmDoc.TransactionStatus too long, max 1 chars"); } (fStmt.Parameters["Transaction_Status"] as IDbDataParameter).Value = p.TransactionStatus; } else { (fStmt.Parameters["Transaction_Status"] as IDbDataParameter).Value = DBNull.Value; } if (p.ErrCode != null) { if (p.ErrCode.Length > 12) { error.AppendLine("Value for ConfirmDoc.ErrCode too long, max 12 chars"); } (fStmt.Parameters["ErrCode"] as IDbDataParameter).Value = p.ErrCode; } else { (fStmt.Parameters["ErrCode"] as IDbDataParameter).Value = DBNull.Value; } if (p.ErrMsg != null) { if (p.ErrMsg.Length > 1024) { error.AppendLine("Value for ConfirmDoc.ErrMsg too long, max 1024 chars"); } (fStmt.Parameters["Errmsg"] as IDbDataParameter).Value = p.ErrMsg; } else { (fStmt.Parameters["Errmsg"] as IDbDataParameter).Value = DBNull.Value; } if (error.Length > 0) { throw (new Exception(error.ToString())); } trans.TransSeq++; fStmt.ExecuteNonQuery(); }