Example #1
0
        /// Supprimer tous les commentaires d'un produit
        public static bool DeleteByProduitId(int pProdId)
        {
            bool retour = false;

            if (pProdId > 0)
            {
                using (MontRealEstateEntities db = new MontRealEstateEntities())
                {
                    List <CommentairesProduit> ListCommentairesProd = GetByProduitId(pProdId, db);
                    if (ListCommentairesProd != null && ListCommentairesProd.Count > 0)
                    {
                        foreach (CommentairesProduit cp in ListCommentairesProd)
                        {
                            cp.EstSupprime      = true;
                            cp.DateModification = DateTime.Now;
                            Outils.ConnectWebSecurity();
                            cp.ModifiePar = WebSecurity.CurrentUserId;
                        }
                        db.SaveChanges();
                        retour = true;
                    }
                }
            }
            return(retour);
        }
Example #2
0
    // Update is called once per frame
    private void Update()
    {
        if (target == null)
        {
            if (SiPasTouche == null)
            {
                Destroy(gameObject);
                return;
            }
            else
            {
                Outils.Destroyed(gameObject, SiPasTouche, tempApparition);
                return;
            }
        }
        Vector3 dir = target.position - transform.position;
        float   distanceThisFrame = speed * Time.deltaTime;

        if (dir.magnitude <= distanceThisFrame)
        {
            HitTarget();
            return;
        }
        transform.Translate(dir.normalized * distanceThisFrame, Space.World);
    }
 //pour les actions liées au "TimeSheet" actuel
 //Ici "Outils" est une classe qui contiendra les méthodes qui seront utiliser dans toute l'application
 private void LancerOuPauserTache()
 {
     if (Utils.Outils.VerificationSiAppacrientAlUtilisateurCourant(_element)) //vérification du doit
     {
         if (EtatTache.Equals("En cours") || EtatTache.Equals("En Cours"))
         {
             Outils.MettreEnPause(_element);
         }
         else if (EtatTache.Equals("En pause"))
         {
             Outils.LancerUnEnPause(_element);
         }
         else if (EtatTache.Equals("Engagé"))
         {
             Outils.LancerUnEngagE(_element);
         }
         else if (EtatTache.Equals("Terminé"))
         {
             Outils.LancerUnTerminE(_element);
         }
         Actualiser();
     }
     else
     {
         Utils.MaterialMessageBox.ShowWarning("Cette tache ne vous appartien pas !!");
     }
 }
Example #4
0
        public ActionResult DetailProduit(Produit pModel)
        {
            if (ModelState.IsValid)
            {
                Produit.SaveProduit(pModel);

                //copy de la photo dans le serveur
                if (pModel.Fichier != null && pModel.Fichier.ContentLength > 0)
                {
                    bool imageAjoute = Outils.SavePhotoProduitServer(pModel, Server, true);
                    if (imageAjoute)
                    {
                        TempData["Message"] = "Imeuble ajoute avec acces";
                        return(RedirectToAction("ProfileProduit", "Produit", new { pId = pModel.Id }));
                    }
                    else
                    {
                        ModelState.AddModelError("", "La photo de l'imeuble n'a pas ete sauvegarde");
                        return(View(pModel));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "La photo de l'imeuble est obligatoire");
                    return(View(pModel));
                }
            }
            //ERREUR dans le modele
            else
            {
                return(View(pModel));
            }
        }
