コード例 #1
0
ファイル: UC_OngletGestion.cs プロジェクト: NwotYknuf/dotnet
        private bool remplieDeChiffres()
        {
            bool remplieDeChiffres = false;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (Utilitaires.conditionsRespecteesNombre(row.Cells[1].Value.ToString()))
                {
                    for (int i = 2; i < dataGridView1.Columns.Count; i++)
                    {
                        if (Utilitaires.conditionsRespecteesNombreDecimaux(row.Cells[i].Value.ToString()))
                        {
                            remplieDeChiffres = true;
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
                else
                {
                    return(false);
                }
            }
            return(remplieDeChiffres);
        }
コード例 #2
0
        public List <Room> GenerateIo(List <Room> lr)
        {
            int maxIo = 4;

            for (int i = 0; i < lr.Count; i++)
            {
                var currentR          = lr[i];
                var currentnumberOfIo = this.randomManager.GetInt(maxIo - 1) + 1;
                var listOfCell        = Utilitaires.RectangleDelimitationCells(currentR.Setting);
                for (int j = 0; j < currentnumberOfIo; j++)
                {
                    var nextIo = listOfCell[this.randomManager.GetInt(listOfCell.Count)];
                    var cpt    = 10;
                    while (currentR.IOs.Any(x => Math.Abs((nextIo - x.Position).Length()) <= 1) || cpt == 0)
                    {
                        cpt--;
                        nextIo = listOfCell[this.randomManager.GetInt(listOfCell.Count)];
                    }

                    currentR.IOs.Add(new Exit()
                    {
                        Position = nextIo
                    });
                }
            }

            return(lr);
        }
コード例 #3
0
        private void bCreer_Click(object sender, EventArgs e)
        {
            if ((Utilitaires.conditionsRespectees(tBNom.Text, true, true, true, true, 2, 100)) &&
                (Utilitaires.conditionsRespectees(rtBDesc.Text, true, true, true, true, 2, 100)))
            {
                lErreur.Visible = false;

                // Ajouter une UE
                ue ue = new ue();
                ue.nom         = this.tBNom.Text;
                ue.description = this.rtBDesc.Text;
                ue.periode     = _p;

                _p.ue.Add(ue);

                // Ajouter à la BDD
                Requetes.ajouterUE(ue);

                Requetes.enregistreLaBDD();

                MessageBox.Show("L'UE " + ue.nom + " a été ajoutée avec succès.");

                _cadre.Actualiser();
            }
            else
            {
                lErreur.Visible = true;
            }
        }
コード例 #4
0
        public TicketAPI GetTicket(string host)
        {
            TicketAPI ticket = new TicketAPI();

            try
            {
                /*ticket.Id = 1234;
                 * ticket.Name = "toti";
                 * return ticket;*/
                //return "123";

                X509Certificate2Collection certificateCollection = Utilitaires.GetCertificate(host);
                X509Certificate2           certificate           = certificateCollection[0];
                TicketByCertificate        ticketeByCert         = new TicketByCertificate(certificate);

                string domain         = User.Identity.Name.Split('\\')[0];
                string user           = User.Identity.Name.Split('\\')[1];
                string ticketresponse = ticketeByCert.TicketRequest("POST", host, user, domain);
                ticket = JsonConvert.DeserializeObject <TicketAPI>(ticketresponse);

                Console.WriteLine(ticketresponse);

                return(ticket);
            }
            catch (Exception e)
            {
                return(ticket);
                //return  "Mon Erreur : "+ e.Message;
            }
        }
コード例 #5
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtRecherche.Text))
            {
                MessageBox.Show("Saisissez des mots clés!");
                return;
            }
            List <string> mots = Utilitaires.Mots(txtRecherche.Text);

            for (int i = 0; i < mots.Count; i++)
            {
                mots[i] = mots[i].ToLower();
            }

            List <Livre> livres = null;

            try
            {
                livres = Livre.ObtenirParTitre(mots);
                new ListeLivresIhm(livres).ShowDialog();
            }
            catch (SqlException ex)
            {
                //MessageBox.Show("Erreur de connexion !");
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #6
0
        private void bValider_Click(object sender, EventArgs e)
        {
            if ((Utilitaires.conditionsRespectees(tBNom.Text, true, true, true, true, 2, 100)) &&
                (Utilitaires.conditionsRespectees(rtBDesc.Text, true, true, true, true, 2, 100)))
            {
                lErreur.Visible = false;

                //Modification d'un diplome
                _ec.nom         = this.tBNom.Text;
                _ec.description = this.rtBDesc.Text;

                if (this.cB_ECActive.Checked)
                {
                    _ec.actif = true;
                }
                else
                {
                    _ec.actif = false;
                }

                // Renvoie
                _cadre.modificationConfirmee();

                MessageBox.Show("L'EC " + _ec.nom + " a été modifiée avec succès.");

                this.Dispose();
            }
            else
            {
                lErreur.Visible = true;
            }
        }
コード例 #7
0
 public MainWindow()
 {
     InitializeComponent();
     Utilitaires.LoadBase();
     randomMatrix = GenerRdmMatrice(false);
     GenerateMap();
 }
コード例 #8
0
ファイル: UC_AjoutCours.cs プロジェクト: NwotYknuf/dotnet
        private void bCreer_Click(object sender, EventArgs e)
        {
            if ((Utilitaires.conditionsRespectees(tBNom.Text, true, true, true, true, 2, 100)) &&
                (Utilitaires.conditionsRespectees(tBHoraires.Text, false, true, false, false, 1, 3)) &&
                (Utilitaires.conditionsRespectees(cBType.Text, cBType)))
            {
                lErreur.Visible = false;

                // Ajouter un cours
                cours cours = new cours();
                cours.nom             = this.tBNom.Text;
                cours.volume_horraire = Convert.ToInt32(this.tBHoraires.Text);

                type_cours tc = Requetes.retrouveTypeDeCoursViaTexte(cBType.Text);
                cours.type_cours = tc;
                tc.cours.Add(cours);

                cours.ec = _e;
                _e.cours.Add(cours);

                // Ajouter l'enregistrement à la BDD
                Requetes.ajouterCours(cours);

                Requetes.enregistreLaBDD();

                MessageBox.Show("Le cours " + cours.nom + " a été ajouté avec succès.");

                _cadre.Actualiser();
            }
            else
            {
                lErreur.Visible = true;
            }
        }
コード例 #9
0
        private void bValider_Click(object sender, EventArgs e)
        {
            if ((Utilitaires.conditionsRespectees(tBNom.Text, true, true, true, true, 2, 100)) &&
                (Utilitaires.conditionsRespectees(tBHoraires.Text, false, true, false, false, 1, 3)) &&
                (Utilitaires.conditionsRespectees(cBType.Text, cBType)))
            {
                lErreur.Visible = false;

                //Modification du cours
                _cours.nom             = tBNom.Text;
                _cours.volume_horraire = Convert.ToInt32(tBHoraires.Text);

                type_cours tcActuel = Requetes.obtientTypeduCours(_cours);
                tcActuel.cours.Remove(_cours);

                type_cours tcNouveau = Requetes.retrouveTypeDeCoursViaTexte(cBType.Text);
                _cours.type_cours = tcNouveau;
                tcNouveau.cours.Add(_cours);

                //Renvoie
                _cadre.modificationConfirmee();

                MessageBox.Show("Le cours " + _cours.nom + " a été modifié avec succès.");

                this.Dispose();
            }
            else
            {
                lErreur.Visible = true;
            }
        }
コード例 #10
0
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            ValidationResult validationResult = ValidationResult.Success;

            try
            {
                //Avec le contexte on peut retrouver une référence vers la valeur de l'autre propriété à utiliser pour faire la validation
                var otherPropertyInfo = validationContext.ObjectType.GetProperty(this.otherPropertyName);

                if (otherPropertyInfo.PropertyType.Equals(typeof(int?)))
                {
                    int?toValidate        = (int?)value;
                    int?referenceProperty = (int?)otherPropertyInfo.GetValue(validationContext.ObjectInstance, null);

                    if (toValidate > referenceProperty)
                    {
                        validationResult = new ValidationResult(ErrorMessageString);
                    }
                }
                else
                {
                    validationResult = new ValidationResult("Erreur lors de la validation de la propriété NombrePlusPetitQue. OtherProperty n'est pas nullable<int>.");
                }
            }
            catch (Exception e)
            {
                throw Utilitaires.templateException("IsValid", "NombrePlusPetitQueValidator", "", e);
            }

            return(validationResult);
        }
