示例#1
0
        public static Boolean TestMail(String _ReceiptEmail = null)
        {
            String _EmailTest = String.Empty;

            _EmailTest += "<html>";
            _EmailTest += "<body>";
            _EmailTest += "Coucou connard !";
            _EmailTest += "</body>";
            _EmailTest += "</html>";
            return(ICSManager.SendMail(WS.Constants.INSCRIPTIONS_EMAIL, WS.Constants.INSCRIPTIONS_SENDER, _ReceiptEmail, WS.Constants.INSCRIPTIONS_CC, WS.Constants.INSCRIPTIONS_CCI, "Test", _EmailTest, true, null, null, WS.Constants.MAILSERVER_HOST, WS.Constants.MAILSERVER_PORT, WS.Constants.INSCRIPTIONS_USERNAME, WS.Constants.INSCRIPTIONS_PASSWORD, 100000, false));
        }
示例#2
0
        public static Int32 UpdCommande(Int32?_Id = null, Int32?_StatutId = null, String _StatutLibelle = null, String _ReferenceTransaction = null, String _ReferenceExterne = null, Int32?_EleveId = null, String _TrackingNumber = null)
        {
            DBModelsParameters _DB = new WS.Models.DBModelsParameters();

            //récupération de l'élève
            Eleve _Eleve = ElevesManager.GetEleves(_Id: _EleveId)[0];

            //envoi du mail de confirmation
            #region "Mail"
            String _EmailModification = String.Empty;
            _EmailModification += "<html>";
            _EmailModification += "<body>";
            _EmailModification += "<img src=\"http://www.cavalier-roi.fr/Content/Images/LogoMail.jpg\" />";
            _EmailModification += "<br /><hr /><br />";
            _EmailModification += "Votre commande #" + _Id.ToString() + " vient de passer au statut : " + _StatutLibelle;
            if ((_StatutId == 6) && (!String.IsNullOrEmpty(_TrackingNumber)))
            {
                _EmailModification += "<br /><br />";
                _EmailModification += "Le numéro de suivi du colis est : " + _TrackingNumber;
            }
            _EmailModification += "<br /><br />";
            _EmailModification += "Vous pouvez retrouver toutes vos commandes dans la partie \"Mon Compte\" du site de l'École du Cavalier Roi : <a href=\"" + WS.Constants.SITE_URL + "/MonCompte\" target=\"_blank\">" + WS.Constants.SITE_URL + "/MonCompte</a>.";
            _EmailModification += "<br /><br />";
            _EmailModification += "Pour plus d'informations, n'hésitez pas à contacter l'École du Cavalier Roi à <a href=\"mailto:" + WS.Constants.COMMANDES_EMAIL + "\" target=\"_blank\">" + WS.Constants.COMMANDES_EMAIL + "</a>.";
            _EmailModification += "<br /><br />";
            _EmailModification += "L'École du Cavalier Roi";
            _EmailModification += "<br /><br />";
            _EmailModification += "</body>";
            _EmailModification += "</html>";
            ICSManager.SendMail(WS.Constants.COMMANDES_EMAIL, WS.Constants.COMMANDES_SENDER, _Eleve.Email, WS.Constants.COMMANDES_CC, WS.Constants.COMMANDES_CCI, "Modification de statut de commande", _EmailModification, true, null, null, WS.Constants.MAILSERVER_HOST, WS.Constants.MAILSERVER_PORT, WS.Constants.COMMANDES_USERNAME, WS.Constants.COMMANDES_PASSWORD, 100000, false);
            #endregion

            return(_DB.UpdCommande(
                       id: (_Id == null ? -1 : _Id),
                       statutId: (_StatutId == null ? -1 : _StatutId),
                       referenceTransaction: (String.IsNullOrEmpty(_ReferenceTransaction) ? null : _ReferenceTransaction.Trim()),
                       referenceExterne: (String.IsNullOrEmpty(_ReferenceExterne) ? null : _ReferenceExterne.Trim()),
                       trackingNumber: (String.IsNullOrEmpty(_TrackingNumber) ? null : _TrackingNumber.Trim())
                       ));
        }