Example #5
0
    public static Moniteur getMoniteurDisponible(string heure, DateTime jour)
    {
        List <Moniteur> moniteurs = new List <Moniteur>();

        conn.Open();
        MySqlCommand query = new MySqlCommand("select p.nom, p.prenom, p.dateNaissance, p.adresse, p.telephone, p.adresseMail from ladi.DSMSagendaMoniteur a,ladi.DSMSjour j, ladi.DSMScreneaux c, ladi.DSMSpersonne p where a.idJour=j.idJour and a.idCreneaux=c.idCreneaux and a.idMoniteur = p.idPersonne and a.valeur=@valeurDispo and j.date=@jour and c.valeur=@valeurHeure", conn);

        query.Parameters.AddWithValue("@valeurDispo", DisponibiliteMoniteur.DISPONIBLE);
        query.Parameters.AddWithValue("@valeurHeure", heure);
        query.Parameters.AddWithValue("@jour", Outils.convertirDateFormat2(jour));


        using (MySqlDataReader reader = query.ExecuteReader())
        {
            while (reader.Read())
            {
                moniteurs.Add(new Moniteur(reader.GetString(0), reader.GetString(1), Outils.convertirStringToDateTime(reader.GetString(2)), reader.GetString(3), reader.GetString(4), reader.GetString(5), ""));
            }
        }
        conn.Close();

        if (moniteurs.Count == 0)
        {
            return(null);
        }
        Moniteur moniteur = moniteurs[0];

        Console.WriteLine("moniteur disponible");
        return(moniteur);
    }
Example #6
0
        public static Boolean SaveProduit(Produit pModel)
        {
            bool estModifie;

            using (MontRealEstateEntities db = new MontRealEstateEntities())
            {
                //Option lorsque certain champs ne doit pas etre updatés
                if (pModel.Id > 0)
                {
                    Produit modelToSave = Produit.GetById(pModel.Id, db);
                    modelToSave.CategorieProduitId = pModel.CategorieProduitId;
                    modelToSave.UtilisateurId      = pModel.UtilisateurId;
                    modelToSave.Nom         = pModel.Nom;
                    modelToSave.Description = pModel.Description;
                    modelToSave.PrixParJour = pModel.PrixParJour;
                    modelToSave.Adresse     = pModel.Adresse;
                    modelToSave.Ville       = pModel.Ville;
                    modelToSave.Province    = pModel.Province;
                    modelToSave.Pays        = pModel.Pays;
                    modelToSave.CodePostal  = pModel.CodePostal;
                    // modelToSave.DerniereDateLocation = pModel.DerniereDateLocation;
                    modelToSave.NbMaxPersonnes   = pModel.NbMaxPersonnes;
                    modelToSave.NbChambres       = pModel.NbChambres;
                    modelToSave.SejourMinimum    = pModel.SejourMinimum;
                    modelToSave.NbChambres       = pModel.NbPhotosMax;
                    modelToSave.DateModification = DateTime.Now;
                    Outils.ConnectWebSecurity();
                    modelToSave.ModifiePar = WebSecurity.CurrentUserId;
                    estModifie             = true;
                }
                else
                {
                    //logique suplementaire dans le cas d'un New
                    Outils.ConnectWebSecurity();
                    pModel.UtilisateurId    = WebSecurity.CurrentUserId;
                    pModel.DateCreation     = DateTime.Now;
                    pModel.DateModification = DateTime.Now;
                    pModel.CreePar          = WebSecurity.CurrentUserId;
                    pModel.ModifiePar       = WebSecurity.CurrentUserId;
                    pModel.Actif            = true;
                    pModel.NbPhotosMax      = 6;
                    db.Produits.AddObject(pModel);
                    estModifie = false;
                }
                db.SaveChanges();
                FonctionnalitesProduit.SaveFonctionnaliteProduit(pModel.FonctionnalitesProduit);
                foreach (NotesProduit note in pModel.NotesProduits)
                {
                    NotesProduit.Save(note);
                }

                foreach (PhotosProduit photo in pModel.PhotosProduits)
                {
                    PhotosProduit.SavePhotoProduit(photo);
                }
            }

            return(true);
        }
Example #7
0
 public void CheckActive()
 {
     if (Outils.VerificationEtChangementEtatTache(Selection))
     {
         IsActive = true;
     }
     Actualiser();
 }
