Esempio n. 1
0
        /// ////////////////////////////////////////////////////////
        public override CResultAErreur VerifieDonnees()
        {
            CResultAErreur result = base.VerifieDonnees();

            CVariableDynamique variable = VariableElement;

            if (variable == null)
            {
                result.EmpileErreur(I.T("The variable containing the element attach with the event isn't defined or doesn't exist|144"));
            }

            if (!typeof(IObjetDonneeAIdNumerique).IsAssignableFrom(variable.TypeDonnee.TypeDotNetNatif))
            {
                //ce n'est pas un CObjetDonneeAIdNumeriqueAuto
                result.EmpileErreur(I.T("The variable containing the element attach with the event is incorrect|145"));
                return(result);
            }

            if (Libelle.Trim() == "")
            {
                result.EmpileErreur(I.T("The label can't be null|146"));
            }

            result = ParametreDeclencheur.VerifieDonnees();
            if (!result)
            {
                return(result);
            }

            return(result);
        }
Esempio n. 2
0
        public int Enregistrer()
        {
            string sql = "";

            //Insertion des informations
            sql  = "INSERT INTO element (element_type, code, libelle, type_element, actif) VALUES (";
            sql += "'" + Element_Type + "',";
            sql += "'" + Code + "',";
            sql += "'" + Corriger_Texte(Libelle.Replace("'", "''")) + "',";
            sql += "'" + Type_Element + "',";
            sql += "'" + (Actif ? "1":"0") + "')";

            Acces.cls.Execute(sql);
            if (Acces.cls.erreur.Length > 0)
            {
                MessageBox.Show("Erreur dans la requête");
            }

            //Recherche de l'identifiant attribué
            sql  = "SELECT id FROM element";
            sql += " WHERE element_type='" + Element_Type + "'";
            sql += " AND code='" + Code + "'";
            DataSet Sn = Acces.cls.ContenuRequete(sql);

            ID = 0;
            if (Acces.cls.NbLignes > 0)
            {
                ID = int.Parse(Sn.Tables["dataset"].Rows[0][0].ToString());
            }
            else
            {
                return(0);
            }

            for (int i = 0; i < Liste.Count; i++)
            {
                if (Liste[i].Attribut_ID == 0)
                {
                    MessageBox.Show("Le valeur de l'attribut " + Liste[i].Attribut_Code + " n'existe pas");
                }

                Liste[i].ID = ID;
                if (Liste[i].Valeur != null)
                {
                    sql  = "INSERT INTO delement(element_id, attribut_id, attribut_code, valeur) VALUES (";
                    sql += "'" + Liste[i].ID + "',";
                    sql += "'" + Liste[i].Attribut_ID + "',";
                    sql += "'" + Liste[i].Attribut_Code + "',";
                    sql += "'" + Liste[i].Valeur.Replace("'", "''") + "')";
                    Acces.cls.Execute(sql);
                    if (Acces.cls.erreur.Length > 0)
                    {
                        MessageBox.Show(Acces.cls.erreur);
                    }
                }
            }

            return(ID);
        }
Esempio n. 3
0
        public void MettreAJour()
        {
            string sql;

            sql  = "UPDATE attribut SET";
            sql += " code ='" + Code + "',";
            sql += " libelle ='" + Libelle.Replace("'", "''") + "',";
            sql += " element_type ='" + Element_Type + "',";
            sql += " att_6po ='" + ATT_6PO + "'";
            sql += " WHERE id='" + ID + "'";
            Acces.cls.Execute(sql);
        }
Esempio n. 4
0
        //Met à jour les informations relative à l'élémént
        public Boolean MettreAJour()
        {
            string sql;

            Libelle = Libelle.Replace("\u009c", "oe").Replace("\u0085", "");
            Libelle = Libelle.Replace("\u0092", "''");

            //Mise à jour des informations principales relatives à l'élément
            sql  = "UPDATE element SET ";
            sql += " code='" + Code + "',";
            sql += " libelle='" + Libelle.Replace("'", "''") + "',";
            sql += " type_element='" + Type_Element + "',";
            sql += " actif='" + (Actif ? "1" : "0") + "'";
            sql += " WHERE id='" + ID + "'";
            Acces.cls.Execute(sql);
            if (Acces.cls.erreur.Length > 0)
            {
                MessageBox.Show(Acces.cls.erreur); return(false);
            }

            //Suppresion des détails existants
            sql  = "DELETE FROM delement";
            sql += " WHERE element_id='" + ID + "'";
            Acces.cls.Execute(sql);
            if (Acces.cls.erreur.Length > 0)
            {
                MessageBox.Show(Acces.cls.erreur); return(false);
            }

            //Ajout des détails (non vide)
            foreach (dElement d in Liste) //On balaie la liste des détails de l'élément
            {
                if (d.Valeur != null)
                {
                    if (d.Valeur.Trim().Length > 0)
                    {
                        sql  = "INSERT INTO delement (element_id, attribut_id, attribut_code, valeur) ";
                        sql += " VALUES (";
                        sql += "'" + ID + "',";
                        sql += "'" + d.Attribut_ID + "',";
                        sql += "'" + d.Attribut_Code + "',";
                        sql += "'" + d.Valeur.Replace("'", "''") + "')";
                        Acces.cls.Execute(sql);
                    }
                }
            }

            //Suppression des détails d'informations
            Acces.Actualiser_dElement(ID);

            return(true);
        }
Esempio n. 5
0
 public Article()
 {
     this.Adding.Subscribe(p =>
     {
         if (Complementaire.IsNull())
         {
             Complementaire = string.Empty;
         }
         if (Libelle.IsNull())
         {
             Libelle = string.Empty;
         }
     });
 }
Esempio n. 6
0
        public override string ToString()
        {
            string toReturn = "";

            if (State == ElementStateEnum.PresentWithNegation)
            {
                toReturn += "!";
            }
            else if (State == ElementStateEnum.Absent)
            {
                toReturn += "(absent)";
            }

            return(toReturn + Libelle.ToString());
        }
Esempio n. 7
0
        public void Ajouter()
        {
            string sql;

            sql  = "INSERT INTO attribut (code, libelle, element_type, att_6po) VALUES (";
            sql += "'" + Code + "',";
            sql += "'" + Libelle.Replace("'", "''") + "',";
            sql += "'" + Element_Type + "',";
            sql += "'" + ATT_6PO + "')";
            Acces.cls.Execute(sql);

            //Recherche de l'iD attribué
            sql  = "SELECT id from attribut";
            sql += " WHERE Code='" + Code + "'";
            sql += " AND element_type='" + Element_Type + "'";
            DataSet Sn = Acces.cls.ContenuRequete(sql);

            if (Acces.cls.NbLignes > 0)
            {
                ID = int.Parse(Sn.Tables["dataset"].Rows[0][0].ToString());
            }
        }