public void afficherDetail(plateforme p) { var categplat = new Categorie(RequeteSql.srchCategorie(p.codeCateg).First()); rTxtDesc.Text = p.descPlate; rTxtInfoSup.Text = p.infoSupPlate; txtCartemere.Text = p.carteMerePlate; txtCode.Text = p.codePlate; txtCPU.Text = p.cpuPlate; txtID.Text = p.idPlate.ToString(); txtNom.Text = p.nomPlate; txtRam.Text = p.ramPlate; txtStockage.Text = p.stockage; foreach (var item in cboxCateg.Items) { if (((Categorie)item).codeCateg == categplat.codeCateg) { cboxCateg.SelectedItem = item; break; } } foreach (var item in p.lstSysExpPlate) { ajoutSysExpDetails(item); } }
public frmDetPlateforme(plateforme p) { InitializeComponent(); selectPlate = p; loadList(); ctrlPlate = new ctrlPlateforme(); btnEnregistrer.Click += new EventHandler(btnAjout_Click); loadDetail(); ajusterForm(); afficherDetail(p); }
public frmDetPlateforme(plateforme p) { InitializeComponent(); type = "modif"; selectPlate = p; loadList(); ctrlPlate = new ctrlPlateforme(); btnEnregistrer.Click += new EventHandler(btnEnregistrer_Click); btnSupprimer.Click += new EventHandler(btnSupprimer_Click); btnCopier.Click += new EventHandler(btnCopier_Click); btnAnnuler.Enabled = true; loadDetail(); ajusterForm(); afficherDetail(p); }
private void btnCopier_Click(object sender, EventArgs e) { var copieJeu = new tblJeu(); var lstTheme = new List<Theme>(); var lstPlateforme = new List<plateforme>(); frmDetJeu frmDetails; copieJeu.NomJeu = txtNom.Text.Trim(); copieJeu.DescJeu = txtDesc.Text.Trim(); copieJeu.CoteESRB = cboxCote.Text.Trim(); copieJeu.InfoSupJeu = rtxtInfoSup.Text.Trim(); copieJeu.Actif = true; if (cboxGenre.Text != "") { foreach (var g in RequeteSql.rechercheGenre(cboxGenre.Text)) { copieJeu.IdGenre = g.IdGenre; } } if (cboxMode.Text != "") { foreach (var g in RequeteSql.rechercheMode(cboxMode.Text)) { copieJeu.IdMode = g.IdMode; } } foreach (TreeNode item in tvSelectTheme.Nodes) { Theme temp = new Theme((tblTheme)item.Tag); lstTheme.Add(temp); } foreach (TreeNode item in tvSelectPlateforme.Nodes) { plateforme temp = new plateforme((tblPlateforme)item.Tag); lstPlateforme.Add(temp); } Jeu j = new Jeu(copieJeu); j.lstTheme = lstTheme; j.lstPlateforme = lstPlateforme; frmDetails = new frmDetJeu(j); frmDetails.type = "copie"; frmDetails.ShowDialog(); //Je sais pas si faut retourner sur l'original //this.Close(); }
private void modifierPlate() { DialogResult r; var nouvPlat = new plateforme(); var lstSysExp = new List<SystemeExploitation>(); if (txtCode.Text.Trim().Length == 0 || txtNom.Text.Trim().Length == 0 || cboxCateg.SelectedItem == null) { MessageBox.Show("Les champs obligatoires ne sont pas bien rempli.", "Erreur", MessageBoxButtons.OK); } else { nouvPlat.idPlate = Convert.ToInt32(txtID.Text); nouvPlat.codePlate = txtCode.Text.Trim(); nouvPlat.nomPlate = txtNom.Text.Trim(); nouvPlat.codeCateg = ((Categorie)cboxCateg.SelectedItem).codeCateg; nouvPlat.cpuPlate = txtCPU.Text.Trim(); nouvPlat.carteMerePlate = txtCartemere.Text.Trim(); nouvPlat.ramPlate = txtRam.Text.Trim(); nouvPlat.stockage = txtStockage.Text.Trim(); nouvPlat.infoSupPlate = rTxtInfoSup.Text.Trim(); nouvPlat.descPlate = rTxtDesc.Text.Trim(); foreach (var item in lstTreeSelect.Nodes) { lstSysExp.Add(((SystemeExploitation)((TreeNode)item).Tag)); } nouvPlat.lstSysExpPlate = lstSysExp; r = MessageBox.Show("Voulez-vous enregistrer?", "Enregistrement", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (r == DialogResult.Yes) { ctrlPlate.modifier(nouvPlat); this.Close(); } } }
private void enrgCopie() { DialogResult r; var copiePlate = new plateforme(); copiePlate.codePlate = txtCode.Text.Trim(); copiePlate.nomPlate = txtNom.Text.Trim(); copiePlate.codeCateg = ((Categorie)cboxCateg.SelectedItem).codeCateg; copiePlate.cpuPlate = txtCPU.Text.Trim(); copiePlate.carteMerePlate = txtCartemere.Text.Trim(); copiePlate.ramPlate = txtRam.Text.Trim(); copiePlate.stockage = txtStockage.Text.Trim(); copiePlate.infoSupPlate = rTxtInfoSup.Text.Trim(); copiePlate.descPlate = rTxtDesc.Text.Trim(); if (ctrlPlate.verifier(selectPlate, copiePlate)) { r = MessageBox.Show("Voulez-vous enregistrer?", "Enregistrement", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (r == DialogResult.Yes) { ajout(); } } else { MessageBox.Show("La copie est pareil a l'ancien.", "Erreure", MessageBoxButtons.OK); } }
private void btnCopier_Click(object sender, EventArgs e) { var copiePlate = new plateforme(); var lstSysExp = new List<SystemeExploitation>(); frmDetPlateforme frmDetails; copiePlate.codePlate = txtCode.Text.Trim(); copiePlate.nomPlate = txtNom.Text.Trim(); copiePlate.codeCateg = ((Categorie)cboxCateg.SelectedItem).codeCateg; copiePlate.cpuPlate = txtCPU.Text.Trim(); copiePlate.carteMerePlate = txtCartemere.Text.Trim(); copiePlate.ramPlate = txtRam.Text.Trim(); copiePlate.stockage = txtStockage.Text.Trim(); copiePlate.infoSupPlate = rTxtInfoSup.Text.Trim(); copiePlate.descPlate = rTxtDesc.Text.Trim(); foreach (var item in lstTreeSelect.Nodes) { lstSysExp.Add(((SystemeExploitation)((TreeNode)item).Tag)); } copiePlate.lstSysExpPlate = lstSysExp; frmDetails = new frmDetPlateforme(copiePlate); frmDetails.modifierChamp("a"); frmDetails.type = "copie"; frmDetails.ShowDialog(); }
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 (TreeNode item in tvSelectTheme.Nodes) { Theme temp = new Theme((tblTheme)item.Tag); lstTheme.Add(temp); } foreach (TreeNode item in tvSelectPlateforme.Nodes) { plateforme temp = new plateforme((tblPlateforme)item.Tag); 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(); } } }
private tblPlateforme plateTotblPlate(plateforme p) { tblSysExp systemp = new tblSysExp(); tblPlateforme tblP = new tblPlateforme(); tblP.IdPlateforme = p.idPlate; tblP.CodePlateforme = p.codePlate; tblP.NomPlateforme = p.nomPlate; tblP.CodeCategorie = p.codeCateg; tblP.CPU = p.cpuPlate; tblP.CarteMere = p.carteMerePlate; tblP.RAM = p.ramPlate; tblP.Stockage = p.stockage; tblP.DescPlateforme = p.descPlate; tblP.InfoSupPlateforme = p.infoSupPlate; foreach (SystemeExploitation item in p.lstSysExpPlate) { systemp = new tblSysExp(); systemp.CodeSysExp = item.CodeSysExp; systemp.EditionSysExp = item.editSysExp; systemp.IdSysExp = item.idSysExp; systemp.InfoSupSysExp = item.infoSysExp; systemp.NomSysExp = item.nomSysExp; systemp.Tag = item.tagSysExp; systemp.VersionSysExp = item.versionSysExp; tblP.tblSysExp.Add(systemp); } return tblP; }
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(); } } }
private void btnAjout_Click(object sender, EventArgs e) { var nouvPlat = new plateforme(); var lstSysExp = new List<SystemeExploitation>(); if (txtCode.Text.Trim().Length == 0 || txtNom.Text.Trim().Length == 0 || cboxCateg.SelectedItem == null) { //erreur } else { nouvPlat.codePlate = txtCode.Text.Trim(); nouvPlat.nomPlate = txtNom.Text.Trim(); nouvPlat.codeCateg = ((Categorie)cboxCateg.SelectedItem).codeCateg; nouvPlat.cpuPlate = txtCPU.Text.Trim(); nouvPlat.carteMerePlate = txtCartemere.Text.Trim(); nouvPlat.ramPlate = txtRam.Text.Trim(); nouvPlat.stockage = txtStockage.Text.Trim(); nouvPlat.infoSupPlate = rTxtInfoSup.Text.Trim(); nouvPlat.descPlate = rTxtDesc.Text.Trim(); foreach (var item in lstTreeSelect.Nodes) { lstSysExp.Add(((SystemeExploitation)((TreeNode)item).Tag)); } nouvPlat.lstSysExpPlate = lstSysExp; ctrlPlate.ajouter(nouvPlat); this.Close(); } }