Beispiel #1
0
 private string TranslateTypeOfAlarm()
 {
     if (TypeOfAlarm.ToString().Equals("Positive"))
     {
         return("positiva");
     }
     else
     {
         return("negativa");
     }
 }
Beispiel #2
0
        public void UpdateState(Phrase[] phrases, DateTime date)
        {
            ParticipantsAuthors.Clear();
            IsActive = false;
            DateTime minDate = date;

            Author[] participants = new Author[phrases.Length];
            int[]    quantity     = new int[phrases.Length];
            for (int i = 0; i < participants.Length; i++)
            {
                participants[i] = new Author();
            }
            int index = 0;

            foreach (Phrase phrase in phrases)
            {
                minDate = DeterminateMinDate(date);
                if (phrase.PhraseDate >= minDate)
                {
                    if (phrase.PhraseType.ToString().Equals(TypeOfAlarm.ToString()))
                    {
                        int currentIndex = Array.FindIndex(participants, p => p.Equals(phrase.PhraseAuthor));
                        if (currentIndex == -1)
                        {
                            participants[index] = phrase.PhraseAuthor;
                            quantity[index]++;
                        }
                        else
                        {
                            quantity[currentIndex]++;
                        }
                        index++;
                    }
                }
            }
            for (int i = 0; i < quantity.Length; i++)
            {
                if (quantity[i] >= QuantityPost)
                {
                    ParticipantsAuthors.Add(participants[i]);
                    IsActive = true;
                }
            }
        }
Beispiel #3
0
        public void UpdateState(Phrase[] phrases, DateTime date)
        {
            int counterPost = 0;

            IsActive = false;
            DateTime minDate = DeterminateMinDate(date);;

            foreach (Phrase phrase in phrases)
            {
                if (phrase.Entity != null)
                {
                    if (phrase.PhraseDate >= minDate)
                    {
                        if (phrase.Entity.Equals(Entity) && phrase.PhraseType.ToString().Equals(TypeOfAlarm.ToString()))
                        {
                            counterPost++;
                        }
                    }
                }
                if (counterPost >= QuantityPost)
                {
                    IsActive = true;
                }
            }
        }