示例#3
0
        public static Int32?ReinitEleve(String _Email = null, String _Password = null)
        {
            DBModelsParameters _DB = new WS.Models.DBModelsParameters();

            if (String.IsNullOrEmpty(_Password))
            {
                _Password = Tools.RandomString(8, true);
            }

            //envoi du mail de reinitialisation
            #region "Mail"
            String _EmailReinitialisation = String.Empty;
            _EmailReinitialisation += "<html>";
            _EmailReinitialisation += "<body>";
            _EmailReinitialisation += "<img src=\"http://www.cavalier-roi.fr/Content/Images/LogoMail.jpg\" />";
            _EmailReinitialisation += "<br /><hr /><br />";
            _EmailReinitialisation += "Votre mot de passe a bien été réinitialisé !";
            _EmailReinitialisation += "<br /><br />";
            _EmailReinitialisation += "<u>Email/Identifiant</u> : " + _Email;
            _EmailReinitialisation += "<br />";
            _EmailReinitialisation += "<u>Nouveau mot de passe</u> : " + _Password;
            _EmailReinitialisation += "<br /><br />";
            _EmailReinitialisation += "Pensez à bien le changer à votre prochaine connexion dans la partie \"Mon Compte\" du site de l'École du Cavalier Roi : <a href=\"" + WS.Constants.SITE_URL + "/MonCompte\" target=\"_blank\">" + WS.Constants.SITE_URL + "/MonCompte</a>.";
            _EmailReinitialisation += "<br /><br />";
            _EmailReinitialisation += "Pour plus d'informations, n'hésitez pas à contacter l'École du Cavalier Roi à <a href=\"mailto:" + WS.Constants.INSCRIPTIONS_EMAIL + "\" target=\"_blank\">" + WS.Constants.INSCRIPTIONS_EMAIL + "</a>.";
            _EmailReinitialisation += "<br /><br />";
            _EmailReinitialisation += "L'École du Cavalier Roi";
            _EmailReinitialisation += "<br /><br />";
            _EmailReinitialisation += "</body>";
            _EmailReinitialisation += "</html>";
            ICSManager.SendMail(WS.Constants.INSCRIPTIONS_EMAIL, WS.Constants.INSCRIPTIONS_SENDER, _Email, WS.Constants.INSCRIPTIONS_CC, WS.Constants.INSCRIPTIONS_CCI, "Réinitialisation de mot de passe", _EmailReinitialisation, true, null, null, WS.Constants.MAILSERVER_HOST, WS.Constants.MAILSERVER_PORT, WS.Constants.INSCRIPTIONS_USERNAME, WS.Constants.INSCRIPTIONS_PASSWORD, 100000, false);
            #endregion

            return(_DB.ReinitEleve(
                       email: _Email.Trim(),
                       password: _Password.Trim().ToEncryptedTripleDES(Constants.PASSPHRASE).ToEncodedURL()
                       ));
        }
示例#4
0
        public static Int32?AddCommande(DateTime?_DtCreation = null, DateTime?_DtValidation = null, Int32?_StatutId = null, Int32?_EleveId = null, Double?_Prix = null, Int32?_FraiId = null, String _ReferenceTransaction = null, String _ReferenceExterne = null, Adresse _Adresse = null, List <Ligne> _Lignes = null)
        {
            DBModelsParameters _DB = new WS.Models.DBModelsParameters();

            //récupération de l'élève
            Eleve _Eleve = ElevesManager.GetEleves(_Id: _EleveId)[0];

            //ajout de l'adresse
            Int32?_NewAdresseId = _DB.AddAdresse(
                destinataire: _Adresse.Destinataire.Trim(),
                ligne1: _Adresse.Ligne1.Trim(),
                ligne2: (String.IsNullOrEmpty(_Adresse.Ligne2) ? null : _Adresse.Ligne2.Trim()),
                codePostal: _Adresse.CodePostal.Trim(),
                ville: _Adresse.Ville.Trim(),
                pays: _Adresse.Pays.Trim(),
                telephone: _Adresse.Telephone.Trim(),
                email: _Adresse.Email.Trim()
                ).FirstOrDefault().Value;

            //ajout de la commande
            Int32?_NewCommandeId = _DB.AddCommande(
                dtCreation: _DtCreation,
                dtValidation: _DtValidation,
                statutId: (_StatutId == null ? -1 : _StatutId),
                eleveId: (_EleveId == null ? -1 : _EleveId),
                prix: (_Prix == null ? -1 : _Prix),
                fraiId: (_FraiId == null ? -1 : _EleveId),
                referenceTransaction: (String.IsNullOrEmpty(_ReferenceTransaction) ? null : _ReferenceTransaction),
                referenceExterne: (String.IsNullOrEmpty(_ReferenceExterne) ? null : _ReferenceExterne.Trim()),
                adresseId: (_NewAdresseId == null ? -1 : _NewAdresseId)
                ).FirstOrDefault().Value;

            //ajout des lignes
            foreach (Ligne _Current in _Lignes)
            {
                Int32?_NewLigneId = _DB.AddLigne(
                    produitId: _Current.Produit.Id,
                    commandeId: _NewCommandeId,
                    quantite: _Current.Quantite,
                    statutId: _StatutId,
                    prix: _Current.Prix,
                    reduction: _Current.Reduction
                    ).FirstOrDefault().Value;
            }

            //envoi du mail de confirmation
            #region "Mail"
            String _EmailConfirmation = String.Empty;
            _EmailConfirmation += "<html>";
            _EmailConfirmation += "<body>";
            _EmailConfirmation += "<img src=\"http://www.cavalier-roi.fr/Content/Images/LogoMail.jpg\" />";
            _EmailConfirmation += "<br /><hr /><br />";
            if (_StatutId == 3)
            {
                _EmailConfirmation += "Votre commande #" + _NewCommandeId.ToString() + " a bien été prise en compte et votre paiement " + _ReferenceTransaction + " a bien été effectué !";
            }
            else if (_StatutId == 2)
            {
                _EmailConfirmation += "Votre commande #" + _NewCommandeId.ToString() + " a bien été prise en compte !";
            }
            _EmailConfirmation += "<br /><br />";
            _EmailConfirmation += "<table cellpadding=\"2\" cellspacing=\"2\" border=\"1\">";
            _EmailConfirmation += "<tr>";
            _EmailConfirmation += "     <th>Numéro de produit</th>";
            _EmailConfirmation += "     <th>Libellé de produit</th>";
            _EmailConfirmation += "     <th>Quantité</th>";
            foreach (Ligne _Current in _Lignes)
            {
                _EmailConfirmation += "<tr>";
                _EmailConfirmation += "     <td>" + (!String.IsNullOrEmpty(_Current.Produit.Reference) ? _Current.Produit.Reference : _Current.Produit.Id.ToString()) + "</td>";
                _EmailConfirmation += "     <td>" + _Current.Produit.Libelle + "</td>";
                _EmailConfirmation += "     <td>" + _Current.Quantite + "</td>";
                _EmailConfirmation += "</tr>";
            }
            _EmailConfirmation += "</table>";
            _EmailConfirmation += "<br /><br />";
            _EmailConfirmation += "Vous pouvez retrouver toutes vos commandes dans la partie \"Mon Compte\" du site de l'École du Cavalier Roi : <a href=\"" + WS.Constants.SITE_URL + "/MonCompte\" target=\"_blank\">" + WS.Constants.SITE_URL + "/MonCompte</a>.";
            _EmailConfirmation += "<br /><br />";
            if (_StatutId == 3)
            {
                _EmailConfirmation += "Merci de contacter au plus vite l'École du Cavalier Roi à <a href=\"mailto:" + WS.Constants.COMMANDES_EMAIL + "\" target=\"_blank\">" + WS.Constants.COMMANDES_EMAIL + "</a> pour régler le paiement.";
            }
            else if (_StatutId == 2)
            {
                _EmailConfirmation += "Vous recevrez votre facture directement par mail ou en la demandant à <a href=\"mailto:" + WS.Constants.COMMANDES_EMAIL + "\" target=\"_blank\">" + WS.Constants.COMMANDES_EMAIL + "</a>";
                _EmailConfirmation += "<br /><br />";
                _EmailConfirmation += "Pour plus d'informations, n'hésitez pas à contacter l'École du Cavalier Roi à <a href=\"mailto:" + WS.Constants.COMMANDES_EMAIL + "\" target=\"_blank\">" + WS.Constants.COMMANDES_EMAIL + "</a>.";
            }
            _EmailConfirmation += "<br /><br />";
            _EmailConfirmation += "L'École du Cavalier Roi";
            _EmailConfirmation += "<br /><br />";
            _EmailConfirmation += "</body>";
            _EmailConfirmation += "</html>";
            ICSManager.SendMail(WS.Constants.COMMANDES_EMAIL, WS.Constants.COMMANDES_SENDER, _Eleve.Email, WS.Constants.COMMANDES_CC, WS.Constants.COMMANDES_CCI, "Confirmation de commande", _EmailConfirmation, true, null, null, WS.Constants.MAILSERVER_HOST, WS.Constants.MAILSERVER_PORT, WS.Constants.COMMANDES_USERNAME, WS.Constants.COMMANDES_PASSWORD, 100000, false);
            #endregion

            return(_NewCommandeId);
        }
