Exemplo n.º 1
0
    private void SetResultClip(ResultatModel resultat)
    {
        _parameterBehaviour.animator.GetBehaviour <SFXBehaviour>().source = resultat ? resultat.typeResultat.GetClip() : SFXSource.Echec;

        _clipsSwapper.SwapClip(RESULT, resultat ? resultat.resultClip : null);
        _clipsSwapper.ApplyChanges();
    }
Exemplo n.º 2
0
        public ActionResult Import(int?page = 1)
        {
            PersonneModel        personne     = (PersonneModel)Session.Contents["user"];
            List <ResultatModel> modelsResult = new List <ResultatModel>();


            HttpPostedFileBase fichier = Request.Files["FileResult"];


            if (fichier != null)
            {
                StreamReader stream = new StreamReader(fichier.InputStream);
                string       chaine = stream.ReadToEnd();

                String[] lignes = chaine.Split('\r', '\n');

                foreach (var ligne in lignes)
                {
                    if (String.IsNullOrEmpty(ligne))
                    {
                        continue;
                    }
                    ResultatModel model  = new ResultatModel();
                    string[]      champs = ligne.Split(';');

                    model.Race          = MgtRace.GetInstance().GetRace(int.Parse(champs[1])).ToModel();
                    model.Personne      = MgtPersonne.GetInstance().GetPersonneByID(int.Parse(champs[0])).ToModel();
                    model.Classement    = int.Parse(champs[2]);
                    model.TempsDeCourse = TimeSpan.Parse(champs[3]);
                    model.HeureDebut    = TimeSpan.Parse(champs[4]);
                    model.HeureArrivee  = TimeSpan.Parse(champs[5]);
                    modelsResult.Add(model);
                }
            }



            bool res = MgtResultat.GetInstance().Save(modelsResult.Select(x => x.ToBo()).ToList());


            if (res)
            {
                return(RedirectToAction("Index", "Admin"));
                //return View(valRet);
            }
            else
            {
                return(View("Importresult"));
            }
        }
Exemplo n.º 3
0
        public static Resultat ToBo(this ResultatModel model)
        {
            if (model == null)
            {
                return(null);
            }
            Resultat newResultat = new Resultat();

            newResultat.Personne      = model.Personne.ToBo();
            newResultat.Race          = model.Race.ToBo();
            newResultat.Classement    = model.Classement;
            newResultat.TempsDeCourse = model.TempsDeCourse;
            newResultat.HeureArrivee  = model.HeureArrivee;
            newResultat.HeureDebut    = model.HeureDebut;

            return(newResultat);
        }
        public ActionResult Resultat(int id = 0)
        {
            if (!WebSecurity.Initialized)
            {
                WebSecurity.InitializeDatabaseConnection("SqlAdoCs", "UserTable", "Id", "Name", autoCreateTables: true);
            }
            int idUser = WebSecurity.CurrentUserId;

            List <Resultat>      resultats = MgtResultat.GetInstance().GetAllByCourseAndPersonne(id, idUser);
            Race                 course    = MgtRace.GetInstance().GetRace(id);
            List <ResultatModel> models    = new List <ResultatModel>();
            Boolean              first     = true;
            DateTime             debut     = DateTime.Now;

            foreach (Resultat bo in resultats)
            {
                ResultatModel model = bo.ToModel();
                if (first)
                {
                    debut            = model.temps;
                    model.tempsPoint = "0:00:00.000";
                    first            = false;
                }
                else
                {
                    TimeSpan span = model.temps.Subtract(debut);
                    model.tempsPoint = formatTemps(span);
                }
                model.Point = MgtPoint.GetInstance().GetPointById(model.idPoint).ToModel();
                models.Add(model);
            }
            models.OrderBy(x => x.Point.Ordre);
            ResultatView view = new ResultatView()
            {
                Course    = course.ToModel(),
                resultats = models
            };

            return(View(view));
        }
Exemplo n.º 5
0
        public JsonResult UpdateCompetiteurResultat(ResultatModel model)
        {
            var resultats      = this.resultatsRepository.Read();
            var epreuves       = this.epreuvesRepository.Read();
            var participations = this.participationsRepository.Read();

            try
            {
                var dbmodel = resultats.FirstOrDefault(m => m.Id == model.ResultatId);
                if (dbmodel != null)
                {
                    dbmodel.Score      = model.Score;
                    dbmodel.Classement = model.Classement;
                    this.resultatsRepository.Update(dbmodel);
                    return(Json(string.Empty));
                }
                throw new ArgumentException("Unknow Model");
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 6
0
    private TypeResultat?SelectResultat(ResultatModel resultat)
    {
        if (resultat == null)
        {
            if (hasResultEvent)
            {
                _onResult.Invoke("Echec");
            }

            m_gameLoopController.OnSelectResultat(null);
            return(null);
        }

        if (hasResultEvent)
        {
            _onResult.Invoke(resultat.typeResultat.PrettyName());
        }

        resultat.UnlockNoteCarnet();

        m_gameLoopController.OnSelectResultat(resultat);

        return(resultat.typeResultat);
    }
Exemplo n.º 7
0
 public void OnSelectResultat(ResultatModel resultat) => SetResultClip(resultat);