Example #1
0
 public List<SystemeExploitation> rechercher(string chaine)
 {
     List<SystemeExploitation> lstSysExp = new List<SystemeExploitation>();
     foreach (var c in rSysExpSQL.srchSysExp(chaine))
     {
         SystemeExploitation sysexp = new SystemeExploitation(c);
         lstSysExp.Add(sysexp);
     }
     return lstSysExp;
 }
Example #2
0
 public void enregistrer(SystemeExploitation sysExp)
 {
     if (sysExp.idSysExp == 0)
     {
         RequeteSql.addSysExp(sysExp);
     }
     else
     {
         RequeteSql.setSysExp(sysExp);
     }
 }
Example #3
0
 public void enregistrer(SystemeExploitation sysExp)
 {
     if (sysExp.idSysExp == 0)
     {
         rSysExpSQL.addSysExp(sysExp);
     }
     else
     {
         rSysExpSQL.setSysExp(sysExp);
     }
 }
Example #4
0
 public frmDetSysExp(string[] info)
 {
     InitializeComponent();
     this.PositionBtn(315);
     this.btnActiverModif.Click += new EventHandler(activerModif);
     this.btnEnregistrer.Click += new EventHandler(btnEnregistrer_Click);
     this.btnSupprimer.Click += new EventHandler(btnSupprimer_Click);
     this.btnCopier.Click += new EventHandler(btnCopier_Click);
     txtNom.Text = info[2];
     infoSysExp = info;
     gestionSysExp = new ctrlSysExp();
     annuler = true;
     ancienSysExp = new SystemeExploitation();
 }