Example #8
0
 private async void Scenario_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     if (sender == null)
     {
         return;
     }
     string id     = ((sender as StackPanel).Tag as Result).id;
     string result = await Outils.InvokeMethod("scenario::changeState", id, false, "state", "run");
 }
Example #9
0
    // Start is called before the first frame update
    void Start()
    {
        toFollow = ObjectRefs.Instance.player.transform;
        Bounds CameraBound = Outils.OrthographicBounds(Camera.main);

        GetComponent <BoxCollider2D>().size = CameraBound.size + new Vector3(30, 30, 0);

        miniMap.SetActive(true);
    }
Example #10
0
        ////----------------------------------------Trouver la distance sur terrain a partir del'echellle----------------------------------
        //-------------------------------------------------------------------------------------------------------------
        public double FindDistanceOnField(Line line)
        // real distance should be in meters
        {
            Point pointA = new Point(line.X1, line.Y1);
            Point pointB = new Point(line.X2, line.Y2);

            double tempDistance = Outils.DistanceBtwTwoPoints(pointA, pointB);


            return((tempDistance * ScaleDistanceOnField) / ScaleDistanceOnCanvas);
        }
Example #11
0
 protected void HealhBarManagment()
 {
     LifeBar.transform.position = Camera.main.WorldToScreenPoint(transform.position) + new Vector3(0, -10, 0);
     if (EnemyHP <= 0)
     {
         GameManager.Money += earningsOnDestroy;
         Destroy(LifeBar);
         Outils.Destroyed(gameObject, DyingParticule, 1f);
         // Destroyer.Destroy(gameObject);
     }
 }
Example #12
0
 public static void Delete(int id)
 {
     using (MontRealEstateEntities db = new MontRealEstateEntities())
     {
         CategoriesProduit modelToDelete = CategoriesProduit.GetByCategorieId(id, db);
         Outils.ConnectWebSecurity();
         modelToDelete.ModifiePar  = WebSecurity.CurrentUserId;
         modelToDelete.EstSupprime = true;
         db.SaveChanges();
     }
 }
