public DossierEditFormViewModel()
 {
     _dialogService  = new DialogService();
     _dossiersBll    = new DossiersBLL();
     _formulairesBll = new FormulairesBLL();
     AsynchroneUpdateList();
 }
Beispiel #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);
            }
        }
Beispiel #3
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);
        }
Beispiel #4
0
        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;
            }
        }
Beispiel #5
0
 private void dgv_form_SelectionChanged(object sender, EventArgs 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 = FormulairesBLL.One(id);
                     LoadRessource(current, f);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Messages.Exception(ex);
     }
 }
 public FormulaireSfaEditFormViewModel()
 {
     _instance       = this;
     _formulairesBll = FormulairesBLL.Current;
 }
Beispiel #7
0
 public FormulaireBaseViewModel()
 {
     _formulaireBll = new FormulairesBLL();
     _dialogService = new DialogService();
 }