PDC.cs :  » Network-Clients » nHapi » NHapi » Model » V251 » Segment » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Network Clients » nHapi 
nHapi » NHapi » Model » V251 » Segment » PDC.cs
using System;
using NHapi.Base;
using NHapi.Base.Parser;
using NHapi.Base.Model;
using NHapi.Model.V251.Datatype;
using NHapi.Base.Log;

namespace NHapi.Model.V251.Segment{

///<summary>
/// Represents an HL7 PDC message segment. 
/// This segment has the following fields:<ol>
///<li>PDC-1: Manufacturer/Distributor (XON)</li>
///<li>PDC-2: Country (CE)</li>
///<li>PDC-3: Brand Name (ST)</li>
///<li>PDC-4: Device Family Name (ST)</li>
///<li>PDC-5: Generic Name (CE)</li>
///<li>PDC-6: Model Identifier (ST)</li>
///<li>PDC-7: Catalogue Identifier (ST)</li>
///<li>PDC-8: Other Identifier (ST)</li>
///<li>PDC-9: Product Code (CE)</li>
///<li>PDC-10: Marketing Basis (ID)</li>
///<li>PDC-11: Marketing Approval ID (ST)</li>
///<li>PDC-12: Labeled Shelf Life (CQ)</li>
///<li>PDC-13: Expected Shelf Life (CQ)</li>
///<li>PDC-14: Date First Marketed (TS)</li>
///<li>PDC-15: Date Last Marketed (TS)</li>
///</ol>
/// The get...() methods return data from individual fields.  These methods 
/// do not throw exceptions and may therefore have to handle exceptions internally.  
/// If an exception is handled internally, it is logged and null is returned.  
/// This is not expected to happen - if it does happen this indicates not so much 
/// an exceptional circumstance as a bug in the code for this class.
///</summary>
[Serializable]
public class PDC : AbstractSegment  {

  /**
   * Creates a PDC (Product Detail Country) segment object that belongs to the given 
   * message.  
   */
  public PDC(IGroup parent, IModelClassFactory factory) : base(parent,factory) {
  IMessage message = Message;
    try {
       this.add(typeof(XON), true, 0, 250, new System.Object[]{message}, "Manufacturer/Distributor");
       this.add(typeof(CE), true, 1, 250, new System.Object[]{message}, "Country");
       this.add(typeof(ST), true, 1, 60, new System.Object[]{message}, "Brand Name");
       this.add(typeof(ST), false, 1, 60, new System.Object[]{message}, "Device Family Name");
       this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Generic Name");
       this.add(typeof(ST), false, 0, 60, new System.Object[]{message}, "Model Identifier");
       this.add(typeof(ST), false, 1, 60, new System.Object[]{message}, "Catalogue Identifier");
       this.add(typeof(ST), false, 0, 60, new System.Object[]{message}, "Other Identifier");
       this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Product Code");
       this.add(typeof(ID), false, 1, 4, new System.Object[]{message, 330}, "Marketing Basis");
       this.add(typeof(ST), false, 1, 60, new System.Object[]{message}, "Marketing Approval ID");
       this.add(typeof(CQ), false, 1, 12, new System.Object[]{message}, "Labeled Shelf Life");
       this.add(typeof(CQ), false, 1, 12, new System.Object[]{message}, "Expected Shelf Life");
       this.add(typeof(TS), false, 1, 26, new System.Object[]{message}, "Date First Marketed");
       this.add(typeof(TS), false, 1, 26, new System.Object[]{message}, "Date Last Marketed");
    } catch (HL7Exception he) {
        HapiLogFactory.getHapiLog(GetType()).error("Can't instantiate " + GetType().Name, he);
    }
  }

  ///<summary>
  /// Returns a single repetition of Manufacturer/Distributor(PDC-1).
  /// throws HL7Exception if the repetition number is invalid.
  /// <param name="rep">The repetition number (this is a repeating field)</param>
  ///</summary>
  public XON GetManufacturerDistributor(int rep)
  {
      XON ret = null;
      try
      {
      IType t = this.GetField(1, rep);
        ret = (XON)t;
    } catch (System.Exception ex) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", ex);
        throw new System.Exception("An unexpected error ocurred", ex);
    }
      return ret;
  }