Example #13
0
        //Validation des données
        private void BtnValider_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(txtMatricule.Text) ||
                    string.IsNullOrWhiteSpace(txtMarque.Text) ||
                    string.IsNullOrWhiteSpace(txtModele.Text) ||
                    string.IsNullOrWhiteSpace(txtNbrePlace.Text) ||
                    string.IsNullOrWhiteSpace(txtAnneeAchat.Text) ||
                    string.IsNullOrWhiteSpace(txtNoChassis.Text))
                {
                    Outils.BoxMessage("C");
                }
                else
                {
                    TeteEngin T = new TeteEngin();
                    T.Matricule  = txtMatricule.Text;
                    T.NbrePlaces = int.Parse(txtNbrePlace.Text);
                    T.Marque     = txtMarque.Text;
                    T.AnneeAchat = int.Parse(txtAnneeAchat.Text);
                    T.Modele     = txtModele.Text;
                    T.NoChassis  = txtNoChassis.Text;

                    if (Id > 0)
                    {
                        T.Id = Id;
                        T.Update();
                        Outils.BoxMessage("M");
                        LoadTabTeteEngin();
                        GriserChamps();
                        Id = 0;
                    }
                    else
                    {
                        if (Outils.VerifNoChassis(txtNoChassis.Text))
                        {
                            MessageBox.Show("Le No de chassis: " + txtNoChassis.Text + " existe déjà !", "mTransport", MessageBoxButton.OK, MessageBoxImage.Error);
                            txtNoChassis.Focus();
                            return;
                        }
                        //T.Matricule = Outils.GenMatricule();
                        T.Insert();
                        ListTeteEngin.Add(T);
                        TabTeteEngin.Items.Refresh();
                        Outils.BoxMessage("A");
                        GriserChamps();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #14
0
 private void BtnNouveau_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DegriserChamps();
         txtMatricule.Text = Outils.Generator("Chauffeurs");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #15
0
 public ActionResult Inscription(Utilisateur pModel, bool estAdmin)
 {
     if (ModelState.IsValid)
     {
         //copy de la photo dans le serveur
         if (pModel.Fichier != null && pModel.Fichier.ContentLength > 0)
         {
             try
             {
                 Outils.SavePhotoUserServer(pModel, Server);
             }
             catch (Exception ex)
             {
                 ModelState.AddModelError("ERREUR:", ex.Message.ToString());
             }
         }
         //si modification
         if (pModel.UserProfileId > 0)
         {
             pModel.ModifiePar = pModel.UserProfileId;
         }
         // ajout d'un user
         else
         {
             //Enregistrer d'abbord le UserProfile pour apres pouvoir le referencer dans les utilisateurs
             try
             {
                 if (!estAdmin)
                 {
                     Utilisateur.SaveUserProfileAndRole(pModel, UserRole.USER);
                 }
                 else
                 {
                     Utilisateur.SaveUserProfileAndRole(pModel, UserRole.ADMIN);
                 }
             }
             catch (Exception e)
             {
                 ModelState.AddModelError("", e.Message.ToString());
                 return(View(pModel));
             }
         }
         Utilisateur.Save(pModel);
         TempData["Message"] = "Utilisateur ajoute";
         WebSecurity.Login(pModel.Courriel, pModel.MotDePasse);
         return(RedirectToAction("Index", "Produit"));
     }
     //ERREUR dans le modele
     else
     {
         return(View(pModel));
     }
 }
Example #16
0
 public void Stoper()
 {
     if (Utils.Outils.VerificationSiAppacrientAlUtilisateurCourant(Selection))//vérification du doit
     {
         Outils.Stoper(Selection);
         Actualiser();
     }
     else
     {
         Utils.MaterialMessageBox.ShowWarning("Cette tache ne vous appartien pas !!");
     }
 }
Example #17
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Get_CharacterController(animator);

        navMeshPath = new NavMeshPath();
        // Where to Dance
        int index = Random.Range(0, characterController.dancePositions.Length);

        wheretoDance   = Outils.RandomPointInBounds(characterController.dancePositions[index].GetComponent <BoxCollider>().bounds);
        wheretoDance.y = 2;
        Get_NavMeshAgent(animator).SetDestination(wheretoDance);
    }
Example #18
0
        public void Scanne(string url)
        {
            analyse = new Sqli_analyse();
            inject  = new sql_inject();
            outille = new Outils();
            List <string> extras = new List <string> {
            };

            SuprimerDansVulne(url);
            string url_point = analyse.Analyse(url);
            string ip        = outille.avoirip(url);

            string[] info        = inject.getInfos(url_point);
            string   load_file   = inject.checkLoadFile(url_point).ToString();
            string   extraFinale = "N/A";

            try
            {
                if (load_file == "True")
                {
                    extras.Add("");
                }
                if (info[0].Contains("root"))
                {
                    extras.Add("Root User");
                }
                extraFinale = string.Join("; ", extras);
            } catch (Exception) { }
            if (info.Length > 1)
            {
                string[] groupe = { url_point, info[0], info[1], ip, DateTime.Now.ToString(), extraFinale };

                if (url_point == "False")
                {
                    form.list_non_vulne.Invoke((MethodInvoker)(() =>
                    {
                        form.list_non_vulne.BeginUpdate();
                        form.list_non_vulne.Items.Add(new ListViewItem(groupe, 1));
                        form.list_non_vulne.EndUpdate();
                    }));
                }
                else
                {
                    form.list_injectables.Invoke((MethodInvoker)(() =>
                    {
                        form.list_url.BeginUpdate();
                        form.list_injectables.Items.Add(new ListViewItem(groupe));
                        form.list_url.EndUpdate();
                    }));
                }
            }
        }
Example #19
0
    private void HitTarget()
    {
        if (!degatfait)
        {
            target.GetComponent <Enemy>().enemyHP -= degat;
            Outils.Destroyed(gameObject, impactEffect, tempApparition);
            degatfait = true;

            //effectIns = Instantiate(impactEffect, transform.position, transform.rotation);
            //Destroy(effectIns, delaiApparition);
            //Destroy(gameObject, delaiApparition);
        }
    }
    /*Returns the points that is going to patroll in a RandomZone*/
    public void GetPointsToPatroll()
    {
        pointsToPatroll = new List <Vector2>();
        int randomZone  = Random.Range(0, ObjectRefs.Instance.GetPatrollZoneList().Count);
        int nulOfPoints = Random.Range(minPositionsPatrolling, maxPositionsPatrolling);

        for (int x = 0; x < nulOfPoints; x++)
        {
            Vector2 newPoint = Outils.RandomPointInBounds(ObjectRefs.Instance.GetPatrollZoneList()[randomZone].GetComponent <BoxCollider2D>().bounds);
            pointsToPatroll.Add(newPoint);
        }
        playerMakerSFM.SendEvent("PatrollZoneSetUp");
    }
Example #21
0
 private void BtnNouveau_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DegriserChamps();
         txtMatricule.Text      = Outils.Generator("TeteEngins");
         BtnModifier.IsEnabled  = false;
         BtnSupprimer.IsEnabled = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #22
0
        public static void Main(string[] args)
        {
            string   heure = "10";
            DateTime date  = Outils.convertirStringToDateTime("14/04/2017 21:08:44");
            string   res   = Outils.fusion(date, heure);

            Console.WriteLine(res);

            Vehicule v = ControleurVehicule.getVehiculeDispo(heure, date);

            if (v == null)
            {
                Console.WriteLine("null");
            }
        }
Example #23
0
        private bool controle()
        {
            bool code = true;

            if (!Outils.EstEntier(this.txtOSIA.Text))
            {
                code = false;
                MessageBox.Show("le n°Osia saisie est incorrecte", "Erreur", MessageBoxButtons.OK);
            }
            if (!Outils.EstEntier(this.txtCodePostal.Text))
            {
                code = false;
                MessageBox.Show("le code Postal saisie est incorrecte", "Erreur", MessageBoxButtons.OK);
            }
            return(code);
        }
    public static Gerant recuperGerantParMail(string adresseMail)
    {
        Gerant gerant = null;

        conn.Open();
        MySqlCommand query = new MySqlCommand("SELECT * FROM ladi.DSMSpersonne WHERE adresseMail='" + adresseMail + "'", conn);

        using (MySqlDataReader reader = query.ExecuteReader())
        {
            while (reader.Read())
            {
                gerant = new Gerant(reader.GetString(1), reader.GetString(2), Outils.convertirStringToDateTime(reader.GetString(3)), reader.GetString(4), reader.GetString(5), reader.GetString(6), reader.GetString(7));
            }
        }
        conn.Close();
        return(gerant);
    }
Example #25
0
        private void button1_Click(object sender, EventArgs e)
        {
            string   jour2 = jour.Value.ToString("yyyy-MM-dd HH:mm:ss").Split(' ')[0];
            string   date1 = jour2 + " 00:00:00";
            DateTime tmp   = Outils.convertirStringToDateTime(date1);
            int      res   = GestionReservation.effectuerReservation(client.AdresseMail, heure.Text, tmp);

            if (res == -1 || res == 0)
            {
                MessageBox.Show("reservation non effectuée car pas de disponibilité");
                this.Show();
            }
            else
            {
                MessageBox.Show("reservation effectuée");
                this.Show();
            }
        }
Example #26
0
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (Vector3.Distance(Get_CharacterPosition(), wheretoDance) < distanceToStartDancing)
     {
         animator.SetBool("isDancing", true);
         animator.SetBool("GoingToDance", false);
     }
     else
     {
         Get_NavMeshAgent(animator).CalculatePath(wheretoDance, navMeshPath);
         if (navMeshPath.status != NavMeshPathStatus.PathComplete)
         {
             int index = Random.Range(0, characterController.dancePositions.Length);
             wheretoDance   = Outils.RandomPointInBounds(characterController.dancePositions[index].GetComponent <BoxCollider>().bounds);
             wheretoDance.y = 2;
             Get_NavMeshAgent(animator).SetDestination(wheretoDance);
         }
     }
 }
