public static int PERSONNES_GETIDBYPERS(PersonneClass p) { int id = -1; string requete = "select idpers from personnes where prenompers = '" + p.prenom + "' and nompers= '" + p.nom + "' and mailpers ='" + p.e_mail + "'"; try { OleDbCommand cmdaccess = new OleDbCommand(requete, BDGestionAccess2013.connexion_access); OleDbDataReader lecteur = cmdaccess.ExecuteReader(); while (lecteur.Read()) { id = lecteur.GetInt32(0); } lecteur.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.InnerException); } return(id); }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (this.listBox1.SelectedIndex != -1) { this.PERS = this.tabpers[this.listBox1.SelectedIndex]; } }
public static void MODIFIE_PERSONNE(PersonneClass pers) { try { // ------------- modif d'une tache string mod = "Update personnes set civpers='" + pers.civilite + "',prenompers='" + pers.prenom.Replace("'", "''") + "',nompers ='" + pers.nom.Replace("'", "''") + "',datenaisspers='" + pers.dateNaissance + "',mailpers='" + pers.e_mail + "',telpers='" + pers.telfixe + "',mobilepers='" + pers.telportable + "',faxpers='" + pers.fax + "',adrpers='" + pers.adresse.Replace("'", "''") + "',cppers='" + pers.cp + "',villepers='" + pers.ville + "',bppers='" + pers.bp + "',imagepers='" + pers.adrImage + "',notepers='" + pers.note.Replace("'", "''") + "',cvpers='" + pers.adrDocCV + "',sitepers='" + pers.site + "',activitepers='" + pers.activite + "' where idpers=" + pers.idPers; OleDbCommand cmdacc = new OleDbCommand(mod, BDGestionAccess2013.connexion_access); int res = cmdacc.ExecuteNonQuery(); // ------------------------------------------------------------- } catch (Exception ex) { MessageBox.Show(ex.Message + " " + ex.StackTrace); } }
private void MBoyMain_Init() { this.DateCourante = DateTime.Today; this.statusBar1.Text = ""; try { if (this.SuperUser != null) { string ut = "UTILISATEUR : "; if (this.SuperUser.droitsuser == 1) { ut = "ADMINISTRATEUR : "; } PersonneClass p = BDGestionAccess2013.GET_PERSONNEBY(this.SuperUser.persUserId); if (p != null) { this.statusBar1.Text = ut + p.prenom + " " + p.nom; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (this.listBox1.SelectedIndex != -1) { this.CreerButt.Text = "MODIFIER"; this.modeModif = true; PersonneClass person = this.tabpers[this.listBox1.SelectedIndex]; this.personneAmodifier = person; this.afficheDansFormulaire(person); this.miseAjourGroupes(); } }
private void CreerForm_Load(object sender, EventArgs e) { try { string app = Application.StartupPath; app = app + @"\images\MBoy.ico"; this.Icon = new Icon(app); this.ChargerLesTitres(); this.ChargerLesUsers(); this.HeureBox.Text = DateTime.Now.ToShortTimeString(); this.heureBox2.Text = DateTime.Now.AddHours(1).ToShortTimeString(); if (this.ModeModif) { int o = BDGestionAccess2013.COUNT("users", "select count(*) from users"); this.dateTimePicker1.Value = DateTime.Parse(this.TacheCouranteAmodifier.Datdeb); this.dateTimePicker2.Value = DateTime.Parse(this.TacheCouranteAmodifier.Datfin); this.checkBox1.Checked = this.TacheCouranteAmodifier.Archive; if (o > 0) { PersonneClass pepe = BDGestionAccess2013.GET_PERSONNEBY(this.TacheCouranteAmodifier.DestinatId); if (pepe != null) { this.destCombo.SelectedItem = pepe.prenom + " " + pepe.nom; } } } else { if (this.SuperUser != null) { PersonneClass meme = BDGestionAccess2013.GET_PERSONNEBY(this.SuperUser.persUserId); if (meme != null) { this.destCombo.SelectedItem = meme.prenom + " " + meme.nom; } } } } catch (Exception ex) { MessageBox.Show("erreur pepe " + "\r\n" + ex.Message); } }
/// <summary> /// /// </summary> /// <param name="P"></param> /// <param name="droits"></param> /// <param name="prefs">0:uilisateur |1:administrateur</param> public static void CREA_USER(PersonneClass P, int droits, int prefs, string login, string password) { try { string ins = "Insert into users (persuserid,droitsuser,prefsuser,loginuser,passworduser) values (" + P.idPers + "," + droits + "," + prefs + ",'" + login + "','" + MD5CLASS.getMd5Hash(password) + "')"; OleDbCommand cmdacc = new OleDbCommand(ins, BDGestionAccess2013.connexion_access); int res = cmdacc.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.Message + " " + ex.StackTrace); } }
public static List <PersonneClass> REQUETEUR_PERSONNES(string requete) { List <PersonneClass> Lt = new List <PersonneClass>(); try { OleDbCommand cmdaccess = new OleDbCommand(requete, BDGestionAccess2013.connexion_access); OleDbDataReader lecteur = cmdaccess.ExecuteReader(); while (lecteur.Read()) { PersonneClass t = new PersonneClass(lecteur.GetInt32(0), lecteur.GetString(1), lecteur.GetString(2), lecteur.GetString(3), lecteur.GetString(4), lecteur.GetString(5), lecteur.GetString(6), lecteur.GetString(7), lecteur.GetString(8), lecteur.GetString(9), lecteur.GetString(10), lecteur.GetString(11), lecteur.GetString(12), lecteur.GetString(13), lecteur.GetString(14), lecteur.GetString(15), lecteur.GetString(16), lecteur.GetString(17)); Lt.Add(t); } lecteur.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.InnerException); } return(Lt); }
public static PersonneClass GET_PERSONNEBY(int id) { PersonneClass per = null; string requete = "select * from personnes where idpers=" + id; try { OleDbCommand cmdaccess = new OleDbCommand(requete, BDGestionAccess2013.connexion_access); OleDbDataReader lecteur = cmdaccess.ExecuteReader(); while (lecteur.Read()) { per = new PersonneClass(lecteur.GetInt32(0), lecteur.GetString(1), lecteur.GetString(2), lecteur.GetString(3), lecteur.GetString(4), lecteur.GetString(5), lecteur.GetString(6), lecteur.GetString(7), lecteur.GetString(8), lecteur.GetString(9), lecteur.GetString(10), lecteur.GetString(11), lecteur.GetString(12), lecteur.GetString(13), lecteur.GetString(14), lecteur.GetString(15), lecteur.GetString(16), lecteur.GetString(17)); } lecteur.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.InnerException); } return(per); }
public static void SUPPRIME_PERSONNE(PersonneClass pers) { try { // ------------- modif d'une tache string mod = "delete from personnes where idpers=" + pers.idPers; OleDbCommand cmdacc = new OleDbCommand(mod, BDGestionAccess2013.connexion_access); int res = cmdacc.ExecuteNonQuery(); // ------------------------------------------------------------- } catch (Exception ex) { MessageBox.Show(ex.Message + " " + ex.StackTrace); } }
private void afficheDansFormulaire(PersonneClass person) { this.comboBox1.SelectedItem = person.civilite; this.textBoxpn.Text = person.prenom; this.textBoxNom.Text = person.nom; this.textBoxEmail.Text = person.e_mail; this.textBoxTelfixe.Text = person.telfixe; this.textBoxTelMob.Text = person.telportable; this.textBoxFax.Text = person.fax; this.textBoxAdr.Text = person.adresse; this.textBoxCP.Text = person.cp; this.textBoxVille.Text = person.ville; this.textBoxBP.Text = person.bp; this.textBoxImage.Text = person.adrImage; this.textBoxNote.Text = person.note; this.textBoxCV.Text = person.adrDocCV; this.textBoxSite.Text = person.site; this.textBoxActivite.Text = person.activite; this.dateTimePicker1.Value = DateTime.Parse(person.dateNaissance); if (person.adrImage != "") { if (File.Exists(person.adrImage)) { Image img = Image.FromFile(person.adrImage); Bitmap bm = new Bitmap(img, new Size(184, 192)); this.pictureBox1.Image = (Image)bm; } } else { this.pictureBox1.Image = null; } }
private void destCombo_SelectedIndexChanged(object sender, EventArgs e) { try { if (this.destCombo.SelectedIndex != -1) { PersonneClass p = this.tp[this.destCombo.SelectedIndex]; if (this.ModeModif) { this.TacheCouranteAmodifier.DestinatId = p.idPers; this.TacheCouranteAmodifier.AuteurId = this.SuperUser.persUserId; } else { this.destinataireDeLaTache = p.idPers; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void InitialiserLesChamps() { this.comboBox1.Text = ""; this.textBoxpn.Text = ""; this.textBoxNom.Text = ""; this.textBoxEmail.Text = ""; this.textBoxTelfixe.Text = ""; this.textBoxTelMob.Text = ""; this.textBoxFax.Text = ""; this.textBoxAdr.Text = ""; this.textBoxCP.Text = ""; this.textBoxVille.Text = ""; this.textBoxBP.Text = ""; this.textBoxImage.Text = ""; this.textBoxNote.Text = ""; this.textBoxCV.Text = ""; this.textBoxSite.Text = ""; this.textBoxActivite.Text = ""; this.personneAmodifier = null; this.CreerButt.Text = "Créer"; this.pictureBox1.Image = null; this.modeModif = false; this.listBox1.SelectedIndex = -1; }
public static void CREA_PERSONNE(PersonneClass P) { try { // ------------- creation d'une tache string ins = "Insert into personnes (civpers,prenompers,nompers,datenaisspers,mailpers,telpers,mobilepers,faxpers,adrpers,cppers,villepers,bppers,imagepers,notepers,cvpers,sitepers,activitepers) values ('" + P.civilite + "','" + P.prenom + "','" + P.nom.Replace("'", "''") + "','" + P.dateNaissance + "','" + P.e_mail + "','" + P.telfixe + "','" + P.telportable + "','" + P.fax + "','" + P.adresse.Replace("'", "''") + "','" + P.cp + "','" + P.ville.Replace("'", "''") + "','" + P.bp + "','" + P.adrImage + "','" + P.note.Replace("'", "''") + "','" + P.adrDocCV + "','" + P.site + "','" + P.activite + "')"; OleDbCommand cmdacc = new OleDbCommand(ins, BDGestionAccess2013.connexion_access); int res = cmdacc.ExecuteNonQuery(); // ------------------------------------------------------------- } catch (Exception ex) { MessageBox.Show(ex.Message + " " + ex.StackTrace); } }
private void InitialiserLesChamps() { this.comboBox1.Text = ""; this.textBoxpn.Text = ""; this.textBoxNom.Text = ""; this.textBoxEmail.Text = ""; this.textBoxTelfixe.Text = ""; this.textBoxTelMob.Text = ""; this.textBoxFax.Text = ""; this.textBoxAdr.Text = ""; this.textBoxCP.Text = ""; this.textBoxVille.Text = ""; this.textBoxBP.Text = ""; this.textBoxImage.Text = ""; this.textBoxNote.Text = ""; this.textBoxCV.Text = ""; this.textBoxSite.Text = ""; this.textBoxActivite.Text = ""; this.personneAmodifier = null; this.CreerButt.Text = "Créer"; this.pictureBox1.Image = null; this.modeModif = false; this.listBox1.SelectedIndex = - 1; }
private void CreerButt_Click(object sender, EventArgs e) { PersonneClass p=null; if ((this.textBoxNom.Text != "") && (this.textBoxNom.Text != "")) { if (!modeModif) { // A BETONNER p = new PersonneClass(); p.civilite = this.comboBox1.Text; p.prenom = this.textBoxpn.Text; p.nom = this.textBoxNom.Text; p.dateNaissance = this.dateTimePicker1.Value.ToShortDateString(); p.e_mail = this.textBoxEmail.Text; p.telfixe = this.textBoxTelfixe.Text; p.telportable = this.textBoxTelMob.Text; p.fax = this.textBoxFax.Text; p.adresse = this.textBoxAdr.Text; p.cp = this.textBoxCP.Text; p.ville = this.textBoxVille.Text; p.bp = this.textBoxBP.Text; p.adrImage = this.textBoxImage.Text; p.note = this.textBoxNote.Text; p.adrDocCV = this.textBoxCV.Text; p.site = this.textBoxSite.Text; p.activite = this.textBoxActivite.Text; BDGestionAccess2013.CREA_PERSONNE(p); this.InfoLab.Text = "La personne a été créée"; } else { p = this.personneAmodifier; p.civilite = this.comboBox1.Text; p.prenom = this.textBoxpn.Text; p.nom = this.textBoxNom.Text; p.dateNaissance = this.dateTimePicker1.Value.ToShortDateString(); p.e_mail = this.textBoxEmail.Text; p.telfixe = this.textBoxTelfixe.Text; p.telportable = this.textBoxTelMob.Text; p.fax = this.textBoxFax.Text; p.adresse = this.textBoxAdr.Text; p.cp = this.textBoxCP.Text; p.ville = this.textBoxVille.Text; p.bp = this.textBoxBP.Text; p.adrImage = this.textBoxImage.Text; p.note = this.textBoxNote.Text; p.adrDocCV = this.textBoxCV.Text; p.site = this.textBoxSite.Text; p.activite = this.textBoxActivite.Text; BDGestionAccess2013.MODIFIE_PERSONNE(p); this.InfoLab.Text = "La personne a été modifiée"; } } else { this.InfoLab.Text = "Commencez à créer votre contact sur l'onglet [joindre rapidement]"; } foreach (string o in this.listBoxGRP_2.Items) { int idg = BDGestionAccess2013.GROUPES_GETIDBYLIB(o); int idp = BDGestionAccess2013.PERSONNES_GETIDBYPERS(p); BDGestionAccess2013.CREA_GRPPERS(idg, idp); } this.RechargerContacts(); }
public static void MODIFIE_PERSONNE(PersonneClass pers) { try { // ------------- modif d'une tache string mod = "Update personnes set civpers='" + pers.civilite + "',prenompers='" + pers.prenom.Replace("'", "''")+ "',nompers ='" + pers.nom.Replace("'", "''") + "',datenaisspers='" + pers.dateNaissance + "',mailpers='" + pers.e_mail + "',telpers='"+pers.telfixe+ "',mobilepers='"+pers.telportable+"',faxpers='"+pers.fax+ "',adrpers='" + pers.adresse.Replace("'", "''") + "',cppers='" + pers.cp + "',villepers='" + pers.ville + "',bppers='" + pers.bp + "',imagepers='" + pers.adrImage + "',notepers='" + pers.note.Replace("'", "''") + "',cvpers='" + pers.adrDocCV + "',sitepers='"+pers.site+"',activitepers='"+pers.activite+"' where idpers="+pers.idPers; OleDbCommand cmdacc = new OleDbCommand(mod, BDGestionAccess2013.connexion_access); int res = cmdacc.ExecuteNonQuery(); // ------------------------------------------------------------- } catch (Exception ex) { MessageBox.Show(ex.Message + " " + ex.StackTrace); } }
public static int PERSONNES_GETIDBYPERS(PersonneClass p) { int id=-1; string requete = "select idpers from personnes where prenompers = '" + p.prenom + "' and nompers= '"+p.nom+"' and mailpers ='"+p.e_mail+"'"; try { OleDbCommand cmdaccess = new OleDbCommand(requete, BDGestionAccess2013.connexion_access); OleDbDataReader lecteur = cmdaccess.ExecuteReader(); while (lecteur.Read()) { id = lecteur.GetInt32(0); } lecteur.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.InnerException); } return id; }
public static List<PersonneClass> REQUETEUR_PERSONNES(string requete) { List<PersonneClass> Lt = new List<PersonneClass>(); try { OleDbCommand cmdaccess = new OleDbCommand(requete, BDGestionAccess2013.connexion_access); OleDbDataReader lecteur = cmdaccess.ExecuteReader(); while (lecteur.Read()) { PersonneClass t = new PersonneClass(lecteur.GetInt32(0), lecteur.GetString(1), lecteur.GetString(2), lecteur.GetString(3), lecteur.GetString(4), lecteur.GetString(5), lecteur.GetString(6), lecteur.GetString(7), lecteur.GetString(8), lecteur.GetString(9), lecteur.GetString(10), lecteur.GetString(11), lecteur.GetString(12), lecteur.GetString(13), lecteur.GetString(14), lecteur.GetString(15), lecteur.GetString(16), lecteur.GetString(17)); Lt.Add(t); } lecteur.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.InnerException); } return Lt; }
public static PersonneClass GET_PERSONNEBY(int id) { PersonneClass per = null; string requete = "select * from personnes where idpers=" + id; try { OleDbCommand cmdaccess = new OleDbCommand(requete, BDGestionAccess2013.connexion_access); OleDbDataReader lecteur = cmdaccess.ExecuteReader(); while (lecteur.Read()) { per = new PersonneClass(lecteur.GetInt32(0), lecteur.GetString(1), lecteur.GetString(2), lecteur.GetString(3), lecteur.GetString(4), lecteur.GetString(5), lecteur.GetString(6), lecteur.GetString(7), lecteur.GetString(8), lecteur.GetString(9), lecteur.GetString(10), lecteur.GetString(11), lecteur.GetString(12), lecteur.GetString(13), lecteur.GetString(14), lecteur.GetString(15), lecteur.GetString(16), lecteur.GetString(17)); } lecteur.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.Source); } return per; }
public static void CREA_PERSONNE(PersonneClass P) { try { // ------------- creation d'une tache string ins = "Insert into personnes (civpers,prenompers,nompers,datenaisspers,mailpers,telpers,mobilepers,faxpers,adrpers,cppers,villepers,bppers,imagepers,notepers,cvpers,sitepers,activitepers) values ('" + P.civilite + "','" + P.prenom + "','" + P.nom.Replace("'", "''") + "','" + P.dateNaissance + "','" + P.e_mail + "','" + P.telfixe + "','" + P.telportable + "','" + P.fax + "','" + P.adresse.Replace("'", "''") + "','" + P.cp +"','"+ P.ville.Replace("'", "''") + "','" + P.bp + "','" + P.adrImage + "','" + P.note.Replace("'", "''") + "','" + P.adrDocCV + "','" + P.site + "','" + P.activite + "')"; OleDbCommand cmdacc = new OleDbCommand(ins, BDGestionAccess2013.connexion_access); int res = cmdacc.ExecuteNonQuery(); // ------------------------------------------------------------- } catch (Exception ex) { MessageBox.Show(ex.Message + " " + ex.StackTrace); } }
/// <summary> /// /// </summary> /// <param name="P"></param> /// <param name="droits"></param> /// <param name="prefs">0:uilisateur |1:administrateur</param> public static void CREA_USER(PersonneClass P,int droits,int prefs,string login,string password) { try { string ins = "Insert into users (persuserid,droitsuser,prefsuser,loginuser,passworduser) values (" + P.idPers + "," + droits + "," + prefs + ",'" + login + "','" + MD5CLASS.getMd5Hash(password) + "')"; OleDbCommand cmdacc = new OleDbCommand(ins, BDGestionAccess2013.connexion_access); int res = cmdacc.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.Message + " " + ex.StackTrace); } }
private void CreerButt_Click(object sender, EventArgs e) { PersonneClass p = null; if ((this.textBoxNom.Text != "") && (this.textBoxNom.Text != "")) { if (!modeModif) { // A BETONNER p = new PersonneClass(); p.civilite = this.comboBox1.Text; p.prenom = this.textBoxpn.Text; p.nom = this.textBoxNom.Text; p.dateNaissance = this.dateTimePicker1.Value.ToShortDateString(); p.e_mail = this.textBoxEmail.Text; p.telfixe = this.textBoxTelfixe.Text; p.telportable = this.textBoxTelMob.Text; p.fax = this.textBoxFax.Text; p.adresse = this.textBoxAdr.Text; p.cp = this.textBoxCP.Text; p.ville = this.textBoxVille.Text; p.bp = this.textBoxBP.Text; p.adrImage = this.textBoxImage.Text; p.note = this.textBoxNote.Text; p.adrDocCV = this.textBoxCV.Text; p.site = this.textBoxSite.Text; p.activite = this.textBoxActivite.Text; BDGestionAccess2013.CREA_PERSONNE(p); this.InfoLab.Text = "La personne a été créée"; } else { p = this.personneAmodifier; p.civilite = this.comboBox1.Text; p.prenom = this.textBoxpn.Text; p.nom = this.textBoxNom.Text; p.dateNaissance = this.dateTimePicker1.Value.ToShortDateString(); p.e_mail = this.textBoxEmail.Text; p.telfixe = this.textBoxTelfixe.Text; p.telportable = this.textBoxTelMob.Text; p.fax = this.textBoxFax.Text; p.adresse = this.textBoxAdr.Text; p.cp = this.textBoxCP.Text; p.ville = this.textBoxVille.Text; p.bp = this.textBoxBP.Text; p.adrImage = this.textBoxImage.Text; p.note = this.textBoxNote.Text; p.adrDocCV = this.textBoxCV.Text; p.site = this.textBoxSite.Text; p.activite = this.textBoxActivite.Text; BDGestionAccess2013.MODIFIE_PERSONNE(p); this.InfoLab.Text = "La personne a été modifiée"; } } else { this.InfoLab.Text = "Commencez à créer votre contact sur l'onglet [joindre rapidement]"; } foreach (string o in this.listBoxGRP_2.Items) { int idg = BDGestionAccess2013.GROUPES_GETIDBYLIB(o); int idp = BDGestionAccess2013.PERSONNES_GETIDBYPERS(p); BDGestionAccess2013.CREA_GRPPERS(idg, idp); } this.RechargerContacts(); }