Exemplo n.º 1
0
 private void dgv_form_CellEndEdit(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dgv_form.Rows.Count > 0)
         {
             if (dgv_form.CurrentRow.Cells["id_form_"].Value != null)
             {
                 Int32 id = (Int32)dgv_form.CurrentRow.Cells["id_form_"].Value;
                 if (id > 0)
                 {
                     Formulaires            f = new Formulaires(id);
                     bool                   b = (bool)dgv_form.CurrentRow.Cells[e.ColumnIndex].Value;
                     AutorisationFormulaire a = AutorisationFormulaireBLL.One(AutorisationFormulaireBLL.Current(new AutorisationFormulaire(current, f, b)));
                     if (a != null ? a.Id > 0 : false)
                     {
                         AutorisationFormulaireBLL.Update(new AutorisationFormulaire(a.Id, current, f, b));
                     }
                     else
                     {
                         AutorisationFormulaireBLL.Save(new AutorisationFormulaire(current, f, b));
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Messages.Exception(ex);
     }
 }
Exemplo n.º 2
0
        private void LoadFormulaire(NiveauAcces n)
        {
            dgv_form.Rows.Clear();
            string             query = "select * from formulaires order by code";
            List <Formulaires> l     = FormulairesBLL.List(query);

            foreach (Formulaires f in l)
            {
                f.Update = AutorisationFormulaireBLL.One(AutorisationFormulaireBLL.Current(new AutorisationFormulaire(n, f))).Update;
                AddRowFormulaire(f);
            }
        }
Exemplo n.º 3
0
        public static void LoadAcces(NiveauAcces n)
        {
            string query = "select * from autorisation_formulaire where niveau = " + n.Id;
            List <AutorisationFormulaire> lf = AutorisationFormulaireBLL.List(query);

            foreach (AutorisationFormulaire af in lf)
            {
                new AccesFormulaires().Acces(af.Formulaire.Code, af.Update);
            }

            query = "select * from autorisation_ressource where niveau = " + n.Id;
            List <AutorisationRessource> lr = AutorisationRessourceBLL.List(query);

            foreach (AutorisationRessource af in lr)
            {
                new AccesRessources().Acces(af.Ressource.Code, af.Update);
            }
        }
Exemplo n.º 4
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);
        }