Example #27
0
        /// <summary>
        /// fonction de contrôle de vraissemblance des différents
        /// champs du form :
        /// (appelée avant d'instancier un objet MStagiaire
        /// et d'affecter ses membres)
        /// </summary>
        /// <returns> Booléen : true = OK, false = erreur</returns>
        private Boolean controle()
        {
            // contrôler la vraissemblance de tous les champs
            Boolean code = true; // le code de retour ; OK a priori

            // appel fonction générique de contrôle
            if (!(Outils.EstEntier(this.txtNumero.Text)))
            {
                // la chaîne reçue n'est pas convertible
                code = false;
                MessageBox.Show("le code OSIA saisi n'est pas un entier valide", "ERREUR", MessageBoxButtons.OK);
            }
            if (!(Outils.EstEntier(this.txtCodePostal.Text)))
            {
                code = false;
                MessageBox.Show("le code postal saisi n'est pas correct", "ERREUR", MessageBoxButtons.OK);
            }
            return(code);
        }
Example #28
0
        public ActionResult Login(LoginModel pModel)
        {
            Outils.ConnectWebSecurity();
            //tester si le user est actif d'abbord
            int idUser = WebSecurity.GetUserId(pModel.UserName);

            //user existe
            if (idUser > 0)
            {
                Utilisateur user = Utilisateur.GetProfileById(idUser);
                if (user != null)//user active
                {
                    bool connecte = WebSecurity.Login(pModel.UserName, pModel.Password);
                    if (connecte)
                    {
                        if (Roles.IsUserInRole("Admin"))
                        {
                            return(RedirectToAction("", ""));//admin connecte
                        }
                        else
                        {
                            return(RedirectToAction("Index", "Produit"));//user connecte
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("", "Mot de Passe ou Courriel incorrect");
                        return(View(pModel));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "User Inactive");
                    return(View(pModel));
                }
            }
            else
            {
                ModelState.AddModelError("", "User Inexistent");
                return(View(pModel));
            }
        }
Example #29
0
    //permet de recuperer les jours de travail
    public static List <Jour> getJoursTravail()
    {
        List <Jour> jours = new List <Jour>();

        conn.Open();
        MySqlCommand query = new MySqlCommand("SELECT * FROM DSMSjour WHERE jourSemaine NOT IN (7, 1)", conn);

        using (MySqlDataReader reader = query.ExecuteReader())
        {
            while (reader.Read())
            {
                jours.Add(new Jour(Outils.convertirStringToDateTime(reader.GetString(1))));
            }
        }
        conn.Close();

        Console.WriteLine("jours de travail");

        return(jours);
    }
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Get_CharacterController(animator);

        navMeshPath = new NavMeshPath();

        //Setting up the random points where the killer will go (inside a BoxCollider)
        positionsToPatroll = new List <Vector3>();
        int index       = Random.Range(0, killerController.patrollingAreas.Length);
        int nulOfPoints = Random.Range(minPositionsPatrolling, maxPositionsPatrolling);

        for (int x = 0; x < nulOfPoints; x++)
        {
            Vector3 newPoint = Outils.RandomPointInBounds(killerController.patrollingAreas[index].GetComponent <BoxCollider>().bounds);
            newPoint.y = killerController.transform.position.y;
            positionsToPatroll.Add(newPoint);
        }
        killerController.GetAgent().SetDestination(positionsToPatroll[0]);
        killerController.GetAgent().speed = patrollingSpeed;
    }