コード例 #11
0
        public ActionResult AjoutRepresentant(RepresentantViewModel representantViewModel)
        {
            Utilitaires utilitaire = new Utilitaires();

            try
            {
                var    file     = Request.Files[0];
                string fileName = file.FileName;
                string filePath = Path.GetFullPath(fileName);
                representantViewModel.Representant.Photo = utilitaire.convertir(filePath);
            }
            catch (Exception)
            {
                ModelState.AddModelError("PhotoManquante", "La photo est soit manquante ou incompatible.");
            }

            try
            {
                dal.AjouterRepresentant(representantViewModel.Representant);
            }
            catch (Exception)
            {
                ModelState.AddModelError("erreur", "Une erreur s'est produite, Veuillez recommencer.");
            }


            return(View("AjoutRepresentant"));
        }
コード例 #12
0
        /// <summary>
        /// Renvoie la liste des emprunts pour la bibliothèque spécifiée dans l'année spécifiée.
        /// </summary>
        /// <param name="bibliotheque"></param>
        /// <param name="annee"></param>
        /// <returns></returns>
        public static List <Emprunt> Rechercher(Bibliotheque bibliotheque, int annee)
        {
            List <SqlParameter> parametres = new List <SqlParameter>();

            Utilitaires.RajouterParametre(parametres, "@CodBibliotheque", bibliotheque.Code);
            Utilitaires.RajouterParametre(parametres, "@Annee", annee);

            string sql = @"SELECT Adherent.numAdherent, nomAdherent, prenomAdherent, adrAdherent, teleAdherent, perimeLe,
                               datEmprunt, datRestitutionPrev, datRestitutionEff,                             
                               Exemplaire.numExemplaire, Exemplaire.codExemplaire,  commentExemplaire, disponible,
                               Emplacement.codEmplacement, libelEmplacement,                            
                               Bibliotheque.codBibliotheque, libelBibliotheque, adrBibliotheque,
                               Livre.IsbnLivre, titreLivre,
                               Theme.codTheme, libelTheme, descripTheme
                           FROM Adherent
                               JOIN Emprunt ON Adherent.numAdherent = Emprunt.numAdherent
                               JOIN Exemplaire ON Emprunt.numExemplaire = Exemplaire.numExemplaire
                               JOIN Emplacement ON Exemplaire.codBibliotheque = Emplacement.codBibliotheque AND Exemplaire.codEmplacement = Emplacement.codEmplacement
                               JOIN Bibliotheque ON Emplacement.codBibliotheque = Bibliotheque.codBibliotheque
                               JOIN Livre ON Exemplaire.IsbnLivre = Livre.IsbnLivre
                               JOIN Theme ON Livre.codTheme = Theme.codTheme
                           WHERE Bibliotheque.codBibliotheque = @CodBibliotheque AND YEAR(Emprunt.datEmprunt) = @Annee;";

            return(ousine.ObtenirListe(parametres, sql));
        }