Example #5
0
        public static void addSysExp(SystemeExploitation settings)
        {
            var add = new tblSysExp();

            add.CodeSysExp = settings.CodeSysExp;
            add.NomSysExp = settings.nomSysExp;
            add.EditionSysExp = settings.editSysExp;
            add.VersionSysExp = settings.versionSysExp;
            add.InfoSupSysExp = settings.infoSysExp;

            db.tblSysExp.Add(add);

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #6
0
        public static void setSysExp(SystemeExploitation settings)
        {
            var i = Convert.ToInt32(settings.idSysExp);

            var r =
                (from sysExp in db.tblSysExp
                 where sysExp.IdSysExp == i
                 select sysExp).First();

            r.CodeSysExp = settings.CodeSysExp;
            r.NomSysExp = settings.nomSysExp;
            r.EditionSysExp = settings.editSysExp;
            r.VersionSysExp = settings.versionSysExp;
            r.InfoSupSysExp = settings.infoSysExp;

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #7
0
 private void ajoutSysExpDetails(SystemeExploitation Sys)
 {
     TreeNode n = new TreeNode(Sys.CodeSysExp);
     n.Tag = Sys;
     lstTreeSelect.Nodes.Add(n);
     foreach (TreeNode item in lstTreeSysExp.Nodes)
     {
         if (((SystemeExploitation)item.Tag).CodeSysExp == Sys.CodeSysExp)
         {
             lstTreeSysExp.Nodes[item.Index].Remove();
             break;
         }
     }
 }
Example #8
0
        public bool verifier(SystemeExploitation sysExp, SystemeExploitation ancien)
        {
            string nom,code,edit,version,info;

            nom = sysExp.nomSysExp;
            code = sysExp.CodeSysExp;
            edit = sysExp.editSysExp;
            version = sysExp.versionSysExp;
            info = sysExp.infoSysExp;

            nom.Trim();
            code.Trim();
            edit.Trim();
            version.Trim();

            if (ancien != null)
            {
                if (nom == ancien.nomSysExp && code == ancien.CodeSysExp &&
                edit == ancien.editSysExp && version == ancien.versionSysExp &&
                info == ancien.infoSysExp)
                {
                    return false;
                }
            }

            return true;
        }
Example #9
0
 public void ajouterSysExp(SystemeExploitation sysExp)
 {
     rSysExpSQL.addSysExp(sysExp);
 }
Example #10
0
        private void btnEnregistrer_Click(object sender, EventArgs e)
        {
            DialogResult resultat;
            var nouvSysExp = new SystemeExploitation();
            var nom = txtNom.Text.Trim();
            var code = txtCode.Text.Trim();
            var edit = txtEdition.Text.Trim();

            nouvSysExp.CodeSysExp = txtCode.Text;
            nouvSysExp.infoSysExp = rtxtInfos.Text;
            nouvSysExp.nomSysExp = txtNom.Text;
            nouvSysExp.versionSysExp = txtVersion.Text;
            nouvSysExp.editSysExp = txtEdition.Text;

            if (txtID.Text != "")
            {
                nouvSysExp.idSysExp = Convert.ToInt32(txtID.Text);
            }

            if (!gestionSysExp.verifier(nouvSysExp, ancienSysExp))
            {
                MessageBox.Show("Aucune modification n'a été apportée.", "Erreur", MessageBoxButtons.OK);
            }
            else
            {
                if (nom.Length > 25 || code.Length > 40 || edit.Length > 40 || nom.Length == 0 || code.Length == 0 || edit.Length == 0)
                {
                    MessageBox.Show("Veuillez remplir les champs correctement.", "Erreur", MessageBoxButtons.OK);
                }
                else
                {
                    resultat = MessageBox.Show("Voulez-vous vraiment Enregistrer ?", "Enregistrement", MessageBoxButtons.YesNo);
                    if (resultat == DialogResult.Yes)
                    {
                        gestionSysExp.enregistrer(nouvSysExp);
                        this.Close();
                    }
                }
            }
        }
Example #11
0
        private void ajout()
        {
            DialogResult r;
            Jeu j = new Jeu();
            List<Theme> lstTheme = new List<Theme>();
            List<plateforme> lstPlateforme = new List<plateforme>();

            if (txtNom.Text.Trim().Length == 0 || txtDesc.Text.Trim().Length == 0)
            {
                MessageBox.Show("Les champs obligatoires ne sont pas bien remplis",
                    "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                tblJeu nouvJeu = new tblJeu();
                nouvJeu.NomJeu = txtNom.Text.Trim();
                nouvJeu.DescJeu = txtDesc.Text.Trim();
                nouvJeu.CoteESRB = cboxCote.Text.Trim();
                nouvJeu.InfoSupJeu = rtxtInfoSup.Text.Trim();
                nouvJeu.Actif = true;
                if (cboxGenre.Text != "")
                {
                    foreach (var g in RequeteSql.rechercheGenre(cboxGenre.Text))
                    {
                        nouvJeu.IdGenre = g.IdGenre;
                    }
                }
                if (cboxMode.Text != "")
                {
                    foreach (var g in RequeteSql.rechercheMode(cboxMode.Text))
                    {
                        nouvJeu.IdMode = g.IdMode;
                    }
                }

                foreach (var item in tvSelectTheme.Nodes)
                {
                    Theme temp = new Theme();
                    temp.idTheme = Convert.ToInt32(((TreeNode)item).Tag);
                    temp.nomTheme = ((TreeNode)item).Text;
                    foreach (var t in RequeteSql.srchTheme(temp.nomTheme))
                    {
                        temp.comTheme = t.ComTheme;
                    }
                    lstTheme.Add(temp);
                }

                foreach (var item in tvSelectPlateforme.Nodes)
                {
                    plateforme temp = new plateforme();
                    //string chaine =  + "%%" + (((TreeNode)item).Text);
                    foreach (var p in RequeteSql.srchPlateforme(((((TreeNode)item).Tag).ToString())))
                    {
                        if (p.NomPlateforme == ((TreeNode)item).Text)
                        {
                            temp = new plateforme(p);
                            foreach (tblSysExp s in p.tblSysExp)
                            {
                                SystemeExploitation SEtemp = new SystemeExploitation(s);
                                temp.lstSysExpPlate.Add(SEtemp);
                            }
                        }
                    }
                    lstPlateforme.Add(temp);
                }

                j = new Jeu(nouvJeu);
                j.lstTheme = lstTheme;
                j.lstPlateforme = lstPlateforme;

                r = MessageBox.Show("Voulez-vous enregistrer?", "Enregistrement", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                if (r == DialogResult.Yes)
                {
                    cj.ajouter(j);
                    this.Close();
                }
            }
        }
Example #12
0
 public void ajouterSysExp(SystemeExploitation sysExp)
 {
     RequeteSql.addSysExp(sysExp);
 }