public override object Deserialize(TextReader tr)
        {
            string value = tr.ReadToEnd();

            IOrganizer o = null;

            try
            {
                o = CreateAndAssociate() as IOrganizer;
                if (o != null)
                {
                    string uriString = Unescape(Decode(o, value));

                    // Prepend "mailto:" if necessary
                    if (!uriString.StartsWith("mailto:", StringComparison.InvariantCultureIgnoreCase))
                    {
                        uriString = "mailto:" + uriString;
                    }

                    o.Value = new Uri(uriString);
                }
            }
            catch { }

            return(o);
        }
Exemplo n.º 2
0
 internal COrganizerEntries(CItem parent, IOrganizer medOrganizer, int index, COrganizer.EType type) : base(parent)
 {
     if (!(parent is COrganizer))
     {
         throw new Exception("Internal error");
     }
     this.Index           = index;
     this.Type            = type;
     this.MedOrganizer    = medOrganizer;
     this.EntryDescriptor = new COrganizerEntries.CEntryDescriptor(this, this.MedOrganizer);
     try
     {
         this.ReadOnly = (this.MedOrganizer.ReadOnly != 0);
     }
     catch (Exception ex)
     {
         Console.WriteLine(this.ToString() + "Unable to query ReadOnly property [ " + ex.Message + " ]");
         this.ReadOnly = true;
     }
     try
     {
         this.Growable = (this.MedOrganizer.Growable != 0);
     }
     catch (Exception ex2)
     {
         Console.WriteLine(this.ToString() + "Unable to query Growable property [ " + ex2.Message + " ]");
         this.Growable = false;
         this.ReadOnly = true;
     }
 }
        public List <LabResult> FillLabResults(IEntryCollection entryCollection)
        {
            List <LabResult> labResult = new List <LabResult>();

            foreach (IEntry entryitem in entryCollection)
            {
                IOrganizer            entryOrganizer = entryitem.AsOrganizer;
                IComponent4Collection entryComponent = entryOrganizer.Component;
                LabResult             ptLabResult    = new LabResult();
                foreach (IComponent4 obserComponent in entryComponent)
                {
                    IObservation    entryObservation = obserComponent.AsObservation;
                    IReferenceRange referenceRange   = entryObservation.ReferenceRange.FirstOrDefault();
                    meterialCode = entryObservation.Code;
                    try{ valueCode = (IPQ)entryObservation.Value[0]; }catch (Exception) {}
                    ptLabResult.TestPerformed = meterialCode.DisplayName;
                    ptLabResult.ReportDate    = entryObservation.EffectiveTime == null ? null : new DateTime?(Convert.ToDateTime(entryObservation.EffectiveTime.AsDateTime));
                    ptLabResult.LonicCode     = meterialCode.Code;
                    ptLabResult.Units         = valueCode != null?valueCode.Unit.ToString() : string.Empty;

                    ptLabResult.TestResultn = valueCode != null?valueCode.Value.ToString():string.Empty;

                    ptLabResult.NormalFindings = referenceRange != null ? referenceRange.ObservationRange.Text != null ? referenceRange.ObservationRange.Text.Text : null : null;
                }
                labResult.Add(ptLabResult);
            }

            return(labResult);
        }
        public List <VitalSigns> FillVitalSigns(IEntryCollection entryCollection)
        {
            List <VitalSigns> vitalSigns = new List <VitalSigns>();

            foreach (IEntry singleentry in entryCollection)
            {
                IOrganizer            organizer = singleentry.AsOrganizer;
                IComponent4Collection component = organizer.Component;
                IIVL_TS effectivetime           = organizer.EffectiveTime;
                if (effectivetime == null)
                {
                    throw new InvalidOperationException();
                }
                VitalSigns ptvitalSigns = new VitalSigns();
                try
                {
                    ptvitalSigns.VitalDate = effectivetime.AsDateTime;
                }
                catch (Exception)
                {
                    ptvitalSigns.VitalDate = effectivetime != null ? effectivetime.Low != null ? effectivetime.Low.Value != null ? new DateTime?(effectivetime.Low.AsDateTime) : null : null : effectivetime.Value != null ? new DateTime?(effectivetime.AsDateTime) : new DateTime?(effectivetime.AsDateTime);
                }


                foreach (IComponent4 orgComponent in component)
                {
                    IObservation orgObservation             = orgComponent.AsObservation;
                    ICD          itemCode                   = orgObservation.Code;
                    IANY         vitalSignsObservationValue = orgObservation.Value[0];
                    IPQ          itemVlues                  = (IPQ)vitalSignsObservationValue;

                    if (itemCode.Code != null)
                    {
                        if (itemCode.Code.ToString() == "8302-2")
                        {
                            ptvitalSigns.Height     = Convert.ToInt16(itemVlues.Value);
                            ptvitalSigns.HeightUnit = Convert.ToString(itemVlues.Unit);
                        }
                        if (itemCode.Code.ToString() == "3141-9")
                        {
                            ptvitalSigns.WEIGHT     = Convert.ToInt16(itemVlues.Value);
                            ptvitalSigns.WeightUnit = Convert.ToString(itemVlues.Unit);
                        }
                        if (itemCode.Code.ToString() == "8480-6")
                        {
                            ptvitalSigns.BloodPressure         = itemVlues.Value.ToString() + " " + itemVlues.Unit.ToString();
                            ptvitalSigns.BloodPressureSystolic = itemVlues.Value.ToString();
                        }

                        if (itemCode.Code.ToString() == "8462-4")
                        {
                            ptvitalSigns.BloodPressureDiastolic = itemVlues.Value.ToString();
                        }
                    }
                }
                vitalSigns.Add(ptvitalSigns);
            }
            return(vitalSigns);
        }