コード例 #13
0
ファイル: UC_AjoutAnnee.cs プロジェクト: NwotYknuf/dotnet
        private void bCreer_Click(object sender, EventArgs e)
        {
            if ((Utilitaires.conditionsRespectees(tBNom.Text, true, true, true, true, 2, 100)) &&
                (Utilitaires.conditionsRespectees(rtBDesc.Text, true, true, true, true, 2, 100)))
            {
                lErreur.Visible = false;

                // Créer une année
                annee annee = new annee();
                annee.nom         = this.tBNom.Text;
                annee.description = this.rtBDesc.Text;
                annee.diplome     = _d;

                _d.annee.Add(annee);

                // Ajouter à la BDD
                Requetes.ajouterAnnee(annee);

                Requetes.enregistreLaBDD();

                MessageBox.Show("L'année " + annee.nom + " a été ajoutée avec succès.");

                _cadre.Actualiser();
            }
            else
            {
                lErreur.Visible = true;
            }
        }
コード例 #14
0
 public void Add(Utilitaires item)
 {
     if (list.Count < 1)
     {
         list.Add(item);
     }
     UpdateSlot();
 }
コード例 #15
0
        //F° mget ireo vols date_depart entre deux dates (a peu près)
        public void getAllFlightsAirport(DBConnection dbc, DateTime debut, DateTime fin)
        {
            DateTime refe = new DateTime(1999, 1, 1, 0, 0, 0);

            try
            {
                //raha tsy napiditra date mihitsy
                if (debut.CompareTo(refe) == 0 && fin.CompareTo(refe) == 0)
                {
                    //par defaut : ts les vols pdt trois jour
                    string sqlQuery = "SELECT * FROM VOL WHERE (Date_Depart BETWEEN DATEADD(day, -1, GETDATE()) AND DATEADD(day, +1, GETDATE())) AND (Id_Aeroport_Depart = '" + this.id_aeroport + "' OR Id_Aeroport_Arrivee = '" + this.id_aeroport + "') ";
                    System.Diagnostics.Debug.WriteLine(sqlQuery);
                    using (SqlConnection connection = dbc.getCon())
                    {
                        this.vols = connection.Query <Vol>(sqlQuery).ToList();
                    }
                }

                else if (debut.CompareTo(refe) == 0)
                {
                    debut = Utilitaires.getToday();
                    string sqlQuery = "SELECT * FROM VOL WHERE (Date_Depart BETWEEN '" + debut.ToString("yyyy-MM-dd HH:mm:ss.fff") + "' AND '" + fin.ToString("yyyy-MM-dd HH:mm:ss.fff") + "') AND (Id_Aeroport_Depart = '" + this.id_aeroport + "' OR Id_Aeroport_Arrivee = '" + this.id_aeroport + "') ";
                    System.Diagnostics.Debug.WriteLine(sqlQuery);
                    using (SqlConnection connection = dbc.getCon())
                    {
                        this.vols = connection.Query <Vol>(sqlQuery).ToList();
                    }
                }
                else if (fin.CompareTo(refe) == 0)
                {
                    fin = Utilitaires.getToday();
                    string sqlQuery = "SELECT * FROM VOL WHERE (Date_Depart BETWEEN '" + debut.ToString("yyyy-MM-dd HH:mm:ss.fff") + "' AND '" + fin.ToString("yyyy-MM-dd HH:mm:ss.fff") + "') AND (Id_Aeroport_Depart = '" + this.id_aeroport + "' OR Id_Aeroport_Arrivee = '" + this.id_aeroport + "') ";
                    System.Diagnostics.Debug.WriteLine(sqlQuery);
                    using (SqlConnection connection = dbc.getCon())
                    {
                        this.vols = connection.Query <Vol>(sqlQuery).ToList();
                    }
                }
                else if (debut.CompareTo(fin) > 0 || fin.CompareTo(debut) < 0)
                {
                    throw new Exception("Erreur d\'intervalle de temps! Re-saisir vos entrées de date");
                }
                else
                {
                    //tsotra
                    string sqlQuery = "SELECT * FROM VOL WHERE (Date_Depart BETWEEN '" + debut.ToString("yyyy-MM-dd HH:mm:ss.fff") + "' AND '" + fin.ToString("yyyy-MM-dd HH:mm:ss.fff") + "') AND (Id_Aeroport_Depart = '" + this.id_aeroport + "' OR Id_Aeroport_Arrivee = '" + this.id_aeroport + "') ";
                    System.Diagnostics.Debug.WriteLine(sqlQuery);
                    using (SqlConnection connection = dbc.getCon())
                    {
                        this.vols = connection.Query <Vol>(sqlQuery).ToList();
                    }
                }
            }
            catch (Exception exc)
            {
                throw exc;
            }
        }