示例#5
0
        public static Int32?AddReservations(List <Reservation> _Reservations)
        {
            Int32?_ReturnValue = null;

            if ((_Reservations != null) && (_Reservations.Count > 0))
            {
                //récupération de l'évènement
                Evenement _Evenement = EvenementsManager.GetEvenements(_Id: _Reservations[0].Evenement.Id)[0];

                //récupération de l'élève
                Eleve _Eleve = ElevesManager.GetEleves(_Id: _Reservations[0].Eleve.Id)[0];

                //insertion des réservations en base
                List <ICalendar> _Invitations = new List <ICalendar>();
                foreach (Reservation _Current in _Reservations)
                {
                    _ReturnValue = ElevesManager.AddReservation(
                        _EleveId: _Current.Eleve.Id,
                        _EvenementId: _Current.Evenement.Id,
                        _Jour: _Current.Jour,
                        _Creneau: _Current.Creneau,
                        _PaymentId: (String.IsNullOrEmpty(_Current.PaymentId) ? null : _Current.PaymentId)
                        );
                }

                //envoi du mail de confirmation
                #region "Mail"
                String _EmailReservation = String.Empty;
                _EmailReservation += "<html>";
                _EmailReservation += "<body>";
                _EmailReservation += "<img src=\"http://www.cavalier-roi.fr/Content/Images/LogoMail.jpg\" />";
                _EmailReservation += "<br /><hr /><br />";

                if (_Evenement.Typologie.Id == 3) //cours
                {
                    if (String.IsNullOrEmpty(_Reservations[0].PaymentId))
                    {
                        _EmailReservation += "Votre inscription à cette formule de cours a bien été prise en compte et vos réservations ont bien été enregistrées !";
                    }
                    else if (_Reservations[0].PaymentId == "KO")
                    {
                        _EmailReservation += "Votre inscription à cette formule de cours a bien été prise en compte, vos réservations ont bien été enregistrées mais votre paiement a rencontré un problème !";
                    }
                    else if (_Reservations[0].PaymentId == "MON COMPTE")
                    {
                        _EmailReservation += "Vos réservations ont bien été enregistrées !";
                    }
                    else
                    {
                        _EmailReservation += "Votre inscription à cette formule de cours a bien été prise en compte, vos réservations ont bien été enregistrées et votre paiement a bien été effectué !";
                    }
                }
                else if (_Evenement.Typologie.Id == 1) //tournois
                {
                    if (String.IsNullOrEmpty(_Reservations[0].PaymentId))
                    {
                        _EmailReservation += "Votre participation à cet évènement a bien été prise en compte !";
                    }
                    else if (_Reservations[0].PaymentId == "KO")
                    {
                        _EmailReservation += "Votre participation à cet évènement a bien été prise en compte mais votre paiement a rencontré un problème !";
                    }
                    else
                    {
                        _EmailReservation += "Votre participation à cet évènement a bien été prise en compte et votre paiement a bien été effectué !";
                    }
                }
                else if (_Evenement.Typologie.Id == 0)                                                      //stages
                {
                    if ((_Evenement.Prix == null) || ((_Evenement.Prix != null) && (_Evenement.Prix == 0))) //stage gratuit : formule complete
                    {
                        if (_Evenement.EvenementParent == null)                                             //stage "parent" : formule complete
                        {
                            _EmailReservation += "Votre inscription à cette formule de stage gratuite a bien été prise en compte !";
                        }
                        else //stage "enfant" : formule partielle (avec choix de réservations)
                        {
                            _EmailReservation += "Votre inscription à cette formule de stage gratuite a bien été prise en compte et vos réservations ont bien été enregistrées !";
                        }
                    }
                    else
                    {
                        if (_Evenement.EvenementParent == null) //stage "parent" : formule complete
                        {
                            if (String.IsNullOrEmpty(_Reservations[0].PaymentId))
                            {
                                _EmailReservation += "Votre inscription à cette formule de stage a bien été prise en compte !";
                            }
                            else if (_Reservations[0].PaymentId == "KO")
                            {
                                _EmailReservation += "Votre inscription à cette formule de stage a bien été prise en compte mais votre paiement a rencontré un problème !";
                            }
                            else
                            {
                                _EmailReservation += "Votre inscription à cette formule de stage a bien été prise en compte et votre paiement a bien été effectué !";
                            }
                        }
                        else //stage "enfant" : formule partielle (avec choix de réservations)
                        {
                            if (String.IsNullOrEmpty(_Reservations[0].PaymentId))
                            {
                                _EmailReservation += "Votre inscription à cette formule de stage a bien été prise en compte et vos réservations ont bien été enregistrées !";
                            }
                            else if (_Reservations[0].PaymentId == "KO")
                            {
                                _EmailReservation += "Votre inscription à cette formule de stage a bien été prise en compte, vos réservations ont bien été enregistrées mais votre paiement a rencontré un problème !";
                            }
                            else
                            {
                                _EmailReservation += "Votre inscription à cette formule de stage a bien été prise en compte, vos réservations ont bien été enregistrées et votre paiement a bien été effectué !";
                            }
                        }
                    }
                }
                _EmailReservation += "<br /><br />";
                _EmailReservation += _Evenement.Libelle;
                _EmailReservation += "<br />";
                _EmailReservation += "<table cellpadding=\"2\" cellspacing=\"2\" border=\"1\">";
                _EmailReservation += "<tr>";
                _EmailReservation += "     <th>Jour</th>";
                _EmailReservation += "     <th>Heure de début</th>";
                _EmailReservation += "     <th>Heure de fin</th>";

                if (_Evenement.Typologie.Id == 3) //cours
                {
                    foreach (Reservation _Current in _Reservations)
                    {
                        String _HeureDebut = _Current.Creneau.Replace("Creneau", "").Left(2) + ":00:00";
                        String _HeureFin   = _Current.Creneau.Replace("Creneau", "").Right(2) + ":00:00";

                        //création du ICS à envoyer
                        ICalendar _NewICalendar = new ICalendar
                        {
                            EventStartDateTime = Convert.ToDateTime(_Current.Jour + " " + _HeureDebut),
                            EventEndDateTime   = Convert.ToDateTime(_Current.Jour + " " + _HeureFin),
                            UID              = Guid.NewGuid().ToString(),
                            EventOrganizer   = WS.Constants.COMMANDES_SENDER,
                            EventPriority    = "0",
                            EventSummary     = _Evenement.Libelle,
                            EventDescription = _Evenement.Descriptif
                        };
                        _Invitations.Add(_NewICalendar);

                        //création de la ligne du tableau
                        _EmailReservation += "<tr>";
                        _EmailReservation += "     <td>" + _Current.Jour + "</td>";
                        _EmailReservation += "     <td>" + _HeureDebut + "</td>";
                        _EmailReservation += "     <td>" + _HeureFin + "</td>";
                        _EmailReservation += "</tr>";
                    }
                }
                else if (_Evenement.Typologie.Id == 1) //tournois
                {
                    String _Jour = String.Empty;
                    foreach (Reservation _Current in _Reservations)
                    {
                        if (_Jour != _Current.Jour)
                        {
                            _Jour = _Current.Jour;
                            String _HeureDebut = (_Reservations.FindAll(p => p.Jour == _Jour).OrderBy(p => p.Creneau).FirstOrDefault().Creneau.Replace("Creneau", "").Left(2) + ":00:00");
                            String _HeureFin   = (_Reservations.FindAll(p => p.Jour == _Jour).OrderByDescending(p => p.Creneau).FirstOrDefault().Creneau.Replace("Creneau", "").Right(2) + ":00:00");

                            //création du ICS à envoyer
                            ICalendar _NewICalendar = new ICalendar
                            {
                                EventStartDateTime = Convert.ToDateTime(_Current.Jour + " " + _HeureDebut),
                                EventEndDateTime   = Convert.ToDateTime(_Current.Jour + " " + _HeureFin),
                                UID              = Guid.NewGuid().ToString(),
                                EventOrganizer   = WS.Constants.COMMANDES_SENDER,
                                EventPriority    = "0",
                                EventSummary     = _Evenement.Libelle,
                                EventDescription = _Evenement.Descriptif
                            };
                            _Invitations.Add(_NewICalendar);

                            //création de la ligne du tableau
                            _EmailReservation += "<tr>";
                            _EmailReservation += "     <td>" + _Jour + "</td>";
                            _EmailReservation += "     <td>" + _HeureDebut + "</td>";
                            _EmailReservation += "     <td>" + _HeureFin + "</td>";
                            _EmailReservation += "</tr>";
                        }
                    }
                }
                else if (_Evenement.Typologie.Id == 0) //stages
                {
                    String _Jour = String.Empty;
                    foreach (Reservation _Current in _Reservations)
                    {
                        if (_Jour != _Current.Jour)
                        {
                            _Jour = _Current.Jour;
                            String _HeureDebut = (_Reservations.FindAll(p => p.Jour == _Jour).OrderBy(p => p.Creneau).FirstOrDefault().Creneau.Replace("Creneau", "").Left(2) + ":00:00");
                            String _HeureFin   = (_Reservations.FindAll(p => p.Jour == _Jour).OrderByDescending(p => p.Creneau).FirstOrDefault().Creneau.Replace("Creneau", "").Right(2) + ":00:00");

                            //création du ICS à envoyer
                            ICalendar _NewICalendar = new ICalendar
                            {
                                EventStartDateTime = Convert.ToDateTime(_Current.Jour + " " + _HeureDebut),
                                EventEndDateTime   = Convert.ToDateTime(_Current.Jour + " " + _HeureFin),
                                UID              = Guid.NewGuid().ToString(),
                                EventOrganizer   = WS.Constants.COMMANDES_SENDER,
                                EventPriority    = "0",
                                EventSummary     = _Evenement.Libelle,
                                EventDescription = _Evenement.Descriptif
                            };
                            _Invitations.Add(_NewICalendar);

                            //création de la ligne du tableau
                            _EmailReservation += "<tr>";
                            _EmailReservation += "     <td>" + _Jour + "</td>";
                            _EmailReservation += "     <td>" + _HeureDebut + "</td>";
                            _EmailReservation += "     <td>" + _HeureFin + "</td>";
                            _EmailReservation += "</tr>";
                        }
                    }
                }
                _EmailReservation += "</table>";
                _EmailReservation += "<br /><br />";
                _EmailReservation += "Les invitations pour ces dates sont disponibles en pièces jointes (fichiers ICS).";
                _EmailReservation += "<br /><br />";

                if (_Evenement.Typologie.Id == 3) //cours
                {
                    _EmailReservation += "Vous pouvez retrouver toutes vos inscriptions/réservations dans la partie \"Mon Compte\" du site de l'École du Cavalier Roi : <a href=\"" + WS.Constants.SITE_URL + "/MonCompte\" target=\"_blank\">" + WS.Constants.SITE_URL + "/MonCompte</a>.";
                }
                else if (_Evenement.Typologie.Id == 1) //tournois
                {
                    _EmailReservation += "Vous pouvez retrouver toutes vos participations dans la partie \"Mon Compte\" du site de l'École du Cavalier Roi : <a href=\"" + WS.Constants.SITE_URL + "/MonCompte\" target=\"_blank\">" + WS.Constants.SITE_URL + "/MonCompte</a>.";
                }
                else if (_Evenement.Typologie.Id == 0) //stages
                {
                    //stage "parent" : formule complete
                    if (_Evenement.EvenementParent == null)
                    {
                        _EmailReservation += "Vous pouvez retrouver toutes vos inscriptions dans la partie \"Mon Compte\" du site de l'École du Cavalier Roi : <a href=\"" + WS.Constants.SITE_URL + "/MonCompte\" target=\"_blank\">" + WS.Constants.SITE_URL + "/MonCompte</a>.";
                    }
                    //stage "enfant" : formule partielle (avec choix de réservations)
                    else
                    {
                        _EmailReservation += "Vous pouvez retrouver toutes vos inscriptions/réservations dans la partie \"Mon Compte\" du site de l'École du Cavalier Roi : <a href=\"" + WS.Constants.SITE_URL + "/MonCompte\" target=\"_blank\">" + WS.Constants.SITE_URL + "/MonCompte</a>.";
                    }
                }

                _EmailReservation += "<br /><br />";
                if ((!String.IsNullOrEmpty(_Reservations[0].PaymentId)) && (_Reservations[0].PaymentId != "KO")) //"PAYPAL PAYMENTID" OU "MON COMPTE"
                {
                    _EmailReservation += "Pour plus d'informations, n'hésitez pas à contacter l'École du Cavalier Roi à <a href=\"mailto:" + WS.Constants.COMMANDES_EMAIL + "\" target=\"_blank\">" + WS.Constants.COMMANDES_EMAIL + "</a>.";
                }
                else
                {
                    _EmailReservation += "Merci de contacter au plus vite l'École du Cavalier Roi à <a href=\"mailto:" + WS.Constants.COMMANDES_EMAIL + "\" target=\"_blank\">" + WS.Constants.COMMANDES_EMAIL + "</a> pour régler le paiement.";
                }
                _EmailReservation += "<br /><br />";
                _EmailReservation += "L'École du Cavalier Roi";
                _EmailReservation += "<br /><br />";
                _EmailReservation += "</body>";
                _EmailReservation += "</html>";

                String _EmailSubject = String.Empty;
                if (_Evenement.Typologie.Id == 3) //cours
                {
                    if (_Reservations[0].PaymentId == "MON COMPTE")
                    {
                        _EmailSubject += "Confirmation de réservations";
                    }
                    else
                    {
                        _EmailSubject += "Confirmation d'inscription/réservations";
                    }
                }
                else if (_Evenement.Typologie.Id == 1) //tournois
                {
                    _EmailSubject = "Confirmation de participation";
                }
                else if (_Evenement.Typologie.Id == 0) //stages
                {
                    //stage "parent" : formule complete
                    if (_Evenement.EvenementParent == null)
                    {
                        _EmailSubject = "Confirmation d'inscription";
                    }
                    //stage "enfant" : formule partielle (avec choix de réservations)
                    else
                    {
                        _EmailSubject = "Confirmation d'inscription/réservations";
                    }
                }
                ICSManager.SendMail(WS.Constants.COMMANDES_EMAIL, WS.Constants.COMMANDES_SENDER, _Eleve.Email, WS.Constants.COMMANDES_CC, WS.Constants.COMMANDES_CCI, _EmailSubject, _EmailReservation, true, _Invitations, null, WS.Constants.MAILSERVER_HOST, WS.Constants.MAILSERVER_PORT, WS.Constants.COMMANDES_USERNAME, WS.Constants.COMMANDES_PASSWORD, 100000, false);
                #endregion
            }

            return(_ReturnValue);
        }