Exemplo n.º 5
0
        private void CallBack(System.Object sender, Telegram.Bot.Args.CallbackQueryEventArgs e)
        {
            if (commands.Any(c => c.Equals(e.CallbackQuery.Data)))                               // проверка есть ли команда в списке
            {
                ICommand Command = commands.FirstOrDefault(c => c.Equals(e.CallbackQuery.Data)); // вытягиваем класс
                Command.Execute(BotClient, e.CallbackQuery, pairs, baseContext);
            }
            else if (calendars.Any(c => c.Equals(e.CallbackQuery.Data)))
            {
                if (!keyValues.Any(c => c.Key == e.CallbackQuery.From.Id) || keyValues.Count == 0)
                {
                    keyValues.Add(e.CallbackQuery.From.Id, new Calendar());
                }

                ICalendar Command = calendars.FirstOrDefault(c => c.Equals(e.CallbackQuery.Data));                 // вытягиваем класс
                if (Command.Name == "BackToStart" || Command.Name == "BackToCalendar" ||
                    Command.Name == "Calendar" || Command.Name == "<" ||
                    Command.Name == ">")
                {
                    Command.Execute(BotClient, e.CallbackQuery, keyValues, baseContext);
                }
                else
                {
                    Command.Execute(BotClient, e.CallbackQuery, eventCals, baseContext);
                }
            }
            else if (commandSettings.Any(c => c.Equals(e.CallbackQuery.Data)))
            {
                ICommandSettings ISettings = commandSettings.FirstOrDefault(c => c.Equals(e.CallbackQuery.Data));
                ISettings.Execute(BotClient, e.CallbackQuery, iSettings, baseContext);
            }
            else if (commandiOrganizer.Any(c => c.Equals(e.CallbackQuery.Data)))
            {
                IOrganizer iTOrganizer = commandiOrganizer.FirstOrDefault(c => c.Equals(e.CallbackQuery.Data));
                iTOrganizer.Execute(BotClient, e.CallbackQuery, iOrganizer, baseContext);
            }
            else
            {
                User users = baseContext._User.Where(p => p.ID == e.CallbackQuery.From.Id).FirstOrDefault();
                if (users.Work / 100 <= 22)
                {
                    ChouseItem chouseItem = new ChouseItem();
                    chouseItem.Execute(BotClient, e.CallbackQuery, pairs, baseContext);
                }
                else if (users.Work / 100 == 30)
                {
                    ChouseData chouseData = new ChouseData();
                    chouseData.Execute(BotClient, e.CallbackQuery, baseContext);
                }
                else if (users.Work % 100 >= 26 && users.Work % 100 <= 28)
                {
                    ShowItemCalndar showItemCalnder = new ShowItemCalndar();
                    showItemCalnder.Execute(BotClient, e.CallbackQuery, eventCals, baseContext);
                }
            }
        }
Exemplo n.º 6
0
        public override bool Equals(object obj)
        {
            IOrganizer o = obj as IOrganizer;

            if (o != null)
            {
                return(object.Equals(Value, o.Value));
            }
            return(base.Equals(obj));
        }
Exemplo n.º 7
0
        public IFreeBusy GetFreeBusy(IOrganizer organizer, IAttendee[] contacts, IDateTime fromInclusive, IDateTime toExclusive)
        {
            IFreeBusy fb = null;

            foreach (var iCal in this)
            {
                fb = CombineFreeBusy(fb, iCal.GetFreeBusy(organizer, contacts, fromInclusive, toExclusive));
            }
            return(fb);
        }
Exemplo n.º 8
0
        public OrganizerInstance(ObjectInstance prototype, IOrganizer organizer)
            : this(prototype)
        {
            if (organizer == null)
            {
                throw new ArgumentNullException("organizer");
            }

            m_organizer = organizer;
        }