コード例 #16
0
        public static List <Livre> Obtenir(Theme theme)
        {
            List <SqlParameter> parametres = new List <SqlParameter>();

            Utilitaires.RajouterParametre(parametres, "@CodTheme", theme.Code);
            string sql = sqlGeneral + "WHERE Theme.codTheme = @CodTheme";

            return(ousine.ObtenirListe(parametres, sql));
        }
コード例 #17
0
        public static Livre Obtenir(string isbn)
        {
            List <SqlParameter> parametres = new List <SqlParameter>();

            Utilitaires.RajouterParametre(parametres, "@Isbn", isbn);
            string sql = sqlGeneral + "WHERE Livre.IsbnLivre = @Isbn";

            return(ousine.Obtenir(parametres, sql));
        }
コード例 #18
0
 public void EnvoyerCourrielTest()
 {
     Utilitaires.envoieCourriel(
         "Confirmation de votre compte Club Contact (TEST)",
         Utilitaires.RenderRazorViewToString(this, "CourrielConfirmation", new Membre {
         noMembre = 1
     }),
         "*****@*****.**"
         );
 }
コード例 #19
0
 public void Utilitaires_WhenCallingRectangleDelimitationCells_CheckReturnsGoodValue(Rectangle input,
     List<Vector2> expected)
 {
     var result = Utilitaires.RectangleDelimitationCells(input);
     Assert.Equal(expected.Count, result.Count);
     foreach (var vectorExpected in expected)
     {
         Assert.Contains(vectorExpected, result);
     }
 }
