示例#1
0
 private void dgv_ress_CellEndEdit(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dgv_ress.Rows.Count > 0)
         {
             if (dgv_ress.CurrentRow.Cells["id_ress_"].Value != null)
             {
                 Int32 id = (Int32)dgv_ress.CurrentRow.Cells["id_ress_"].Value;
                 if (id > 0)
                 {
                     Ressources            r = new Ressources(id);
                     bool                  b = (bool)dgv_ress.CurrentRow.Cells[e.ColumnIndex].Value;
                     AutorisationRessource a = AutorisationRessourceBLL.One(AutorisationRessourceBLL.Current(new AutorisationRessource(current, r, b)));
                     if (a != null ? a.Id > 0 : false)
                     {
                         AutorisationRessourceBLL.Update(new AutorisationRessource(a.Id, current, r, b));
                     }
                     else
                     {
                         AutorisationRessourceBLL.Save(new AutorisationRessource(current, r, b));
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Messages.Exception(ex);
     }
 }
示例#2
0
        private void LoadRessource(NiveauAcces n, Formulaires f)
        {
            dgv_ress.Rows.Clear();
            string            query = "select * from ressources where formulaire = " + f.Id + " order by code";
            List <Ressources> l     = RessourcesBLL.List(query);

            foreach (Ressources r in l)
            {
                r.Update = AutorisationRessourceBLL.One(AutorisationRessourceBLL.Current(new AutorisationRessource(n, r))).Update;
                AddRowRessource(r);
            }
        }
示例#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);
            }
        }
示例#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);
        }