Exemplo n.º 9
0
        public static void ReadEntries(string filePath, IOrganizer org)
        {
            StreamReader reader = new StreamReader(filePath);

            using (reader)
            {
                string[] entries = reader.ReadToEnd().Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < entries.Length; i++)
                {
                    entries[i] = entries[i].Replace("Type: ", "");
                    entries[i] = entries[i].Replace("Subject: ", "");
                    entries[i] = entries[i].Replace("Comments: ", "");
                    entries[i] = entries[i].Replace("Date: ", "");
                    entries[i] = entries[i].Replace("CreatedOn: ", "");
                }

                for (int i = 0; i < entries.Length; i++)
                {
                    switch (entries[i])
                    {
                    case "Anniversary":
                        Anniversary anniversary = new Anniversary(entries[i + 1], entries[i + 2], DateTime.Parse(entries[i + 3]));
                        anniversary.CreatedOn = DateTime.Parse(entries[i + 4]);
                        org.Add(anniversary);
                        i += 4;
                        break;

                    case "Meeting":
                        Meeting meeting = new Meeting(entries[i + 1], entries[i + 2], DateTime.Parse(entries[i + 3]));
                        meeting.CreatedOn = DateTime.Parse(entries[i + 4]);
                        org.Add(meeting);
                        i += 4;
                        break;

                    case "ToDo":
                        ToDo toDo = new ToDo(entries[i + 1], entries[i + 2], DateTime.Parse(entries[i + 3]));
                        toDo.CreatedOn = DateTime.Parse(entries[i + 4]);
                        org.Add(toDo);
                        i += 4;
                        break;

                    case "Memo":
                        Memo memo = new Memo(entries[i + 1], entries[i + 2]);
                        memo.CreatedOn = DateTime.Parse(entries[i + 4]);
                        org.Add(memo);
                        i += 3;
                        break;

                    default:
                        throw new InvalidDataException();
                    }
                }
            }
        }
Exemplo n.º 10
0
        public override void CopyFrom(ICopyable obj)
        {
            base.CopyFrom(obj);

            IOrganizer o = obj as IOrganizer;

            if (o != null)
            {
                Value = o.Value;
            }
        }
Exemplo n.º 11
0
        public virtual bool Push(CDriver.Progress progress)
        {
            for (int i = 0; i < this.EmptyListsToPush.Length; i++)
            {
                for (int j = 0; j < this.MedOrganizers[i].StreamCount; j++)
                {
                    IOrganizerItem organizerItem = this.MedOrganizers[i].GetStream(j + 1) as IOrganizerItem;
                    organizerItem.GetType();
                }
                foreach (IOrganizerItem current in this.EmptyListsToPush[i])
                {
                    current.Commit();
                }
            }
            if (this.Events != null)
            {
                foreach (COrganizerEntry cOrganizerEntry in this.Events)
                {
                    cOrganizerEntry.Commit();
                }
            }
            if (this.Notes != null)
            {
                foreach (COrganizerEntry cOrganizerEntry2 in this.Notes)
                {
                    cOrganizerEntry2.Commit();
                }
            }
            if (this.Tasks != null)
            {
                foreach (COrganizerEntry cOrganizerEntry3 in this.Tasks)
                {
                    cOrganizerEntry3.Commit();
                }
            }
            int min = 0;
            int max = 1000 / ((this.MedOrganizers.Length > 0) ? this.MedOrganizers.Length : 1);

            for (int k = 0; k < this.MedOrganizers.Length; k++)
            {
                IOrganizer organizer = this.MedOrganizers[k];
                for (int l = 0; l < organizer.StreamCount; l++)
                {
                    IOrganizerItem organizerItem2 = organizer.GetStream(l + 1) as IOrganizerItem;
                    organizerItem2.GetType();
                }
                IOperation operation = organizer.Flush() as IOperation;
                if (!CDriver.OperationToProgress(operation, progress, min, max))
                {
                    return(false);
                }
            }
            return(progress(1000));
        }
Exemplo n.º 12
0
 public override string SerializeToString(object obj)
 {
     try
     {
         IOrganizer o = obj as IOrganizer;
         if (o != null)
         {
             return(Encode(o, Escape(o.Value.OriginalString)));
         }
         return(null);
     }
     catch
     {
         return(null);
     }
 }
Exemplo n.º 13
0
        public static void PrintAllByType(string filePath, IOrganizer org)
        {
            StreamWriter writer = new StreamWriter(filePath);

            using (writer)
            {
                var sortedEntries = org.Entries.OrderBy(entrie => entrie.EntryType);
                foreach (Entry entry in sortedEntries)
                {
                    foreach (string info in entry.GetInformation())
                    {
                        writer.WriteLine(info);
                    }
                    writer.WriteLine();
                }
            }
        }
Exemplo n.º 14
0
        public override object Deserialize(TextReader tr)
        {
            string value = tr.ReadToEnd();

            try
            {
                IOrganizer o = CreateAndAssociate() as IOrganizer;
                if (o != null)
                {
                    o.Value = new Uri(Unescape(Decode(o, value)));
                    return(o);
                }
            }
            catch { }

            return(null);
        }
