private void buttonModifier_Click(object sender, EventArgs e) { if (user == null || dataGridView1.CurrentRow == null) { return; } Template template = GestionContacts.GetTemplate(ApiContact.GetStringJSonTemplate(user)); if (template != null && ListeContacts != null) { DelegateChargerListeContact d = ChargerListeContacts; long idcontact = long.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString()); if (ListeContacts != null) { Contact c = ListeContacts.Where(x => x.getIdcontact() == idcontact).FirstOrDefault(); if (c != null) { FicheContactForm w = new FicheContactForm(template, user.getIduser(), d, c); w.ShowDialog(); } } } }
public static bool AjouterContactAPI(ContactEntity.User user, System.Collections.Specialized.IOrderedDictionary newValues) { ContactEntity.Contact c = new ContactEntity.Contact(); Template template = GestionContacts.GetTemplate(ApiContact.GetStringJSonTemplate(user)); c.setIdcontact(0); c.setIduser(template.getIduser()); c.setDtcreation(DateTime.Now); c.setFavoris(false); c.setActif(true); if (c != null) { List <ContactEntity.Donnee> donnees = SetListeDonnees(newValues); c.setIduser(user.getIduser()); c.setDtcreation(DateTime.Now); c.setFavoris(false); c.setActif(true); c.setDonnees(donnees); c.setIduser(user.getIduser()); ContactWrapper cw = new ContactWrapper(); cw.setContact(c); cw.setIdtemplate(template.getIdtemplate()); ApiContact.SetContact(cw); return(true); } return(false); }
private void buttonAjouter_Click(object sender, EventArgs e) { if (user == null) { return; } Template template = GestionContacts.GetTemplate(ApiContact.GetStringJSonTemplate(user)); if (template != null) { DelegateChargerListeContact d = ChargerListeContacts; FicheContactForm w = new FicheContactForm(template, user.getIduser(), d); w.ShowDialog(); } }
public static void SaveContactAPI(ContactEntity.User user, System.Collections.Specialized.IOrderedDictionary oldValues, System.Collections.Specialized.IOrderedDictionary newValues) { if (user == null) { return; } //charge la liste des contacts par l'API string strJson = ContactClasse.ApiContact.GetStringJSonContacts(user); List <ContactEntity.Contact> ListeContacts = ContactClasse.GestionContacts.GetContacts(strJson); List <EvalEntity.Champ> listeChamp = dao.DaoChamp.GetChamps(); int idcontact = 0; if (oldValues != null) { idcontact = Int32.Parse(oldValues["idcontact"] as string); } Template template = GestionContacts.GetTemplate(ApiContact.GetStringJSonTemplate(user)); if (template != null && ListeContacts != null) { ContactEntity.Contact c = ListeContacts.Where(x => x.getIdcontact() == idcontact).FirstOrDefault(); if (c != null) { List <ContactEntity.Donnee> donnees = SetListeDonnees(newValues); c.setIduser(user.getIduser()); c.setDtcreation(DateTime.Now); c.setFavoris(false); c.setActif(true); c.setDonnees(donnees); c.setIduser(user.getIduser()); ContactWrapper cw = new ContactWrapper(); cw.setContact(c); cw.setIdtemplate(template.getIdtemplate()); ApiContact.SetContact(cw); } } }