コード例 #20
0
        public static Exemplaire Obtenir(int numeroExemplaire)
        {
            List <SqlParameter> parametres = new List <SqlParameter>();

            Utilitaires.RajouterParametre(parametres, "@NumExemplaire", numeroExemplaire);
            string sql = sqlGeneral + "WHERE numExemplaire = @NumExemplaire;";


            return(ousine.Obtenir(parametres, sql));
        }
コード例 #21
0
        public static List <Livre> ObtenirListe(Auteur auteur)
        {
            List <SqlParameter> parametres = new List <SqlParameter>();

            Utilitaires.RajouterParametre(parametres, "@codAuteur", auteur.Code);

            string sql = sqlGeneral + "WHERE Auteur.codAuteur = @codAuteur";

            return(ousine.ObtenirListe(parametres, sql));
        }
コード例 #22
0
        public static List <Exemplaire> ObtenirListe(Livre livre)
        {
            List <SqlParameter> parametres = new List <SqlParameter>();

            Utilitaires.RajouterParametre(parametres, "@Isbn", livre.Isbn);

            string sql = sqlGeneral + "WHERE Livre.IsbnLivre = @Isbn;";

            return(ousine.ObtenirListe(parametres, sql));
        }
コード例 #23
0
        public void ValiderMotDePasse(string motDePasse1, string motDePasseOLD, int noMembre, bool nouveauMembre)
        {
            bool ancienMDPValide = true;

            if (!nouveauMembre)
            {
                if (motDePasse1 != string.Empty)
                {
                    ancienMDPValide = false;

                    UtilitaireController u = new UtilitaireController();
                    if (((JsonResult)u.ValiderAncienMDP(motDePasseOLD, noMembre)).Data.ToString().ToLower() == "true")
                    {
                        ancienMDPValide = true;
                    }
                }
            }

            #region validationDuMDPEtAffichageErreur
            if (!ancienMDPValide)
            {
                ModelState.AddModelError("motDePasse", "Votre mot de passe actuel est invalide.");
            }
            else if (motDePasse1 != string.Empty)
            {
                if (motDePasse1.Length < 8 && motDePasse1.Length > 0)
                {
                    ModelState.AddModelError("motDePasse", "Le nouveau mot de passe doit contenir au moins 8 caractères.");
                }
                else if (!Utilitaires.hasLetters(motDePasse1))
                {
                    ModelState.AddModelError("motDePasse", "Le nouveau mot de passe doit avoir au moins une lettre.");
                }
                else if (!Utilitaires.hasUpperCase(motDePasse1))
                {
                    ModelState.AddModelError("motDePasse", "Le nouveau mot de passe doit avoir au moins une lettre majuscule.");
                }
                else if (!Utilitaires.hasLowerCase(motDePasse1))
                {
                    ModelState.AddModelError("motDePasse", "Le nouveau mot de passe doit avoir au moins une lettre minuscule.");
                }
                else if (!Utilitaires.hasNumbers(motDePasse1))
                {
                    ModelState.AddModelError("motDePasse", "Le nouveau mot de passe doit avoir au moins un chiffre.");
                }
            }
            else if (nouveauMembre)
            {
                if (motDePasse1 == string.Empty)
                {
                    ModelState.AddModelError("motDePasse", "Veuillez entrer un mot de passe.");
                }
            }
            #endregion
        }