Exemplo n.º 15
0
        public Engine(IUIDevive aController, IOrganizer aOrganizer, IMenu aMyMenu, IComunicator aComunicator)
        {
            this.Controller     = aController;
            this.Organizer      = aOrganizer;
            this.MyMenu         = aMyMenu;
            this.Comunicator    = aComunicator;
            this.currentCommand = Command.None;

            this.controller.RaiseButtonOnePressedEvent    += this.HandleButtonOnePressedEvent;
            this.controller.RaiseButtonTwoPressedEvent    += this.HandleButtonTwoPressedEvent;
            this.controller.RaiseButtonThreePressedEvent  += this.HandleButtonThreePressedEvent;
            this.controller.RaiseButtonFourPressedEvent   += this.HandleButtonFourPressedEvent;
            this.controller.RaiseButtonLeftPressedEvent   += this.HandleButtonLeftPressedEvent;
            this.controller.RaiseButtonRightPressedEvent  += this.HandleButtonRightPressedEvent;
            this.controller.RaiseButtonEscPressedEvnet    += this.HandleButtonEscPressedEvnet;
            this.controller.RaiseButtonDeletePressedEvnet += this.HandleButtonDeletePressedEvnet;

            // TextFilesIO.ReadEntries(@"../../entries.txt", this.organizer);
        }
Exemplo n.º 16
0
        public static void PrintEntriesOfType <T>(string filePath, IOrganizer org)
        {
            StreamWriter writer = new StreamWriter(filePath);

            using (writer)
            {
                foreach (Entry entry in org.Entries)
                {
                    if (entry is T)
                    {
                        foreach (string info in entry.GetInformation())
                        {
                            writer.WriteLine(info);
                        }
                        writer.WriteLine();
                    }
                }
            }
        }
Exemplo n.º 17
0
        public Engine(IUIDevive aController, IOrganizer aOrganizer, IMenu aMyMenu, IComunicator aComunicator)
        {
            this.Controller = aController;
            this.Organizer = aOrganizer;
            this.MyMenu = aMyMenu;
            this.Comunicator = aComunicator;
            this.currentCommand = Command.None;

            this.controller.RaiseButtonOnePressedEvent += this.HandleButtonOnePressedEvent;
            this.controller.RaiseButtonTwoPressedEvent += this.HandleButtonTwoPressedEvent;
            this.controller.RaiseButtonThreePressedEvent += this.HandleButtonThreePressedEvent;
            this.controller.RaiseButtonFourPressedEvent += this.HandleButtonFourPressedEvent;
            this.controller.RaiseButtonLeftPressedEvent += this.HandleButtonLeftPressedEvent;
            this.controller.RaiseButtonRightPressedEvent += this.HandleButtonRightPressedEvent;
            this.controller.RaiseButtonEscPressedEvnet += this.HandleButtonEscPressedEvnet;
            this.controller.RaiseButtonDeletePressedEvnet += this.HandleButtonDeletePressedEvnet;

               // TextFilesIO.ReadEntries(@"../../entries.txt", this.organizer);
        }
Exemplo n.º 18
0
 public virtual IFreeBusy GetFreeBusy(IOrganizer organizer, IAttendee[] contacts, IDateTime fromInclusive, IDateTime toExclusive)
 {
     return(Net.FreeBusy.Create(this, Net.FreeBusy.CreateRequest(fromInclusive, toExclusive, organizer, contacts)));
 }
Exemplo n.º 19
0
        static public IFreeBusy CreateRequest(IDateTime fromInclusive, IDateTime toExclusive, IOrganizer organizer, IAttendee[] contacts)
        {
            FreeBusy fb = new FreeBusy();
            fb.DTStamp = iCalDateTime.Now;
            fb.DTStart = fromInclusive;
            fb.DTEnd = toExclusive;
            if (organizer != null)
                fb.Organizer = organizer.Copy<IOrganizer>();
            if (contacts != null)
            {
                foreach (IAttendee attendee in contacts)
                    fb.Attendees.Add(attendee.Copy<IAttendee>());
            }

            return fb;
        }
Exemplo n.º 20
0
 internal CNotes(CItem parent, IOrganizer medOrganizer, int index, COrganizer.EType type) : base(parent, medOrganizer, index, type)
 {
 }