示例#6
0
        public static Int32?AddEleve(
            String _Nom         = null,
            String _Prenom      = null,
            String _Email       = null,
            String _Password    = null,
            String _DtNaissance = null,
            String _Sexe        = null,
            String _Club        = null,
            String _Photo       = null,
            String _Fixe        = null,
            String _Portable    = null,
            String _Commentaire = null,
            String _License     = null,
            String _Classement  = null,
            String _Suivi       = null
            )
        {
            DBModelsParameters _DB = new WS.Models.DBModelsParameters();

            DateTime?_DtNaissanceF = null;

            if (!String.IsNullOrEmpty(_DtNaissance))
            {
                _DtNaissanceF = DateTime.Parse(_DtNaissance);
            }

            String _CryptedPassword = null;

            if (!String.IsNullOrEmpty(_Password))
            {
                _CryptedPassword = _Password.Trim().ToEncryptedTripleDES(Constants.PASSPHRASE).ToEncodedURL();
            }

            ObjectResult <Int32?> _IdResult = _DB.AddEleve(
                nom: (!String.IsNullOrEmpty(_Nom) ? _Nom.Trim() : null),
                prenom: (!String.IsNullOrEmpty(_Prenom) ? _Prenom.Trim() : null),
                dtNaissance: _DtNaissanceF,
                sexe: (!String.IsNullOrEmpty(_Sexe) ? _Sexe.Trim() : null),
                club: (!String.IsNullOrEmpty(_Club) ? _Club.Trim() : null),
                photo: (!String.IsNullOrEmpty(_Photo) ? _Photo.Trim() : null),
                email: (!String.IsNullOrEmpty(_Email) ? _Email.Trim() : null),
                password: _CryptedPassword,
                fixe: (!String.IsNullOrEmpty(_Fixe) ? _Fixe.Trim() : null),
                portable: (!String.IsNullOrEmpty(_Portable) ? _Portable.Trim() : null),
                commentaire: (!String.IsNullOrEmpty(_Commentaire) ? _Commentaire.Trim() : null),
                license: (!String.IsNullOrEmpty(_License) ? _License.Trim() : null),
                classement: (!String.IsNullOrEmpty(_Classement) ? _Classement.Trim() : null),
                suivi: (!String.IsNullOrEmpty(_Suivi) ? _Suivi.Trim() : null)
                );
            Int32?_Id = _IdResult.FirstOrDefault().Value;

            //envoi du mail de récapitulation
            #region "Mail"
            String _EmailRecapitulation = String.Empty;
            _EmailRecapitulation += "<html>";
            _EmailRecapitulation += "<body>";
            _EmailRecapitulation += "<img src=\"http://www.cavalier-roi.fr/Content/Images/LogoMail.jpg\" />";
            _EmailRecapitulation += "<br /><hr /><br />";
            _EmailRecapitulation += "Votre inscription a bien été prise en compte !";
            _EmailRecapitulation += "<br /><br />";
            _EmailRecapitulation += "<u>Email/Identifiant</u> : " + _Email;
            _EmailRecapitulation += "<br />";
            _EmailRecapitulation += "<u>Mot de passe</u> : *************";
            _EmailRecapitulation += "<br />";
            _EmailRecapitulation += "<u>Nom</u> : " + (!String.IsNullOrEmpty(_Nom) ? _Nom.Trim() : "-");
            _EmailRecapitulation += "<br />";
            _EmailRecapitulation += "<u>Prénom</u> : " + (!String.IsNullOrEmpty(_Prenom) ? _Prenom.Trim() : "-");
            _EmailRecapitulation += "<br />";
            _EmailRecapitulation += "<u>Date de naissance</u> : " + (!String.IsNullOrEmpty(_DtNaissance) ? _DtNaissance.Trim() : "-");
            _EmailRecapitulation += "<br />";
            _EmailRecapitulation += "<u>Sexe</u> : " + (!String.IsNullOrEmpty(_Sexe) ? _Sexe.Trim() : "-");
            _EmailRecapitulation += "<br />";
            _EmailRecapitulation += "<u>Fixe</u> : " + (!String.IsNullOrEmpty(_Fixe) ? _Fixe.Trim() : "-");
            _EmailRecapitulation += "<br />";
            _EmailRecapitulation += "<u>Portable</u> : " + (!String.IsNullOrEmpty(_Portable) ? _Portable.Trim() : "-");
            _EmailRecapitulation += "<br />";
            _EmailRecapitulation += "<u>License</u> : " + (!String.IsNullOrEmpty(_License) ? _License.Trim() : "-");
            _EmailRecapitulation += "<br />";
            _EmailRecapitulation += "<u>Classement</u> : " + (!String.IsNullOrEmpty(_Classement) ? _Classement.Trim() : "-");
            _EmailRecapitulation += "<br />";
            _EmailRecapitulation += "<u>Club</u> : " + (!String.IsNullOrEmpty(_Club) ? _Club.Trim() : "-");
            _EmailRecapitulation += "<br />";
            _EmailRecapitulation += "<u>Commentaire</u> : " + (!String.IsNullOrEmpty(_Commentaire) ? _Commentaire.Trim() : "-");
            _EmailRecapitulation += "<br />";
            _EmailRecapitulation += "<br />";
            _EmailRecapitulation += "Pour plus d'informations, n'hésitez pas à contacter l'École du Cavalier Roi à <a href=\"mailto:" + WS.Constants.INSCRIPTIONS_EMAIL + "\" target=\"_blank\">" + WS.Constants.INSCRIPTIONS_EMAIL + "</a>.";
            _EmailRecapitulation += "<br /><br />";
            _EmailRecapitulation += "L'École du Cavalier Roi";
            _EmailRecapitulation += "<br /><br />";
            _EmailRecapitulation += "</body>";
            _EmailRecapitulation += "</html>";
            ICSManager.SendMail(WS.Constants.INSCRIPTIONS_EMAIL, WS.Constants.INSCRIPTIONS_SENDER, _Email, WS.Constants.INSCRIPTIONS_CC, WS.Constants.INSCRIPTIONS_CCI, "Confirmation d'inscription", _EmailRecapitulation, true, null, null, WS.Constants.MAILSERVER_HOST, WS.Constants.MAILSERVER_PORT, WS.Constants.INSCRIPTIONS_USERNAME, WS.Constants.INSCRIPTIONS_PASSWORD, 100000, false);
            #endregion

            return(_Id);
        }
