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); } }
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); }
private void Load() { Formulaires[] l = formulaires; formulaires = new Formulaires[l.Length]; for (int i = 0; i < l.Length; i++) { Formulaires f = l[i]; Int32 id = FormulairesBLL.Current(f); if (id < 1) { Formulaires f_ = FormulairesBLL.Save(f); f.Id = f_.Id; } else { f.Id = id; } Ressources[] t = f.Ressources; f.Ressources = new Ressources[t.Length]; for (int j = 0; j < t.Length; j++) { Ressources r = t[j]; id = RessourcesBLL.Current(r); if (id < 1) { r.Formulaire = f; Ressources r_ = RessourcesBLL.Save(r); r.Id = r_.Id; } else { r.Id = id; } f.Ressources[j] = r; } formulaires[i] = f; } }