Exemplo n.º 21
0
        internal COrganizer(CItem parent, ICapability medCapability) : base(parent)
        {
            if (!(parent is CSource))
            {
                throw new Exception("Internal error");
            }
            int num;

            try
            {
                num = medCapability.ClassCount;
            }
            catch (Exception ex)
            {
                Console.WriteLine(this.ToString() + "Unable to query ClassCount property [ " + ex.Message + " ]");
                num = 0;
            }
            this.MedOrganizers    = new IOrganizer[num];
            this.EmptyLists       = new LinkedList <IOrganizerItem> [num];
            this.EmptyListsToPush = new LinkedList <IOrganizerItem> [num];
            for (int i = 1; i <= num; i++)
            {
                IOrganizer organizer = medCapability.GetClass(i) as IOrganizer;
                this.EmptyLists[i - 1]       = new LinkedList <IOrganizerItem>();
                this.EmptyListsToPush[i - 1] = new LinkedList <IOrganizerItem>();
                if (organizer.SupportsEvents != 0)
                {
                    if (this.Events == null)
                    {
                        this.Events = new CEvents(this, organizer, i - 1, COrganizer.EType.Events);
                    }
                    else
                    {
                        Console.WriteLine(this.ToString() + " : Multiple streams for Events");
                    }
                }
                if (organizer.SupportsNotes != 0)
                {
                    if (this.Notes == null)
                    {
                        this.Notes = new CNotes(this, organizer, i - 1, COrganizer.EType.Notes);
                    }
                    else
                    {
                        Console.WriteLine(this.ToString() + " : Multiple streams for Notes");
                    }
                }
                if (organizer.SupportsTasks != 0 && this.Tasks == null)
                {
                    if (this.Tasks == null)
                    {
                        this.Tasks = new CTasks(this, organizer, i - 1, COrganizer.EType.Tasks);
                    }
                    else
                    {
                        Console.WriteLine(this.ToString() + " : Multiple streams for Tasks");
                    }
                }
                this.MedOrganizers[i - 1] = organizer;
            }
        }
Exemplo n.º 22
0
        public bool Update(CDriver.Progress progress)
        {
            if (this.Events != null)
            {
                this.Events.Invalidate();
            }
            if (this.Tasks != null)
            {
                this.Tasks.Invalidate();
            }
            if (this.Notes != null)
            {
                this.Notes.Invalidate();
            }
            for (int i = 0; i < this.EmptyListsToPush.Length; i++)
            {
                this.EmptyListsToPush[i].Clear();
                this.EmptyLists[i].Clear();
            }
            int num  = 0;
            int num2 = 1000 / ((this.MedOrganizers.Length > 0) ? this.MedOrganizers.Length : 1);

            for (int j = 0; j < this.MedOrganizers.Length; j++)
            {
                IOrganizer organizer = this.MedOrganizers[j];
                IOperation operation = organizer.Cache() as IOperation;
                if (!CDriver.OperationToProgress(operation, progress, num, num + num2 / 2))
                {
                    return(false);
                }
                int num3;
                try
                {
                    num3 = organizer.StreamCount;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(this.ToString() + "Unable to query StreamCount property [ " + ex.Message + " ]");
                    num3 = 0;
                }
                for (int k = 1; k <= num3; k++)
                {
                    IOrganizerItem organizerItem = (IOrganizerItem)organizer.GetStream(k);
                    if (organizerItem.Type == 1)
                    {
                        this.Events.AddLast(new COrganizerEntry(this.Events, organizerItem, this.Events.EntryDescriptor));
                    }
                    else
                    {
                        if (organizerItem.Type == 3)
                        {
                            this.Notes.AddLast(new COrganizerEntry(this.Notes, organizerItem, this.Notes.EntryDescriptor));
                        }
                        else
                        {
                            if (organizerItem.Type == 2)
                            {
                                this.Tasks.AddLast(new COrganizerEntry(this.Tasks, organizerItem, this.Tasks.EntryDescriptor));
                            }
                            else
                            {
                                this.EmptyLists[j].AddLast(organizerItem);
                            }
                        }
                    }
                    if (!progress(num + num2 * k / num3 / 2 + num2 / 2))
                    {
                        return(false);
                    }
                }
                num += num2;
            }
            return(progress(1000));
        }
Exemplo n.º 23
0
 /// <summary>
 ///     Gets the free busy.
 /// </summary>
 /// <param name="organizer">The organizer.</param>
 /// <param name="contacts">The contacts.</param>
 /// <param name="fromInclusive">From inclusive.</param>
 /// <param name="toExclusive">To exclusive.</param>
 /// <returns></returns>
 public IFreeBusy GetFreeBusy(IOrganizer organizer, IAttendee[] contacts, IDateTime fromInclusive, IDateTime toExclusive)
 {
     return(this.Aggregate <IICalendar, IFreeBusy>(null, (current, iCal) => CombineFreeBusy(current, iCal.GetFreeBusy(organizer, contacts, fromInclusive, toExclusive))));
 }
Exemplo n.º 24
0
        static public IFreeBusy CreateRequest(IDateTime fromInclusive, IDateTime toExclusive, IOrganizer organizer, IAttendee[] contacts)
        {
            FreeBusy fb = new FreeBusy();

            fb.DTStamp = iCalDateTime.Now;
            fb.DTStart = fromInclusive;
            fb.DTEnd   = toExclusive;
            if (organizer != null)
            {
                fb.Organizer = organizer.Copy <IOrganizer>();
            }
            if (contacts != null)
            {
                foreach (IAttendee attendee in contacts)
                {
                    fb.Attendees.Add(attendee.Copy <IAttendee>());
                }
            }

            return(fb);
        }