  ///<summary>
  /// Returns all repetitions of Manufacturer/Distributor (PDC-1).
   ///</summary>
  public XON[] GetManufacturerDistributor() {
     XON[] ret = null;
    try {
        IType[] t = this.GetField(1);  
        ret = new XON[t.Length];
        for (int i = 0; i < ret.Length; i++) {
            ret[i] = (XON)t[i];
        }
    } catch (HL7Exception he) {
        HapiLogFactory.getHapiLog(this.GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
    } catch (System.Exception cce) {
        HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
        throw new System.Exception("An unexpected error ocurred", cce);
  }
 return ret;
}

  ///<summary>
  /// Returns the total repetitions of Manufacturer/Distributor (PDC-1).
   ///</summary>
  public int ManufacturerDistributorRepetitionsUsed
{
get{
    try {
  return GetTotalFieldRepetitionsUsed(1);
    }
catch (HL7Exception he) {
        HapiLogFactory.getHapiLog(this.GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception cce) {
        HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
        throw new System.Exception("An unexpected error ocurred", cce);
}
}
}
  ///<summary>
  /// Returns Country(PDC-2).
  ///</summary>
  public CE Country
  {
    get{
      CE ret = null;
      try
      {
      IType t = this.GetField(2, 0);
        ret = (CE)t;
      }
       catch (HL7Exception he) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
    } catch (System.Exception ex) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", ex);
        throw new System.Exception("An unexpected error ocurred", ex);
    }
      return ret;
  }
  }

