protected void Page_Load(object sender, EventArgs e) { List <String> csr = CourrierService.getCourriresAvecReponses(); ref_cour_rep.Items.Clear(); ref_cour_rep.Items.AddRange(csr.Select(co => new ListItem() { Text = co, Value = co }).ToArray()); List <Dossier> d = DossierService.getRefDossiers(); ref_dos.Items.Clear(); ref_dos.Items.AddRange(d.Select(dos => new ListItem() { Text = dos.getReference(), Value = dos.getReference() }).ToArray()); List <Unite> l = UniteService.getUnites(); unit.Items.Clear(); unit.Items.Add(new ListItem() { Text = "Choisissez une unité", Value = "0" }); unit.Items.AddRange(l.Select(u => new ListItem() { Text = u.getNom(), Value = u.getId() + "" }).ToArray()); List <Contact> c = ContactService.getContacts(); expediteur.Items.Clear(); expediteur.Items.AddRange(c.Select(ex => new ListItem() { Text = ex.getNom(), Value = ex.getId() + "" }).ToArray()); unit.DataBind(); expediteur.DataBind(); ref_dos.DataBind(); ref_cour_rep.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["ref"] != null) { List <Contact> destin = ContactService.getContacts(); id_destinataire.Items.Clear(); id_destinataire.Items.AddRange(destin.Select(ex => new ListItem() { Text = ex.getNom(), Value = ex.getId() + "" }).ToArray()); List <Unite> l = UniteService.getUnites(); unit.Items.Clear(); unit.Items.Add(new ListItem() { Text = "Choisissez une unité", Value = "0" }); unit.Items.AddRange(l.Select(u => new ListItem() { Text = u.getNom(), Value = u.getId() + "" }).ToArray()); unit_copie.Items.Clear(); unit_copie.Items.AddRange(l.Select(u => new ListItem() { Text = u.getNom(), Value = u.getId() + "" }).ToArray()); CourrierArriveInterne c = CourrierService.getCourrierByRef(Request.QueryString["ref"]); cour = c; if (c != null) { ref_cour.Text = c.getReference(); reference.Text = c.getReference(); type.Text = c.getTypecr(); nature.Text = c.getNature(); datecrea.Text = c.getDate_creation().ToString().Substring(0, 10); objet.Text = c.getObjet(); agentua.Text = c.getAgentUA().getNom() + " " + c.getAgentUA().getPrenom(); uniteua.Text = c.getAgentUA().getUnite().getNom(); reponse.Text = c.getReponse() ? "Oui" : "Non"; courrier_reponse.Text = (c.getCourrier_Reponse() != null) ? c.getCourrier_Reponse().getReference() : "Pas de réponse"; ref_dos.Text = (c.getDossier() != null) ? c.getDossier().getReference() : "Sans dossier"; datecour.Text = c.getDate_Courrier().ToString().Substring(0, 10); datearr.Text = c.getDate_Arrivee().ToString().Substring(0, 10); expediteur.Text = c.getExpediteur().getNom(); if (c is Facture) { facture.Text = ""; device.Text = ((Facture)c).getDevice(); montant.Text = ((Facture)c).getMontant().ToString(); } else { facture.Text = "Non"; device.Text = " - "; montant.Text = " - "; } etat.Text = c.getEtat(); } } }