示例#7
0
        public HostedNetworkManager()
        {
            var enabled            = IntPtr.Zero;
            var connectionSettings = IntPtr.Zero;
            var securitySettings   = IntPtr.Zero;
            var status             = IntPtr.Zero;

            try
            {
                Logger.Trace(".ctor: Start invoking native codes...");
                Lock();

                uint       negotiatedVersion;
                WlanHandle clientHandle;

                Logger.Trace(".ctor: Invoking WlanOpenHandle...");
                var returnValue = NativeMethods.WlanOpenHandle(
                    WlanApiVersion.Version,
                    IntPtr.Zero,
                    out negotiatedVersion,
                    out clientHandle);
                Logger.Trace(".ctor: WlanOpenHandle returned {0}", returnValue);

                Utilities.ThrowOnError(returnValue);

                if (negotiatedVersion != (uint)WlanApiVersion.Version)
                {
                    Logger.Error(".ctor: Wlan API version negotiation failed");
                    throw new WlanException("Wlan API version negotiation failed");
                }

                Logger.Trace(".ctor: _wlanHandle: {0:x16}", clientHandle.DangerousGetHandle().ToInt64());
                this._wlanHandle = clientHandle;

                WlanNotificationSource previousNotificationSource;

                Logger.Trace(".ctor: Invoking WlanRegisterNotification...");
                returnValue = NativeMethods.WlanRegisterNotification(
                    clientHandle,
                    WlanNotificationSource.HostedNetwork,
                    true,
                    OnNotification,
                    IntPtr.Zero,
                    IntPtr.Zero,
                    out previousNotificationSource);
                Logger.Trace(".ctor: WlanRegisterNotification returned {0}", returnValue);

                Utilities.ThrowOnError(returnValue);

                WlanHostedNetworkReason faileReason;

                Logger.Trace(".ctor: Invoking WlanHostedNetworkInitSettings...");
                returnValue = NativeMethods.WlanHostedNetworkInitSettings(
                    clientHandle,
                    out faileReason,
                    IntPtr.Zero);
                Logger.Trace(".ctor: WlanHostedNetworkInitSettings returned {0}", returnValue);

                Utilities.ThrowOnError(returnValue);

                uint dataSize;
                WlanOpcodeValueType opcodeValueType;

                Logger.Trace(".ctor: Invoking WlanHostedNetworkQueryProperty with WlanHostedNetworkOpcode.Enable...");
                returnValue = NativeMethods.WlanHostedNetworkQueryProperty(
                    clientHandle,
                    WlanHostedNetworkOpcode.Enable,
                    out dataSize,
                    out enabled,
                    out opcodeValueType,
                    IntPtr.Zero);
                Logger.Trace(".ctor: WlanHostedNetworkQueryProperty with WlanHostedNetworkOpcode.Enable returned {0}",
                             returnValue);

                Utilities.ThrowOnError(returnValue);

                this.IsHostedNetworkAllowed = Convert.ToBoolean(Marshal.ReadInt32(enabled));
                Logger.Info(".ctor: IsHostedNetworkAllowed: {0}", this.IsHostedNetworkAllowed);

                Logger.Trace(
                    ".ctor: Invoking WlanHostedNetworkQueryProperty with WlanHostedNetworkOpcode.ConnectionSettings...");
                returnValue = NativeMethods.WlanHostedNetworkQueryProperty(
                    clientHandle,
                    WlanHostedNetworkOpcode.ConnectionSettings,
                    out dataSize,
                    out connectionSettings,
                    out opcodeValueType,
                    IntPtr.Zero);

                Utilities.ThrowOnError(returnValue);
                Logger.Trace(
                    ".ctor: WlanHostedNetworkQueryProperty with WlanHostedNetworkOpcode.ConnectionSettings returned {0}",
                    returnValue);

                if (connectionSettings == IntPtr.Zero ||
                    Marshal.SizeOf(typeof(WlanHostedNetworkConnectionSettings)) < dataSize)
                {
                    Logger.Error(".ctor: Got invalid connection setting data");
                    Utilities.ThrowOnError(13);
                }

                this._connectionSettings =
                    (WlanHostedNetworkConnectionSettings)
                    Marshal.PtrToStructure(connectionSettings, typeof(WlanHostedNetworkConnectionSettings));
                Logger.Info(".ctor: Connection setting: SSID: {0}, max peer count: {1}",
                            this._connectionSettings.HostedNetworkSSID.SSID, this._connectionSettings.MaxNumberOfPeers);

                Logger.Trace(
                    ".ctor: Invoking WlanHostedNetworkQueryProperty with WlanHostedNetworkOpcode.SecuritySettings...");
                returnValue = NativeMethods.WlanHostedNetworkQueryProperty(
                    clientHandle,
                    WlanHostedNetworkOpcode.SecuritySettings,
                    out dataSize,
                    out securitySettings,
                    out opcodeValueType,
                    IntPtr.Zero);
                Logger.Trace(
                    ".ctor: WlanHostedNetworkQueryProperty with WlanHostedNetworkOpcode.ConnectionSettings returned {0}",
                    returnValue);

                if (securitySettings == IntPtr.Zero ||
                    Marshal.SizeOf(typeof(WlanHostedNetworkSecuritySettings)) < dataSize)
                {
                    Logger.Error(".ctor: Got invalid security setting data");
                    Utilities.ThrowOnError(13);
                }

                this._securitySettings =
                    (WlanHostedNetworkSecuritySettings)
                    Marshal.PtrToStructure(securitySettings, typeof(WlanHostedNetworkSecuritySettings));
                Logger.Info(".ctor: Security setting: Authentication algorithm: {0}, cipher algorithm: {1}",
                            this._securitySettings.Dot11AuthAlgo, this._securitySettings.Dot11CipherAlgo);

                Logger.Trace(".ctor: Invoking WlanHostedNetworkQueryStatus...");
                returnValue = NativeMethods.WlanHostedNetworkQueryStatus(
                    clientHandle,
                    out status,
                    IntPtr.Zero);
                Logger.Trace(".ctor: WlanHostedNetworkQueryStatus returned {0}", returnValue);

                Utilities.ThrowOnError(returnValue);

                var wlanHostedNetworkStatus =
                    (WlanHostedNetworkStatus)
                    Marshal.PtrToStructure(status, typeof(WlanHostedNetworkStatus));

                _hostedNetworkInterfaceGuid = wlanHostedNetworkStatus.IPDeviceID;
                _hostedNetworkState         = wlanHostedNetworkStatus.HostedNetworkState;
                Logger.Info(
                    ".ctor: Hosted network status: State: {0}, BSSID: {1}, physical type: {2}, channel frequency: {3}, current number of peers: {4}",
                    wlanHostedNetworkStatus.HostedNetworkState,
                    BitConverter.ToString(wlanHostedNetworkStatus.WlanHostedNetworkBSSID),
                    wlanHostedNetworkStatus.Dot11PhyType,
                    wlanHostedNetworkStatus.ChannelFrequency,
                    wlanHostedNetworkStatus.NumberOfPeers);

                _icsManager = new ICSManager();
                Logger.Trace(".ctor: ICSManager initialized  ");
            }
            catch (ICSException)
            {
                Logger.Trace(".ctor: ICSManager is invalid");
            }
            catch (Win32Exception)
            {
                if (!this._wlanHandle.IsInvalid)
                {
                    this._wlanHandle.Dispose();
                }
                throw;
            }
            finally
            {
                Unlock();

                if (enabled != IntPtr.Zero)
                {
                    NativeMethods.WlanFreeMemory(enabled);
                }

                if (connectionSettings != IntPtr.Zero)
                {
                    NativeMethods.WlanFreeMemory(connectionSettings);
                }

                if (securitySettings != IntPtr.Zero)
                {
                    NativeMethods.WlanFreeMemory(securitySettings);
                }

                if (status != IntPtr.Zero)
                {
                    NativeMethods.WlanFreeMemory(status);
                }
            }
        }