Exemplo n.º 1
0
        private void RechargerParticipation()
        {
            ParticipationsBLL    partBLL  = new ParticipationsBLL();
            ListeIdeesCadeauxBLL listeBLL = new ListeIdeesCadeauxBLL();

            ListeIdeesCadeaux liste      = new ListeIdeesCadeaux();
            Personne          cadeauPour = new Personne();
            Evenement         evt        = new Evenement();

            Personne participationDe = new Personne();

            participationDe.id_personne = int.Parse(Session["personneID"].ToString());

            cadeauPour.id_personne = int.Parse(listeParticipantAyantListe.SelectedItem.Value.ToString());
            evt.id_evenement       = int.Parse(ViewState["evenementId"].ToString());

            liste = listeBLL.getListeIdeesCadeaux(cadeauPour, evt);

            Participation participation = partBLL.getParticipation(liste, participationDe);

            if (participation != null)
            {
                lblValeurParticipationListe.Text = "Votre participation est de : " + participation.participation.ToString() + " €";
            }
            else
            {
                lblValeurParticipationListe.Text = "Votre participation est de : 0 €";
            }
        }
        private void RechargerParticipation()
        {
            ListeIdeesCadeauxBLL listeBLL = new ListeIdeesCadeauxBLL();

            ListeIdeesCadeaux liste      = new ListeIdeesCadeaux();
            Personne          cadeauPour = new Personne();

            liste = listeBLL.getListeIdeesCadeaux(personneListe, evenement);

            participation = participationBLL.getParticipation(liste, personneConnectee);
        }
Exemplo n.º 3
0
        protected void btnAjouterParticipation_Click(object sender, EventArgs e)
        {
            ParticipationsBLL    partBLL  = new ParticipationsBLL();
            ListeIdeesCadeauxBLL listeBLL = new ListeIdeesCadeauxBLL();

            ListeIdeesCadeaux liste      = new ListeIdeesCadeaux();
            Personne          cadeauPour = new Personne();
            Evenement         evt        = new Evenement();

            Personne participationDe = new Personne();

            participationDe.id_personne = int.Parse(Session["personneID"].ToString());

            cadeauPour.id_personne = int.Parse(listeParticipantAyantListe.SelectedItem.Value.ToString());
            evt.id_evenement       = int.Parse(ViewState["evenementId"].ToString());

            liste = listeBLL.getListeIdeesCadeaux(cadeauPour, evt);

            Participation part = new Participation();

            part.id_liste    = liste.id_listeIdeesCadeaux;
            part.id_personne = int.Parse(Session["personneID"].ToString());

            Boolean isParticipationCorrecte = true;

            try
            {
                part.participation = long.Parse(tbParticipation.Text);
            }
            catch (Exception)
            {
                isParticipationCorrecte = false;
                lbPbParticipation.Text  = "Vous devez saisir un nombre dans participation. (exemple: 20)";
                SuccessText.Text        = "";
            }

            //Si l'utilisateur a bien saisi une participation correcte, on peut modifier
            if (isParticipationCorrecte)
            {
                if (partBLL.getParticipation(liste, participationDe) == null)
                {
                    if (partBLL.ajouterParticipation(part))
                    {
                        tbParticipation.Text = "";

                        lbPbParticipation.Text = "";
                        SuccessText.Text       = "Vous avez bien ajouté votre participation à cette liste !";

                        RechargerParticipation();
                        afficherGroupeModificationParticipation(false);
                    }
                    else
                    {
                        lbPbParticipation.Text = "Erreur dans l'enregistrement de la participation. Vous devez saisir un nombre. (exemple: 20)";
                        SuccessText.Text       = "";
                    }
                }
                else
                {
                    if (partBLL.modifierParticipation(part))
                    {
                        lbPbParticipation.Text = "";
                        SuccessText.Text       = "Votre participation a été modifiée.";

                        RechargerParticipation();
                        afficherGroupeModificationParticipation(false);
                    }
                    else
                    {
                        lbPbParticipation.Text = "Erreur dans l'enregistrement de la participation. Vous devez saisir un nombre. (exemple: 20)";
                        SuccessText.Text       = "";
                    }
                }
            }
        }