コード例 #1
0
        protected void btn_ajout_cr_dep_Click(object sender, EventArgs e)
        {
            CourrierDepart c             = new CourrierDepart();
            List <Contact> destinataires = GestionCourrier.Services.ContactService.getContacts();

            if (opt_dos.Checked)
            {
                c.setDossier(new Dossier(id_ref_dos.Value));
            }

            c.setReference(ref_cour.Text.ToString());
            c.setTypecr(type.Text.ToString());

            System.Collections.Generic.List <Contact> selectedItemsList = new System.Collections.Generic.List <Contact>();

            c.setDestinataire(new Contact(Int32.Parse(id_destinataire.Value)));
            c.setNature(nature.Text.ToString());
            c.setObjet(objetcr.Text.ToString());
            c.setTypecr(type.Text.ToString());
            c.setDate_creation(DateTime.ParseExact(datecrea.Text.ToString(), "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture));
            c.setAgentUA((AgentUA)Session["user"]);
            c.setReponse(reponse.Checked);
            //Response.Write("Destinataire :  "+c.getDestinataire().getId());

            if (CourrierService.ajouterCourrier(c))
            {
                CourrierService.repondreCourrier(id_ref_cour_rep.Value, ref_cour.Text.ToString());
                result.Text = "Le courrier a été ajouté avec succès !";
            }
            else
            {
                result.Text = "Echec d'ajout, veuillez vérifier les données entrés";
            }
        }
コード例 #2
0
        protected void btn_ajout_cr_Click(object sender, EventArgs e)
        {
            CourrierArriveInterne c;

            if (fact.Checked)
            {
                c = new Facture();
            }
            else
            {
                c = new CourrierArriveInterne();
            }

            //Response.Write(opt_dos.Checked?"Dossier : " +id_ref_dos.Value:"Pas de dossier ");
            if (opt_dos.Checked)
            {
                c.setDossier(new Dossier(id_ref_dos.Value));
            }

            //Response.Write("Réference du courrier:  " + ref_cour.Text.ToString());
            c.setReference(ref_cour.Text.ToString());

            //Response.Write("Expediteur : " + id_expediteur.Value);
            c.setExpediteur(new Contact(id_expediteur.Value));

            //Response.Write("type : " + type.Text.ToString()+" ");
            c.setTypecr(type.Text.ToString());

            //Response.Write("nature : "+nature.Text.ToString() + " ");
            c.setNature(nature.Text.ToString());

            //Response.Write("obet : " +objetcr.Text.ToString() + " ");
            c.setObjet(objetcr.Text.ToString());

            //Response.Write("date creation : " +datecrea.Text.ToString() + " ");
            c.setDate_creation(DateTime.ParseExact(datecrea.Text.ToString(), "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture));

            //Response.Write("date courrier : "+datecour.Text.ToString() + " ");
            c.setDate_Courrier(DateTime.ParseExact(datecour.Text.ToString(), "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture));

            //Response.Write("date arrivée : " +datearr.Text.ToString() + " ");
            c.setDate_Arrivee(DateTime.ParseExact(datearr.Text.ToString(), "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture));

            //Response.Write(" unité administrative : " +id_unit.Value+" ");
            //Response.Write("Agent de l'unité : " + id_agent_ua.Value.Split(new Char[] { '-' })[0] + " ");

            c.setAgentUA(new AgentUA(Int32.Parse(id_agent_ua.Value)));

            //.ToString().Split(new Char[]{'-'})[0]
            //Response.Write("Type courrier (interne/externe ) : " +typecr.SelectedValue.ToString() + " ");
            c.setType((typecr.SelectedValue.ToString().Equals("arr") ? "Arrive" : "Interne"));

            //Response.Write("Requis une réponse : " + (reponse.Checked ? "Oui" : "Non "));
            c.setReponse(reponse.Checked);

            //Response.Write("C'est une facture : " + (fact.Checked ? "Oui, device : "+device.Text.ToString()+" et montant " +montant.Text.ToString() : "Non "));
            if (fact.Checked)
            {
                ((Facture)c).setDevice(device.Text.ToString());
                ((Facture)c).setMontant(float.Parse(montant.Text.ToString().Replace(".", ",")));
            }
            c.setAgentBO((AgentBO)Session["user"]);
            //Response.Write(String.Format("Insert into courrier values('{0}','{1}','{2}','{3}','{4}','Cree',{5},{6},{7},null,null)", c.getReference(), c.getTypecr(), c.getNature(), c.getDate_creation(), c.getObjet(), c.getAgentBO().getId(), c.getAgentUA().getId(), c.getReponse() ? 1 : 0));
            //Response.Write(String.Format("Insert into courrier_arrive_interne values('{0}','{1}','{2}','{3}',(select id_contact from contacts where nom='{4}'))", c.getReference(), c.getDate_Courrier(), c.getDate_Arrivee(), c.getType(), c.getExpediteur().getNom()));
            //Response.Write(String.Format("Insert into facture values ('{0}','{1}',{2})", c.getReference(), ((Facture)c).getDevice(), ((Facture)c).getMontant() + "").Replace(",", "."));
            //Response.Write(CourrierService.ajouterCourrier(c)?"OMG courrier ajouté !":"Non gros fail !");
            if (CourrierService.ajouterCourrier(c))
            {
                CourrierService.repondreCourrier(id_ref_cour_rep.Value, ref_cour.Text.ToString());
                result.Text = "Le courrier a été ajouté avec succès !";
            }
            else
            {
                result.Text = "Echec d'ajout, veuillez vérifier les données entrés";
            }

            //Response.Write(cour_rep.Checked ? "Réponse au courrier : " + id_ref_cour_rep.Value : "Ce courrier n'est pas une réponse ");
        }