コード例 #1
0
 private void btn_save_Click(object sender, EventArgs e)
 {
     Recopie();
     if (current.Control())
     {
         if (!current.Update)
         {
             NiveauAcces f = NiveauAccesBLL.Save(current);
             if (f != null ? f.Id > 0 : false)
             {
                 current.Id     = f.Id;
                 current.Update = true;
                 AddRow(f);
                 Messages.Succes();
             }
         }
         else
         {
             if (NiveauAccesBLL.Update(current))
             {
                 UpdateRow(current);
                 Messages.Succes();
             }
         }
         Reset();
     }
 }
コード例 #2
0
        private NiveauAcces SuperNiveau()
        {
            NiveauAcces        n     = new NiveauAcces();
            string             query = "select * from niveau_acces where super = true limit 1";
            List <NiveauAcces> l     = NiveauAccesBLL.List(query);

            if (l != null ? l.Count > 0 : false)
            {
                n = l[0];
            }
            else
            {
                n.Super       = true;
                n.Description = "Super Administrateur";
                n.Designation = "Super Administrateur";
                n             = NiveauAccesBLL.Save(n);
            }

            query = "select * from formulaires";
            List <Formulaires> lf = FormulairesBLL.List(query);

            foreach (Formulaires f in lf)
            {
                AutorisationFormulaire a = AutorisationFormulaireBLL.One(AutorisationFormulaireBLL.Current(new AutorisationFormulaire(n, f, true)));
                if (a != null ? a.Id < 1 : true)
                {
                    AutorisationFormulaireBLL.Save(new AutorisationFormulaire(n, f, true));
                }
            }

            query = "select * from ressources";
            List <Ressources> lr = RessourcesBLL.List(query);

            foreach (Ressources r in lr)
            {
                AutorisationRessource a = AutorisationRessourceBLL.One(AutorisationRessourceBLL.Current(new AutorisationRessource(n, r, true)));
                if (a != null ? a.Id < 1 : true)
                {
                    AutorisationRessourceBLL.Save(new AutorisationRessource(n, r, true));
                }
            }
            return(n);
        }
コード例 #3
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            NiveauAcces f = new NiveauAcces();

            f.Designation = txt_designation.Text.Trim();
            f.Description = txt_description.Text.Replace("'", "''");
            if (f.Control())
            {
                f = NiveauAccesBLL.Save(f);
                if (f != null ? f.Id > 0 : false)
                {
                    current.niveaux.Add(f);
                    current.com_niveau.Refresh();
                    current.com_niveau.DataSource = new BindingSource(current.niveaux, null);
                    current.com_niveau.ResetText();
                    current.com_niveau.SelectedText = f.Designation;
                    current.current = f;
                    this.Close();
                }
            }
        }