Exemplo n.º 25
0
            public CEntryDescriptor(CItem parent, IOrganizer organizer) : base(parent)
            {
                if (!(parent is COrganizerEntries))
                {
                    throw new Exception("Internal error");
                }
                int num = COrganizerEntries.CEntryDescriptor.entryTypes.Length;

                if (organizer.SupportsAudioAlarmTimestamp == 0)
                {
                    num--;
                }
                if (organizer.SupportsCompletedTimestamp == 0)
                {
                    num--;
                }
                if (organizer.SupportsDueToTimestamp == 0)
                {
                    num--;
                }
                if (organizer.SupportsEndTimestamp == 0)
                {
                    num--;
                }
                if (organizer.SupportsStartTimestamp == 0)
                {
                    num--;
                }
                if (organizer.DescriptionCharacters == 0)
                {
                    num--;
                }
                if (organizer.LocationCharacters == 0)
                {
                    num--;
                }
                if (organizer.SummaryCharacters == 0)
                {
                    num--;
                }
                this._MaxDataLengths = new Dictionary <CEntryItem.EDataType, int>();
                this._DataTypes      = new CEntryItem.EDataType[num][];
                int num2 = 0;

                for (int i = 0; i < COrganizerEntries.CEntryDescriptor.entryTypes.Length; i++)
                {
                    bool flag = true;
                    CEntryItem.EDataType eDataType = COrganizerEntries.CEntryDescriptor.entryTypes[i];
                    if (eDataType != CEntryItem.EDataType.Number)
                    {
                        switch (eDataType)
                        {
                        case CEntryItem.EDataType.Description:
                            if (organizer.DescriptionCharacters == 0)
                            {
                                flag = false;
                            }
                            this._MaxDataLengths[COrganizerEntries.CEntryDescriptor.entryTypes[i]] = organizer.DescriptionCharacters;
                            break;

                        case CEntryItem.EDataType.Summary:
                            if (organizer.SummaryCharacters == 0)
                            {
                                flag = false;
                            }
                            this._MaxDataLengths[COrganizerEntries.CEntryDescriptor.entryTypes[i]] = organizer.SummaryCharacters;
                            break;

                        case CEntryItem.EDataType.Location:
                            if (organizer.LocationCharacters == 0)
                            {
                                flag = false;
                            }
                            this._MaxDataLengths[COrganizerEntries.CEntryDescriptor.entryTypes[i]] = organizer.LocationCharacters;
                            break;

                        default:
                            switch (eDataType)
                            {
                            case CEntryItem.EDataType.AlarmTime:
                                flag = (organizer.SupportsAudioAlarmTimestamp != 0);
                                this._MaxDataLengths[COrganizerEntries.CEntryDescriptor.entryTypes[i]] = 65536;
                                break;

                            case CEntryItem.EDataType.CompletedTime:
                                flag = (organizer.SupportsCompletedTimestamp != 0);
                                this._MaxDataLengths[COrganizerEntries.CEntryDescriptor.entryTypes[i]] = 65536;
                                break;

                            case CEntryItem.EDataType.DueToTime:
                                flag = (organizer.SupportsDueToTimestamp != 0);
                                this._MaxDataLengths[COrganizerEntries.CEntryDescriptor.entryTypes[i]] = 65536;
                                break;

                            case CEntryItem.EDataType.EndTime:
                                flag = (organizer.SupportsEndTimestamp != 0);
                                this._MaxDataLengths[COrganizerEntries.CEntryDescriptor.entryTypes[i]] = 65536;
                                break;

                            case CEntryItem.EDataType.StartTime:
                                flag = (organizer.SupportsStartTimestamp != 0);
                                this._MaxDataLengths[COrganizerEntries.CEntryDescriptor.entryTypes[i]] = 65536;
                                break;
                            }
                            break;
                        }
                    }
                    else
                    {
                        this._MaxDataLengths[COrganizerEntries.CEntryDescriptor.entryTypes[i]] = 15;
                    }
                    if (flag)
                    {
                        this._DataTypes[num2] = new CEntryItem.EDataType[1];
                        this._MaxDataLengths[CEntryItem.EDataType.Empty] = 0;
                        this._DataTypes[num2][0] = COrganizerEntries.CEntryDescriptor.entryTypes[i];
                        num2++;
                    }
                }
            }
Exemplo n.º 26
0
 public static void PrintAll(string filePath, IOrganizer org)
 {
     TextFilesIO.PrintEntriesOfType <Entry>(filePath, org);
 }