  ///<summary>
  /// Returns Brand Name(PDC-3).
  ///</summary>
  public ST BrandName
  {
    get{
      ST ret = null;
      try
      {
      IType t = this.GetField(3, 0);
        ret = (ST)t;
      }
       catch (HL7Exception he) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
    } catch (System.Exception ex) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", ex);
        throw new System.Exception("An unexpected error ocurred", ex);
    }
      return ret;
  }
  }

  ///<summary>
  /// Returns Device Family Name(PDC-4).
  ///</summary>
  public ST DeviceFamilyName
  {
    get{
      ST ret = null;
      try
      {
      IType t = this.GetField(4, 0);
        ret = (ST)t;
      }
       catch (HL7Exception he) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
    } catch (System.Exception ex) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", ex);
        throw new System.Exception("An unexpected error ocurred", ex);
    }
      return ret;
  }
  }

  ///<summary>
  /// Returns Generic Name(PDC-5).
  ///</summary>
  public CE GenericName
  {
    get{
      CE ret = null;
      try
      {
      IType t = this.GetField(5, 0);
        ret = (CE)t;
      }
       catch (HL7Exception he) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
    } catch (System.Exception ex) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", ex);
        throw new System.Exception("An unexpected error ocurred", ex);
    }
      return ret;
  }
  }

  ///<summary>
  /// Returns a single repetition of Model Identifier(PDC-6).
  /// throws HL7Exception if the repetition number is invalid.
  /// <param name="rep">The repetition number (this is a repeating field)</param>
  ///</summary>
  public ST GetModelIdentifier(int rep)
  {
      ST ret = null;
      try
      {
      IType t = this.GetField(6, rep);
        ret = (ST)t;
    } catch (System.Exception ex) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", ex);
        throw new System.Exception("An unexpected error ocurred", ex);
    }
      return ret;
  }

  ///<summary>
  /// Returns all repetitions of Model Identifier (PDC-6).
   ///</summary>
  public ST[] GetModelIdentifier() {
     ST[] ret = null;
    try {
        IType[] t = this.GetField(6);  
        ret = new ST[t.Length];
        for (int i = 0; i < ret.Length; i++) {
            ret[i] = (ST)t[i];
        }
    } catch (HL7Exception he) {
        HapiLogFactory.getHapiLog(this.GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
    } catch (System.Exception cce) {
        HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
        throw new System.Exception("An unexpected error ocurred", cce);
  }
 return ret;
}

  ///<summary>
  /// Returns the total repetitions of Model Identifier (PDC-6).
   ///</summary>
  public int ModelIdentifierRepetitionsUsed
{
get{
    try {
  return GetTotalFieldRepetitionsUsed(6);
    }
catch (HL7Exception he) {
        HapiLogFactory.getHapiLog(this.GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception cce) {
        HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
        throw new System.Exception("An unexpected error ocurred", cce);
}
}
}
  ///<summary>
  /// Returns Catalogue Identifier(PDC-7).
  ///</summary>
  public ST CatalogueIdentifier
  {
    get{
      ST ret = null;
      try
      {
      IType t = this.GetField(7, 0);
        ret = (ST)t;
      }
       catch (HL7Exception he) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
    } catch (System.Exception ex) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", ex);
        throw new System.Exception("An unexpected error ocurred", ex);
    }
      return ret;
  }
  }

  ///<summary>
  /// Returns a single repetition of Other Identifier(PDC-8).
  /// throws HL7Exception if the repetition number is invalid.
  /// <param name="rep">The repetition number (this is a repeating field)</param>
  ///</summary>
  public ST GetOtherIdentifier(int rep)
  {
      ST ret = null;
      try
      {
      IType t = this.GetField(8, rep);
        ret = (ST)t;
    } catch (System.Exception ex) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", ex);
        throw new System.Exception("An unexpected error ocurred", ex);
    }
      return ret;
  }

  ///<summary>
  /// Returns all repetitions of Other Identifier (PDC-8).
   ///</summary>
  public ST[] GetOtherIdentifier() {
     ST[] ret = null;
    try {
        IType[] t = this.GetField(8);  
        ret = new ST[t.Length];
        for (int i = 0; i < ret.Length; i++) {
            ret[i] = (ST)t[i];
        }
    } catch (HL7Exception he) {
        HapiLogFactory.getHapiLog(this.GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
    } catch (System.Exception cce) {
        HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
        throw new System.Exception("An unexpected error ocurred", cce);
  }
 return ret;
}

  ///<summary>
  /// Returns the total repetitions of Other Identifier (PDC-8).
   ///</summary>
  public int OtherIdentifierRepetitionsUsed
{
get{
    try {
  return GetTotalFieldRepetitionsUsed(8);
    }
catch (HL7Exception he) {
        HapiLogFactory.getHapiLog(this.GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception cce) {
        HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
        throw new System.Exception("An unexpected error ocurred", cce);
}
}
}
  ///<summary>
  /// Returns Product Code(PDC-9).
  ///</summary>
  public CE ProductCode
  {
    get{
      CE ret = null;
      try
      {
      IType t = this.GetField(9, 0);
        ret = (CE)t;
      }
       catch (HL7Exception he) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
    } catch (System.Exception ex) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", ex);
        throw new System.Exception("An unexpected error ocurred", ex);
    }
      return ret;
  }
  }

  ///<summary>
  /// Returns Marketing Basis(PDC-10).
  ///</summary>
  public ID MarketingBasis
  {
    get{
      ID ret = null;
      try
      {
      IType t = this.GetField(10, 0);
        ret = (ID)t;
      }
       catch (HL7Exception he) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
    } catch (System.Exception ex) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", ex);
        throw new System.Exception("An unexpected error ocurred", ex);
    }
      return ret;
  }
  }

  ///<summary>
  /// Returns Marketing Approval ID(PDC-11).
  ///</summary>
  public ST MarketingApprovalID
  {
    get{
      ST ret = null;
      try
      {
      IType t = this.GetField(11, 0);
        ret = (ST)t;
      }
       catch (HL7Exception he) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
    } catch (System.Exception ex) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", ex);
        throw new System.Exception("An unexpected error ocurred", ex);
    }
      return ret;
  }
  }

  ///<summary>
  /// Returns Labeled Shelf Life(PDC-12).
  ///</summary>
  public CQ LabeledShelfLife
  {
    get{
      CQ ret = null;
      try
      {
      IType t = this.GetField(12, 0);
        ret = (CQ)t;
      }
       catch (HL7Exception he) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
    } catch (System.Exception ex) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", ex);
        throw new System.Exception("An unexpected error ocurred", ex);
    }
      return ret;
  }
  }

  ///<summary>
  /// Returns Expected Shelf Life(PDC-13).
  ///</summary>
  public CQ ExpectedShelfLife
  {
    get{
      CQ ret = null;
      try
      {
      IType t = this.GetField(13, 0);
        ret = (CQ)t;
      }
       catch (HL7Exception he) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
    } catch (System.Exception ex) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", ex);
        throw new System.Exception("An unexpected error ocurred", ex);
    }
      return ret;
  }
  }

  ///<summary>
  /// Returns Date First Marketed(PDC-14).
  ///</summary>
  public TS DateFirstMarketed
  {
    get{
      TS ret = null;
      try
      {
      IType t = this.GetField(14, 0);
        ret = (TS)t;
      }
       catch (HL7Exception he) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
    } catch (System.Exception ex) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", ex);
        throw new System.Exception("An unexpected error ocurred", ex);
    }
      return ret;
  }
  }

  ///<summary>
  /// Returns Date Last Marketed(PDC-15).
  ///</summary>
  public TS DateLastMarketed
  {
    get{
      TS ret = null;
      try
      {
      IType t = this.GetField(15, 0);
        ret = (TS)t;
      }
       catch (HL7Exception he) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", he);
        throw new System.Exception("An unexpected error ocurred", he);
    } catch (System.Exception ex) {
      HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value.  This is a bug.", ex);
        throw new System.Exception("An unexpected error ocurred", ex);
    }
      return ret;
  }
  }


}}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.