コード例 #24
0
        public static Exemplaire Obtenir(Bibliotheque bibliotheque, string codeExemplaire)

        {
            List <SqlParameter> parametres = new List <SqlParameter>();

            Utilitaires.RajouterParametre(parametres, "@codBibliotheque", bibliotheque.Code);
            Utilitaires.RajouterParametre(parametres, "@CodExemplaire", codeExemplaire);
            string sql = sqlGeneral + "WHERE Bibliotheque.codBibliotheque = @CodBibliotheque AND Exemplaire.codExemplaire = @CodExemplaire;";

            return(ousine.Obtenir(parametres, sql));
        }
コード例 #25
0
        /// <summary>
        /// Renvoie la liste des auteur du livre spécifié.
        /// </summary>
        /// <param name="livre">Un livre.</param>
        /// <returns>Liste des auteurs.</returns>
        public static List <Auteur> ObtenirListe(Livre livre)
        {
            List <SqlParameter> parametres = new List <SqlParameter>();

            Utilitaires.RajouterParametre(parametres, "@Isbn", livre.Isbn);
            string sql = @"SELECT Auteur.codAuteur, nomAuteur, prenomAuteur
                           FROM Auteur
                           JOIN Redaction ON Auteur.codAuteur = Redaction.codAuteur
                           WHERE IsbnLivre = @Isbn;";

            return(ousine.ObtenirListe(parametres, sql));
        }
コード例 #26
0
        public static List <Auteur> RechercherParMotCleNom(string mot)
        {
            string like = $"{mot}%";
            List <SqlParameter> parametres = new List <SqlParameter>();

            Utilitaires.RajouterParametre(parametres, "@Like", like);
            string sql = @"SELECT codAuteur, nomAuteur, prenomAuteur
                           FROM Auteur
                           WHERE nomAuteur LIKE @Like;";

            return(ousine.ObtenirListe(parametres, sql));
        }
コード例 #27
0
            public override Emprunt Creer(DataRow row)
            {
                Exemplaire exemplaire  = Exemplaire.ousine.Creer(row);
                Adherent   adherent    = Adherent.ousine.Creer(row);
                DateTime   dateEmprunt = (DateTime)row["datEmprunt"];
                Emprunt    emprunt     = new Emprunt(adherent, exemplaire, dateEmprunt);

                emprunt.DateRestitutionPrevue    = (DateTime?)Utilitaires.RenvoyerValeurOuNull(row["datRestitutionPrev"]);
                emprunt.DateRestitutionEffective = (DateTime?)Utilitaires.RenvoyerValeurOuNull(row["datRestitutionEff"]);

                return(emprunt);
            }
コード例 #28
0
        /// <summary>
        /// Renvoie la bibliothèque avec le code spécifié.
        /// </summary>
        /// <param name="code">Identifiant.</param>
        /// <returns>Bibliothèque avec le code spécifié. Null si la bibliothèque n'existe pas.</returns>
        public static Bibliotheque Rechercher(string code)
        {
            List <SqlParameter> parametres = new List <SqlParameter>();

            Utilitaires.RajouterParametre(parametres, "@CodBibliotheque", code);

            string sql = @"SELECT codBibliotheque, libelBibliotheque, adrBibliotheque
                           FROM Bibliotheque
                           WHERE codBibliotheque = @CodBibliotheque";

            return(ousine.Obtenir(parametres, sql));
        }
