/// <summary>
        ///     Default constructor
        /// </summary>
        /// <param name="relaxTq">Allows 0 qty records to be sent to gateway</param>
        /// <param name="autoTruncate">Forces trim to max length for the field</param>
        /// <param name="sendEof">Forces stream closure</param>
        public RecordBundle(bool relaxTq = false, bool autoTruncate = false, bool sendEof = false)
        {
            SendEof = sendEof;

            _eventLogger = LogManager.GetLogger("motRecordBundle.Manager");
            Patient      = new MotPatientRecord("Add", autoTruncate);
            Scrip        = new MotPrescriptionRecord("Add", autoTruncate);
            Prescriber   = new MotPrescriberRecord("Add", autoTruncate);
            Location     = new MotFacilityRecord("Add", autoTruncate);
            Store        = new MotStoreRecord("Add", autoTruncate);
            Drug         = new MotDrugRecord("Add", autoTruncate);

            TQList         = new List <MotTimesQtysRecord>();
            StoreList      = new List <MotStoreRecord>();
            PrescriberList = new List <MotPrescriberRecord>();

            Patient.RelaxTqRequirements = Scrip.RelaxTqRequirements = Location.RelaxTqRequirements = Prescriber.RelaxTqRequirements = Store.RelaxTqRequirements = Drug.RelaxTqRequirements = relaxTq;

            if (UseQueue)
            {
                _writeQueue             = new MotWriteQueue();
                Patient.LocalWriteQueue = Scrip.LocalWriteQueue = Location.LocalWriteQueue = Prescriber.LocalWriteQueue = Store.LocalWriteQueue = Drug.LocalWriteQueue = _writeQueue;

                _writeQueue.SendEof   = sendEof;
                _writeQueue.DebugMode = DebugMode;
            }

            Patient.QueueWrites = Scrip.QueueWrites = Location.QueueWrites = Prescriber.QueueWrites = Store.QueueWrites = Drug.QueueWrites = UseQueue;

            Patient.SendEof = Scrip.SendEof = Location.SendEof = Prescriber.SendEof = Store.SendEof = Drug.SendEof = sendEof;

            Patient.AutoTruncate = Scrip.AutoTruncate = Location.AutoTruncate = Prescriber.AutoTruncate = Store.AutoTruncate = Drug.AutoTruncate = autoTruncate;
        }
 public static MotPrescriptionRecord DeepCopy(MotPrescriptionRecord other)
 {
     using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
     {
         var formatter = new BinaryFormatter();
         formatter.Serialize(ms, other);
         ms.Position = 0;
         return((MotPrescriptionRecord)formatter.Deserialize(ms));
     }
 }