Example #1
0
 private string TranslateTypeOfAlarm()
 {
     if (TypeOfAlarm.ToString().Equals("Positive"))
     {
         return("positiva");
     }
     else
     {
         return("negativa");
     }
 }
Example #2
0
        public override bool Equals(Object obj)
        {
            AuthorAlarm authorAlarm = obj as AuthorAlarm;

            if (authorAlarm == null || Convert.IsDBNull(authorAlarm))
            {
                return(false);
            }
            return(QuantityPost == authorAlarm.QuantityPost && QuantityTime == authorAlarm.QuantityTime &&
                   ParticipantsAuthors.SequenceEqual(authorAlarm.ParticipantsAuthors) &&
                   TypeOfAlarm.Equals(authorAlarm.TypeOfAlarm));
        }
Example #3
0
        public override bool Equals(Object obj)
        {
            EntityAlarm sentimentAlarm = obj as EntityAlarm;

            if (sentimentAlarm == null || Convert.IsDBNull(sentimentAlarm))
            {
                return(false);
            }

            return(QuantityPost == sentimentAlarm.QuantityPost && QuantityTime == sentimentAlarm.QuantityTime &&
                   Entity.Equals(sentimentAlarm.Entity) &&
                   TypeOfAlarm.Equals(sentimentAlarm.TypeOfAlarm));
        }
Example #4
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;
                }
            }
        }
Example #5
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;
                }
            }
        }