コード例 #29
0
        public ActionResult Edit(int?id)
        {
            ViewBag.titre = "edit";

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Activite acti = db.Activites.Where(p => p.noActivite == id).FirstOrDefault();

            if (acti == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            int noMembreCo;

            verifierSiCookieNoMembreExiste(out noMembreCo);

            if (!User.IsInRole("Admin"))
            {
                if (acti.noMembreOrganisateur != noMembreCo)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
                }
            }

            try
            {
                ViewBagNecessaireModifierActivite(acti);

                DateTime?abonnementLePlusRecent = db.Abonnements.Where(m => m.noMembre == noMembreCo).OrderByDescending(m => m.dateFin).Select(m => m.dateFin).FirstOrDefault();

                if (abonnementLePlusRecent != null)
                {
                    ViewBag.finAbonnement = abonnementLePlusRecent;
                }
                return(View("Edit", acti));
            }
            catch (Exception e)
            {
                //On log l'erreur, mais on peut tout de même continuer
                Dictionary <string, string> parametres = new Dictionary <string, string>()
                {
                    { "id", (id == null ? "null" : id.ToString()) }
                };
                Elmah.ErrorSignal.FromCurrentContext().Raise(Utilitaires.templateException("Edit", "Activites", "Requête LINQ n'a pas fonctionnée.", e, null, "get"));

                return(View("Edit", acti));
            }
        }
コード例 #30
0
        public void decaller(List <Piste> listPConcerned)
        {
            double     min   = 50000;
            int        temp  = 0;
            Occupation Otemp = new Occupation();

            System.Diagnostics.Debug.WriteLine("la premiere piste re-bouclée :" + listPConcerned[0].longueur);
            for (int i = 0; i < listPConcerned.Count; i++)
            {
                System.Diagnostics.Debug.WriteLine("la " + i + "ème piste re-bouclée :" + listPConcerned[i].longueur);
                if (!Utilitaires.checkPisteLongueur(this, listPConcerned[i]))
                {
                    continue;                                                     //tsy mety aminy ilay piste eeh , miova piste
                }
                else if (listPConcerned[i].tempsMisyAvion == null)                //raha tsy bola nisy nampiasa ilay piste
                {
                    if (!Utilitaires.checkPisteLongueur(this, listPConcerned[i])) //raha tsy antonina azy ihany anefa ilay piste de miova piste
                    {
                        continue;
                    }
                    else //raha antonina azy kosa ilay piste tsy mbola nisy nampiasa
                    {
                        this.id_piste = listPConcerned[i].id_piste;
                        Otemp         = new Occupation(listPConcerned[i].id_piste, this.id_Vol, this.dateProbableArrivee, this.dateProbableArrivee.AddHours(listPConcerned[i].Degagement));
                        temp          = i;
                        break;
                    }
                }
                else  //Raha sady antonina ilay piste no efa nisy nampiasa tany aloha
                {
                    //Alaina ny occupation farany anatinle tempsMisyAvion anle piste concerned
                    Occupation farany = listPConcerned[i].tempsMisyAvion.Last();
                    for (int j = 0; j < listPConcerned[i].tempsMisyAvion.Count; j++)
                    {
                        System.Diagnostics.Debug.WriteLine("vol décalée pour le vol :" + this.id_Vol + "à la piste " + listPConcerned[i].id_piste + " - " + listPConcerned[i].tempsMisyAvion[j].debut_occupation + " - " + listPConcerned[i].tempsMisyAvion[j].fin_occupation);
                    }
                    double decallage = (farany.fin_occupation - this.dateProbableArrivee).TotalMinutes;
                    if (decallage < min) //Iny ndray ny min vaovao anle volpiste satria inferieur amle teo aloha ny attente
                    {
                        min           = decallage;
                        this.id_piste = listPConcerned[i].id_piste;
                        Otemp         = new Occupation(listPConcerned[i].id_piste, this.id_Vol, farany.fin_occupation, farany.fin_occupation.AddHours(listPConcerned[i].Degagement));
                        temp          = i; //indice anle piste
                        this.decalage = min;
                    }
                }
            }
            listPConcerned[temp].tempsMisyAvion = new List <Occupation>();
            listPConcerned[temp].tempsMisyAvion.Add(Otemp);
        }