/// <summary>
 /// Méthode bouton Click. Permet d'ajouté une Propositions à la base de donnée
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void PropositionBouton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (Information.Text == "Veuillez saisir vos Informations...")
         {
             throw new Exception("Proposition invalide");
         }
         Propositions propositions = new Propositions(Information.Text);
         Manager.Ajouter(propositions);
         new FenetrePopUp("Votre proposition va être étudiée par les administrateurs.\nL'équipe Coronashop vous remercie.", "OK!");
         Close();
     }
     catch (Exception ex)
     {
         new FenetrePopUp(ex.Message, "OK!");
     }
 }
Exemple #2
0
        public bool IsClosed()
        {
            List <Proposition> pSet = Propositions.ToList();

            // It can be closed if we have one constant False or one Negated True already.
            // Constants are only part of abstract propositions
            foreach (Proposition p in pSet)
            {
                if (ConstantContradiction(p))
                {
                    return(true);
                }
            }

            // We could split it up by taking out this part and put it in a base class.
            for (int i = 0; i < pSet.Count - 1; i++)
            {
                for (int j = i + 1; j < pSet.Count; j++)
                {
                    if (IsContradiction(pSet[i], pSet[j]))
                    {
                        return(true);
                    }
                }
            }

            bool closed = false;

            if (LeftChild != null)
            {
                closed = LeftChild.IsClosed();
            }

            if (RightChild != null)
            {
                closed = closed && RightChild.IsClosed();
            }

            return(closed);
        }
Exemple #3
0
 public bool Evaluate(ReadOnlyDictionary <string, string[]> properties)
 {
     return(Negate ^ ((Conjunctions != null ? Conjunctions.All(c => c.Evaluate(properties)) : true) &&
                      (Disjunctions != null ? Disjunctions.All(d => d.Evaluate(properties)) : true) &&
                      (Propositions != null ? Propositions.All(p => p.Evaluate(properties)) : true)));
 }