Exemplo n.º 27
0
        public Dictionary <string, ArrayList> GetDataCollection(ISection sections, PatientClinicalInformation ptInformation)
        {
            Dictionary <string, ArrayList> componententries = new Dictionary <string, ArrayList>();
            IEntryCollection           entries     = sections.Entry;
            IStrucDocText              sectiontext = sections.Text;
            IStrucDocElementCollection textitem    = sectiontext.Items;

            if (entries.Count() > 0)
            {
                int count = 0;
                foreach (IEntry singlerecord in entries)
                {
                    itemAct       = singlerecord.AsAct;
                    itemEncounter = singlerecord.AsEncounter;
                    itemSubstanceAdministration = singlerecord.AsSubstanceAdministration;
                    observation = singlerecord.AsObservation;
                    organizer   = singlerecord.AsOrganizer;
                    procedure   = singlerecord.AsProcedure;
                    //if(sections.Code.Code== "18776-5")
                    // {

                    // }
                    ArrayList arrayList = new ArrayList();
                    if (itemAct != null)
                    {
                        entryRelationship = itemAct.EntryRelationship;
                        IIVL_TS efftime = itemAct.EffectiveTime;
                        if (efftime != null && efftime.Low != null)
                        {
                            if (efftime.Low.Value != null)
                            {
                                arrayList.Add(efftime.Low.AsDateTime.ToString());
                            }
                            else
                            {
                                arrayList.Add("null");
                            }
                        }
                        else
                        {
                            arrayList.Add("null");
                        }
                        if (entryRelationship != null && entryRelationship.Count > 0)
                        {
                            observation = entryRelationship.Select(o => o.AsObservation).FirstOrDefault();
                            if (observation != null)
                            {
                                if (observation.Participant.Count() > 0)
                                {
                                    string participent = observation.Participant.Select(p => p.ParticipantRole).FirstOrDefault().AsPlayingEntity.Name.FirstOrDefault().Text;
                                    arrayList.Add(participent);
                                }

                                entity = observation.EntryRelationship;
                                foreach (IEntryRelationship singlentity in entity)
                                {
                                    IObservation entityobservation = singlentity.AsObservation;
                                    IANY         observationvalue  = entityobservation.Value.FirstOrDefault();
                                    if (observationvalue != null)
                                    {
                                        var    obj     = observationvalue.GetType();
                                        string objname = obj.Name;
                                        switch (objname)
                                        {
                                        default:
                                            ICD strcd = (ICD)observationvalue;
                                            arrayList.Add(strcd.Code);
                                            arrayList.Add(strcd.DisplayName);
                                            break;

                                        case "PQ":
                                            IPQ strpq = (IPQ)observationvalue;
                                            arrayList.Add(strpq.Value.ToString() + " " + strpq.Unit.ToString());
                                            break;
                                        }
                                    }
                                }

                                componententries.Add(count.ToString(), arrayList);
                                count++;
                            }
                        }
                        else
                        {
                            arrayList.Add(itemAct.Text.Text);
                            componententries.Add(count.ToString(), arrayList);
                            count++;
                        }
                    }
                    else if (itemEncounter != null)
                    {
                        entryRelationship = itemEncounter.EntryRelationship;
                        if ((entryRelationship.Select(t => t.TypeCode).FirstOrDefault().ToString()) == "RSON")
                        {
                            observation = entryRelationship.Select(o => o.AsObservation).FirstOrDefault();
                            IIVL_TS efftime          = observation.EffectiveTime;
                            IANY    observationvalue = observation.Value.FirstOrDefault();
                            ICD     str = (ICD)observationvalue;
                            arrayList.Add(str.DisplayName);
                            arrayList.Add(ptInformation.ptClinicInformation.ClinicName);
                            if (efftime.Low != null)
                            {
                                arrayList.Add(efftime.Low.AsDateTime);
                            }
                            else
                            {
                                arrayList.Add(null);
                            }
                            arrayList.Add(str.Code);
                        }

                        componententries.Add(count.ToString(), arrayList);
                        count++;
                    }
                    else if (itemSubstanceAdministration != null)
                    {
                        consumable          = itemSubstanceAdministration.Consumable;
                        manufacturedProduct = consumable.ManufacturedProduct;
                        material            = manufacturedProduct.AsMaterial;
                        arrayList.Add(material.Code.Code);
                        arrayList.Add(itemSubstanceAdministration.StatusCode.Code.ToString());
                        ISXCM_TSCollection efftime = itemSubstanceAdministration.EffectiveTime;
                        if (efftime.Count > 1)
                        {
                            foreach (IVL_TS daterange in efftime)
                            {
                                string startdatetime = daterange.Low != null ? daterange.Low.Value != null?daterange.Low.AsDateTime.ToString() : "null" : "null";

                                string EndDAtetime = daterange.High != null ? daterange.High.Value != null?daterange.High.AsDateTime.ToString() : "null" : "null";

                                arrayList.Add(startdatetime);
                                arrayList.Add(EndDAtetime);
                                break;
                            }
                        }
                        else
                        {
                            arrayList.Add(efftime[0].AsDateTime.ToString());
                        }

                        arrayList.Add(material.Code.DisplayName);
                        if (itemSubstanceAdministration.DoseQuantity != null)
                        {
                            arrayList.Add(itemSubstanceAdministration.DoseQuantity.Value.ToString() + " " + itemSubstanceAdministration.DoseQuantity.Unit.ToString());
                        }
                        else
                        {
                            arrayList.Add("NA");
                        }
                        if (manufacturedProduct.ManufacturerOrganization != null)
                        {
                            arrayList.Add(manufacturedProduct.ManufacturerOrganization.Name.ToString());
                        }
                        else
                        {
                            arrayList.Add("NA");
                        }

                        componententries.Add(count.ToString(), arrayList);
                        count++;
                    }
                    else if (observation != null)
                    {
                        if (observation.Value.Count > 0)
                        {
                            IANY observationvalue = observation.Value.FirstOrDefault();
                            ICD  str = (ICD)observationvalue;
                            arrayList.Add(str.Code);
                            arrayList.Add(str.DisplayName);
                            IIVL_TS efftime = observation.EffectiveTime;
                            if (efftime != null && efftime.Low != null)
                            {
                                if (efftime.Low.Value != null)
                                {
                                    arrayList.Add(efftime.Low.AsDateTime.ToString());
                                }
                                else
                                {
                                    arrayList.Add("null");
                                }
                            }
                            else
                            {
                                arrayList.Add("null");
                            }
                        }
                        else
                        {
                            arrayList.Add(null);
                            arrayList.Add(null);
                            arrayList.Add(null);
                        }

                        componententries.Add(count.ToString(), arrayList);
                        count++;
                    }
                    else if (organizer != null)
                    {
                        IComponent4Collection orgComponent = organizer.Component;

                        foreach (IComponent4 objItem in orgComponent)
                        {
                            IObservation orgObservation = objItem.AsObservation;
                            arrayList.Add(orgObservation.Code.DisplayName);
                            if (orgObservation.Value != null)
                            {
                                IANY   observationvalue = orgObservation.Value.FirstOrDefault();
                                var    obj     = observationvalue.GetType();
                                string objname = obj.Name;

                                switch (objname)
                                {
                                default:
                                    ICD strcd = (ICD)observationvalue;
                                    arrayList.Add(strcd.Code);
                                    arrayList.Add(strcd.DisplayName);
                                    break;

                                case "PQ":
                                    IPQ strpq = (IPQ)observationvalue;
                                    arrayList.Add(strpq.Value.ToString() + " " + strpq.Unit.ToString());
                                    break;
                                }
                                //IPQ str = (IPQ)observationvalue;
                                //arrayList.Add(str.Value.ToString() + " " + str.Unit.ToString());
                            }
                            IIVL_TS efftime = orgObservation.EffectiveTime;
                            if (efftime != null && efftime.Low != null)
                            {
                                if (efftime.Low.Value != null)
                                {
                                    arrayList.Add(efftime.Low.AsDateTime.ToString());
                                }
                                else
                                {
                                    arrayList.Add("null");
                                }
                            }
                            else
                            {
                                arrayList.Add("null");
                            }
                            if (orgObservation.ReferenceRange != null)
                            {
                                if (orgObservation.ReferenceRange.Count > 0)
                                {
                                    arrayList.Add(orgObservation.ReferenceRange[0].ObservationRange.Text.Text);
                                }
                                else
                                {
                                    arrayList.Add("NA");
                                }
                            }
                        }
                        arrayList.Add(organizer.Code.Code);
                        componententries.Add(count.ToString(), arrayList);
                        count++;
                    }
                    else if (procedure != null)
                    {
                        if (procedure.Code != null)
                        {
                            arrayList.Add(procedure.Code.Code);
                            arrayList.Add(procedure.Code.DisplayName);
                        }
                        else
                        {
                            arrayList.Add(null);
                            arrayList.Add(null);
                        }
                        componententries.Add(count.ToString(), arrayList);
                        count++;
                    }
                }
            }

            return(componententries);
        }
Exemplo n.º 28
0
        public static IFreeBusy CreateRequest(IDateTime fromInclusive, IDateTime toExclusive, IOrganizer organizer, IAttendee[] contacts)
        {
            var fb = new FreeBusy
            {
                DtStamp = CalDateTime.Now,
                DtStart = fromInclusive,
                DtEnd   = toExclusive
            };

            if (organizer != null)
            {
                fb.Organizer = organizer.Copy <IOrganizer>();
            }
            if (contacts != null)
            {
                foreach (var attendee in contacts)
                {
                    fb.Attendees.Add(attendee.Copy <IAttendee>());
                }
            }

            return(fb);
        }
Exemplo n.º 29
0
 public HomeController(IMeetup meetupProxy, IOrganizer organizerProxy)
 {
     this.meetupProxy    = meetupProxy;
     this.organizerProxy = organizerProxy;
 }