public FrmAnnexe(
            DeclarationEmployeurController <TL, TP> controller,
            Societe societe,
            Exercice exercice)
            : this()
        {
            if (controller == null)
            {
                throw new ArgumentNullException("controller");
            }
            if (societe == null)
            {
                throw new ArgumentNullException("societe");
            }
            if (exercice == null)
            {
                throw new ArgumentNullException("exercice");
            }

            _controller = controller;
            _societe    = societe;
            _exercice   = exercice;

            InitGridLignes();
            InitGridZoneValue();
            _lignesCollection = new List <TL>();
            RefreshDataSource();
        }
Beispiel #2
0
        private void btn_AjouterExercice_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrWhiteSpace(txt_NomExercice.Text) || !String.IsNullOrWhiteSpace(txt_Recompense.Text))
            {
                Exercice lexercice = new Exercice();
                lexercice.Id          = Guid.NewGuid().ToString();
                lexercice.Nom         = txt_NomExercice.Text;
                lexercice.Recompense  = Convert.ToInt32(txt_Recompense.Text);
                lexercice.lEquipement = new Equipement {
                    Id = cbx_IdEquipement.SelectedValue.ToString()
                };
                lexercice.LeType = new TypeEntrainement {
                    Id = cbx_IdTypeEntrainement.SelectedValue.ToString()
                };

                DAL.Instance.AjouterExercice(lexercice);

                txt_IdExercice.Clear();
                txt_NomExercice.Clear();
                txt_Recompense.Clear();
            }
            else
            {
                MessageBox.Show("Les valeurs du formulaire doivent être rempli ! ");
            }
        }
Beispiel #3
0
        /// <summary>
        ///     Cloture exercice or decloture
        /// </summary>
        /// <param name="no">Id exercice</param>
        public void CloturerExercice(int no)
        {
            Exercice exercice = _exerciceRepository.Get(no);

            if (exercice == null)
            {
                throw new InvalidOperationException("Exercice invalide!");
            }
            if (!exercice.IsCloturer)
            {
                // check if exercice archive
                if (exercice.IsArchive)
                {
                    throw new InvalidOperationException("Exercice est déja archivé");
                }

                _exerciceRepository.Cloturer(exercice.Id);
                exercice.IsCloturer = true;
            }
            else
            {
                // check if exercice is archiver
                if (exercice.IsArchive)
                {
                    throw new InvalidOperationException("Exercice est déja archivé");
                }
                _exerciceRepository.Decloturer(exercice.Id);
                exercice.IsCloturer = false;
            }
        }
Beispiel #4
0
        /// <summary>
        ///     Change current exerice
        /// </summary>
        /// <param name="exercice">Exercice</param>
        public void ChangeExerciceCourant(Exercice exercice)
        {
            try
            {
                if (Societe == null)
                {
                    throw new InvalidOperationException("Societé courante invalide!");
                }
                if (exercice == null)
                {
                    throw new ArgumentNullException("exercice");
                }

                Societe societe = _societeRepository.Get(Societe.Id);
                if (societe == null)
                {
                    throw new ApplicationException("Societe invalide!");
                }

                societe.CurrentExerciceNo = exercice.Id;
                _societeRepository.Update(societe);
                Societe  = societe;
                Exercice = exercice;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #5
0
    // Récupération de l'exercice 1.2
    void HandleValueChanged3(object sender, ValueChangedEventArgs args)
    {
        if (args.DatabaseError != null)
        {
            Debug.LogError(args.DatabaseError.Message);
            return;
        }
        DataSnapshot snapshot = args.Snapshot;

        exo = JsonUtility.FromJson <Exercice>(snapshot.GetRawJsonValue());
        // Mise à jour de la valeur des selects :
        string[] nom_audio = { "1_2", "2_3", "3_2", "4_5", "5_6", "5_7", "6_5", "7_5", "7_9", "8_3" };

        for (int i = 0; i < nom_audio.Length; i++)
        {
            if (nom_audio[i].Equals(exo.boutonSon1))
            {
                drop121.value = i;
            }
            if (nom_audio[i].Equals(exo.boutonSon2))
            {
                drop122.value = i;
            }
            if (nom_audio[i].Equals(exo.boutonSon3))
            {
                drop123.value = i;
            }
            if (nom_audio[i].Equals(exo.boutonSon4))
            {
                drop124.value = i;
            }
        }
    }
Beispiel #6
0
        public void ChangeCurrentParametre(SocieteView societeView, Exercice exercice)
        {
            var societe = _service.SocieteGet(societeView.Id);

            _service.SetSociete(societe);
            _service.ChangeExerciceCourant(exercice);
        }
Beispiel #7
0
        internal void AjouterExercice(Exercice lexercice)
        {
            try
            {
                cnx.Open();
                SqlCommand cmd = new SqlCommand("dbo.AjouterExercice", cnx);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add("@idExercice", SqlDbType.NVarChar).Value         = lexercice.Id.Trim();
                cmd.Parameters.Add("@nomExercice", SqlDbType.NVarChar).Value        = lexercice.Nom.Trim();
                cmd.Parameters.Add("@recompense", SqlDbType.Int).Value              = lexercice.Recompense;
                cmd.Parameters.Add("@idEquipement", SqlDbType.NVarChar).Value       = lexercice.lEquipement.Id.Trim();
                cmd.Parameters.Add("@idTypeEntrainement", SqlDbType.NVarChar).Value = lexercice.LeType.Id.Trim();
                cmd.Parameters.Add("@imgPath", SqlDbType.VarChar).Value             = lexercice.imagePath.Trim();
                //cmd.Parameters.Add("@image", SqlDbType.Binary).Value = Convert.ToByte(lexercice.image);
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                cnx.Close();
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,GroupeM,Name,Description,Image")] Exercice exercice)
        {
            if (id != exercice.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(exercice);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExerciceExists(exercice.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(exercice));
        }
Beispiel #9
0
        public void Create(string title, IEnumerable <TutorialSource> tutorialSources, int exerciceId)
        {
            if (_tutorialRepository.All().Any(s => s.Title.Equals(title)))
            {
                throw new ExistingTitleException();
            }
            Exercice exo = _exerciceRepository.FindBy(exerciceId);

            if (exo == null)
            {
                throw new ExerciceNotFoundException();
            }
            Tutorial tuto = new Tutorial()
            {
                Title      = title,
                Exercice   = exo,
                ExerciceId = exerciceId
            };

            _tutorialRepository.Save(tuto);
            foreach (var tutorialSource in tutorialSources)
            {
                tutorialSource.TutorialId = tuto.Id;
                tutorialSource.Tutorial   = tuto;
                _sourceRepository.Save(tutorialSource);
            }
        }
Beispiel #10
0
        public RecapAnnexe7Service(
            Societe societe,
            Exercice exercice,
            Annexe1Service annexeUnService,
            Annexe2Service annexeDeuxService,
            Annexe3Service annexeTroisService,
            Annexe4Service annexeQuatreService,
            Annexe5Service annexeCinqService,
            Annexe6Service annexeSixService)
        {
            if (societe == null)
            {
                throw new ArgumentNullException(nameof(societe));
            }

            if (exercice == null)
            {
                throw new ArgumentNullException(nameof(exercice));
            }

            if (annexeUnService == null)
            {
                throw new ArgumentNullException(nameof(annexeUnService));
            }

            if (annexeDeuxService == null)
            {
                throw new ArgumentNullException(nameof(annexeDeuxService));
            }

            if (annexeTroisService == null)
            {
                throw new ArgumentNullException(nameof(annexeTroisService));
            }

            if (annexeQuatreService == null)
            {
                throw new ArgumentNullException(nameof(annexeQuatreService));
            }

            if (annexeCinqService == null)
            {
                throw new ArgumentNullException(nameof(annexeCinqService));
            }

            if (annexeSixService == null)
            {
                throw new ArgumentNullException(nameof(annexeSixService));
            }

            _societe             = societe;
            _exercice            = exercice;
            _annexeUnService     = annexeUnService;
            _annexeDeuxService   = annexeDeuxService;
            _annexeTroisService  = annexeTroisService;
            _annexeQuatreService = annexeQuatreService;
            _annexeCinqService   = annexeCinqService;
            _annexeSixService    = annexeSixService;
        }
Beispiel #11
0
 /// <summary>
 /// Contructeur
 /// </summary>
 /// <param name="exercice">l'exercice en cours</param>
 public CompteChiffreViewModel(Exercice exercice) : base(exercice)
 {
     StartChrono();
     CompteurErreurs  = 0;
     _nombreTours     = 15;
     _nombreToursFait = 0;
     _random          = new Random();
     _listeChiffre    = new List <Chiffre>();
 }
        public async Task <IActionResult> Create([Bind("Id,GroupeM,Name,Description,Image")] Exercice exercice)
        {
            if (ModelState.IsValid)
            {
                _context.Add(exercice);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(exercice));
        }
Beispiel #13
0
 /// <summary>
 /// Constructeur
 /// </summary>
 /// <param name="exercice">l'exercice en cours</param>
 public PyramideChiffreViewModel(Exercice exercice) : base(exercice)
 {
     _random                  = new Random();
     LigneChiffre             = new List <int>();
     _premiereLigneOperation  = new List <OperationEnum>();
     _deuxiemeLigneOperation  = new List <OperationEnum>();
     _troisiemeLigneOperation = new List <OperationEnum>();
     _nbTours                 = 10;
     _toursEnCours            = 0;
     _resultatAttendu         = 0;
 }
Beispiel #14
0
 private void btn_AjouterExercices_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < nbExercices; i++)
     {
         ComboBox laComboExercice = lesExercicesCbx[i];
         ComboBox laComboNbtour   = lesnbExericicesCbx[i];
         Exercice lexercices      = new Exercice();
         lexercices.Id         = laComboExercice.SelectedValue.ToString();
         lexercices.leNbdeFois = Convert.ToInt32(laComboNbtour.SelectedItem.ToString());
         lentrainement.lesExos.Add(lexercices);
     }
 }
Beispiel #15
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            _exercice = e.Parameter as Exercice;
            if (_exercice != null)
            {
                HeaderTextBlock.Text = _exercice.Nom;
                _increment           = 0;
                NextPage();
            }
        }
Beispiel #16
0
        /// <summary>
        /// Charge les stats à afficher
        /// </summary>
        public async Task ChargerResultats(Resultats resultats)
        {
            _isEval = false;
            if (_scoreBusiness == null)
            {
                _scoreBusiness = new ScoreBusiness();
                await _scoreBusiness.Initialization;
            }
            _exercice = resultats.Exercice;

            //pense à retrouvé le résultat tout juste ajouter, et à vérifier le nouveau record

            //partie résultats
            var listePerso = await _scoreBusiness.GetListeTopScorePerso(resultats.Exercice.Id, ContextAppli.ContextUtilisateur.EnCoursUser.Id);

            if (listePerso.Count >= 1)
            {
                RecordPerso1.Text = listePerso[0].Resultat.ToString();
            }
            if (listePerso.Count >= 2)
            {
                RecordPerso2.Text = listePerso[1].Resultat.ToString();
            }

            if (listePerso.Count >= 3)
            {
                RecordPerso3.Text = listePerso[2].Resultat.ToString();
            }
            var listeGlobal = await _scoreBusiness.GetListeTopScoreGlobal(resultats.Exercice.Id);

            if (listeGlobal.Count >= 1)
            {
                RecordGlob1.Text = listeGlobal[0].Resultat + " - " + await _scoreBusiness.GetNomUtilisateur(listeGlobal[0].IdUtilisateur);
            }

            if (listeGlobal.Count >= 2)
            {
                RecordGlob2.Text = listeGlobal[1].Resultat + " - " + await _scoreBusiness.GetNomUtilisateur(listeGlobal[1].IdUtilisateur);
            }

            if (listeGlobal.Count >= 3)
            {
                RecordGlob3.Text = listeGlobal[2].Resultat + " - " + await _scoreBusiness.GetNomUtilisateur(listeGlobal[2].IdUtilisateur);
            }

            ScoreTextBlock.Text  = resultats.ScoreExercice.Resultat + " / 100";
            TempsTextBlock.Text  = DateUtils.ConvertNbMilisecondesString(resultats.ScoreExercice.NbSecondes);
            ErreurTextBlock.Text = resultats.Erreurs.ToString();
            if (listePerso[0].Equals(resultats.ScoreExercice) || listeGlobal[0].Equals(resultats.ScoreExercice))
            {
                NewRecordText.Visibility = Visibility.Visible;
            }
        }
Beispiel #17
0
 /// <summary>
 /// Contructeur
 /// </summary>
 /// <param name="exercice">l'exercice en cours</param>
 public TrouveObjetCouleurViewModel(Exercice exercice) : base(exercice)
 {
     ListeFormeDefaut = new List <Forme>
     {
         new Forme(1, PolygonEnum.CARRE.GetPoints(), CouleursEnum.BLEU.GetColor()),
         new Forme(2, PolygonEnum.TRIANGLE.GetPoints(), CouleursEnum.GRIS.GetColor()),
         new Forme(3, PolygonEnum.MAISON.GetPoints(), CouleursEnum.ROUGE.GetColor()),
         new Forme(4, PolygonEnum.PENTAGONE.GetPoints(), CouleursEnum.VERT.GetColor()),
         new Forme(5, PolygonEnum.LOSANGE.GetPoints(), CouleursEnum.NOIR.GetColor()),
     };
     ListeIdFormeEnCours = new List <int>();
     _puzzleEnCours      = new List <Forme>();
 }
Beispiel #18
0
    public void CloseForm()
    {
        Exercice exercice = new Exercice(ExerciceNb, int.Parse(InputFieldRepetitions.text), int.Parse(InputFieldSeries.text));
        UserData ud       = DataController.Instance.GetUserData();

        ud.Exercices.Add(exercice);
        DataController.Instance.SaveUserData();
        InputFieldSeries.text      = "";
        InputFieldRepetitions.text = "";
        ButtonClose.enabled        = false;
        PanelForm.SetActive(false);
        PanelGrid.SetActive(true);
    }
Beispiel #19
0
	public void AddExToXml(string name, List<string> data, List<int> rest){
		ExerciceContainer exerciceContainer = ExerciceContainer.Load ();

		Exercice exercice = new Exercice ();
		exercice.Name = name;

		for (int i = 0; i < data.Count && i < rest.Count; i++) {
			exercice.Series.Add(new Serie(rest[i], data[i], i));
		}

		exerciceContainer.Exercices.Add(exercice);

		exerciceContainer.Save();

	}
        public Annexe7Service(
            IAnnexeSeptRepository repository,
            IExportRepostiory exportRepostiory,
            Societe societe,
            Exercice exercice,
            ILigneAnnexeSeptImportRepository ligneAnnexeSeptImportRepository,

            //IAnnexeUnRepository annexeUnRepo,
            //IAnnexeDeuxRepository annexeDeuxRepo,
            //IAnnexeTroisRepository annexeTroisRepo,
            //IAnnexeQuatreRepository annexeQuatreRepo,
            //IAnnexeCinqRepository annexeCinqRepo,
            IAnnexeSeptRepository annexeSeptRepo)
        {
            if (repository == null)
            {
                throw new ArgumentNullException("repository");
            }

            if (exportRepostiory == null)
            {
                throw new ArgumentNullException("exportRepostiory");
            }

            if (societe == null)
            {
                throw new ArgumentNullException("societe");
            }

            if (exercice == null)
            {
                throw new ArgumentNullException("exercice");
            }

            _repository       = repository;
            _exportRepostiory = exportRepostiory;
            _societe          = societe;
            _exercice         = exercice;
            _ligneAnnexeSeptImportRepository = ligneAnnexeSeptImportRepository;
            _validator = new LigneAnnexeSeptValidator();
            //_annexeCinqRepo = annexeCinqRepo;
            //_annexeSixRepo = annexeSixRepo;
            //_annexeDeuxRepo = annexeDeuxRepo;
            //_annexeTroisRepo = annexeTroisRepo;
            //_annexeUnRepo = annexeUnRepo;
            //_annexeQuatreRepo = annexeQuatreRepo;
            _annexeSeptRepo = annexeSeptRepo;
        }
Beispiel #21
0
        public VirementReport(
            Societe societe,
            Exercice exercice)
        {
            if (societe == null)
            {
                throw new ArgumentNullException(nameof(societe));
            }
            if (exercice == null)
            {
                throw new ArgumentNullException(nameof(exercice));
            }

            _societe  = societe;
            _exercice = exercice;
        }
Beispiel #22
0
        /// <summary>
        /// Constructeur
        /// </summary>
        /// <param name="exercice"></param>
        public MemoireMotsViewModel(Exercice exercice) : base(exercice)
        {
            _random                = new Random();
            _motsTrouve            = new List <string>();
            MotsAleatoire          = new List <string>();
            _motsAleatoireFormater = new List <string>();

            IsModeMemoireMot = true;

            _timer = new DispatcherTimer {
                Interval = TimeSpan.FromMilliseconds(1000)
            };
            _timer.Tick += timer_Tick;
            TempsRestant = 120;

            CompteurErreurs = 0;
        }
Beispiel #23
0
        public void Create(string title, int position, IEnumerable <ExerciceSource> sources)
        {
            if (_exerciceRepository.All().Any(s => s.Title.Equals(title)))
            {
                throw new ExistingTitleException();
            }
            Exercice exo = new Exercice()
            {
                Title    = title,
                Position = position
            };

            _exerciceRepository.Save(exo);
            foreach (var exerciceSource in sources)
            {
                exerciceSource.ExerciceId = exo.Id;
                exerciceSource.Exercice   = exo;
                _sourceRepository.Save(exerciceSource);
            }
        }
        public Annexe5Service(
            IAnnexeCinqRepository repository,
            IExportRepostiory exportRepostiory,
            Societe societe,
            Exercice exercice,
            ILigneAnnexeCinqImportRepository ligneAnnexeCinqImportRepository)
        {
            if (repository == null)
            {
                throw new ArgumentNullException("repository");
            }

            if (exportRepostiory == null)
            {
                throw new ArgumentNullException("exportRepostiory");
            }

            if (societe == null)
            {
                throw new ArgumentNullException("societe");
            }

            if (exercice == null)
            {
                throw new ArgumentNullException("exercice");
            }

            if (ligneAnnexeCinqImportRepository == null)
            {
                throw new ArgumentNullException(nameof(ligneAnnexeCinqImportRepository));
            }

            _repository       = repository;
            _exportRepostiory = exportRepostiory;
            _societe          = societe;
            _exercice         = exercice;
            _ligneAnnexeCinqImportRepository = ligneAnnexeCinqImportRepository;

            _validator = new LigneAnnexeCinqValidator();
        }
Beispiel #25
0
        internal List <Tour> RecupExerciceParTour(string p_idEntrainement, int p_nbTour)
        {
            cnx.Open();
            List <Tour> lesTours = new List <Tour>();

            for (int i = 1; i <= p_nbTour; i++)
            {
                Tour leTour = new Tour {
                    numeroTour = i
                };
                SqlCommand cmd = new SqlCommand("dbo.RecupExerciceParTour", cnx);
                cmd.CommandType = CommandType.StoredProcedure;
                //SqlParameter sqlParam = new SqlParameter("@typeExercice", p_typeExercice);
                cmd.Parameters.Add("@idEntrainement", SqlDbType.NVarChar).Value = p_idEntrainement;
                cmd.Parameters.Add("@numeroTour", SqlDbType.Int).Value          = i;

                SqlDataReader rdr = cmd.ExecuteReader();

                List <Exercice> list_Exercice = new List <Exercice>();
                while (rdr.Read())
                {
                    Exercice l_exercice = new Exercice();
                    l_exercice.Id         = rdr["idExercice"].ToString().Trim();
                    l_exercice.Nom        = rdr["Nom"].ToString().Trim();
                    l_exercice.Recompense = Convert.ToInt32(rdr["Recompense"].ToString().Trim());
                    l_exercice.imagePath  = rdr["imgPath"].ToString().Trim();
                    l_exercice.leNbdeFois = Convert.ToInt32(rdr["nbFoisExercice"].ToString().Trim());
                    l_exercice.sequence   = Convert.ToInt32(rdr["sequenceExercice"].ToString().Trim());
                    list_Exercice.Add(l_exercice);
                }
                rdr.Close();
                leTour.lesExercices = list_Exercice;

                lesTours.Add(leTour);
            }
            cnx.Close();
            return(lesTours);
        }
Beispiel #26
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            //si c'est un exercice fournit en paramètre, il s'agit du mode jeu normal, donc on ouvre l'exercice
            if (e.Parameter is Exercice)
            {
                _exercice            = e.Parameter as Exercice;
                HeaderTextBlock.Text = _exercice.Nom;
            }

            //si c'est un enum du mode d'ouverture, on ouvre le jeu en mode evaluation
            if (e.Parameter is ModeOuvertureJeuEnum)
            {
                var v = (ModeOuvertureJeuEnum)e.Parameter;
                if (v.Equals(ModeOuvertureJeuEnum.ModeEval))
                {
                    ContextAppli.ContextUtilisateur.LaunchEval();
                    DifficulteGrid.Visibility = Visibility.Visible;
                    DfficulteGridView.Margin  = new Thickness(0, 125, 0, 0);
                    _exercice = await ContextAppli.ContextUtilisateur.ModeEval.ChangeExerciceEval();
                }
            }
        }
Beispiel #27
0
        private void btn_AjouterExercices_Click(object sender, EventArgs e)
        {
            int NumCheck = numeroTour;

            NumCheck++;

            for (int p = 0; p < nbExercices; p++)
            {
                ComboBox laComboExercice = lesExercicesCbx[p];
                ComboBox laComboNbtour   = lesnbExericicesCbx[p];

                Exercice lexercices = new Exercice();
                lexercices.Id     = laComboExercice.SelectedValue.ToString();
                lexercices.Nom    = laComboExercice.Text;
                lexercices.LeType = new TypeEntrainement {
                    Id  = cbx_TypeEntrainement.SelectedValue.ToString().Trim(),
                    Nom = cbx_TypeEntrainement.Text.Trim()
                };

                if (laComboNbtour.SelectedItem != null)
                {
                    lexercices.leNbdeFois = Convert.ToInt32(laComboNbtour.SelectedItem.ToString());
                }
                else
                {
                    lexercices.leNbdeFois = 0;
                }
                lentrainement.lesTours[numeroTour - 1].lesExercices.Add(lexercices);
                lexercices.sequence = p + 1;
                root.Nodes[numeroTour - 1].Nodes.Add(lexercices.Nom);
            }

            if (NumCheck <= Convert.ToInt32(cbx_nbTours.SelectedItem.ToString()))
            {
                AddTour();
            }
        }
Beispiel #28
0
        /// <summary>
        ///     Delete exercice
        /// </summary>
        /// <param name="no">Id exercice</param>
        public void DeleteExercice(int no)
        {
            // charger l'exercice
            Exercice exercice = _exerciceRepository.Get(no);

            if (exercice == null)
            {
                throw new InvalidOperationException("Exercice invalide!");
            }
            if (Exercice.Id == no)
            {
                throw new ApplicationException("Impossible du supprimer l'exercice courant");
            }
            // check if exercice has declaration

            //if (_declarationRepository.ExerciceHasDeclaration(no))
            //    throw new InvalidOperationException("Opération invalide! l'exercice contient des déclarations");
            if (Societe.CurrentExerciceNo == no)
            {
                throw new InvalidOperationException("Exercice est en cours d'utilisation!");
            }
            // remove exercice
            _exerciceRepository.Delete(no);
        }
 // Use this for initialization
 void Start()
 {
     k = new KeyboardInputController(3f);
     e=new ExerciceTest(k);
     k.SetExercice(e);
 }
Beispiel #30
0
 /// <summary>
 /// Constructeur
 /// </summary>
 /// <param name="exercice">l'exercice en cours</param>
 public MotsMelangeViewModel(Exercice exercice) : base(exercice)
 {
     _random = new Random();
 }
 public void SetExercice(Exercice exercice)
 {
     this.exercice = exercice;
 }
        /// <summary>
        /// Met à jour l'état en bas pour l'utilisateur
        /// </summary>
        /// <param name="typeEtat">texte : "Filtrage", "Ajout", "Modification", "Suppression", "Look", "" ("" = Chargement)</param>
        /// <param name="dao">un objet Commande_Fournisseur soit pour l'ajouter au listing, soit pour afficher qui a été modifié ou supprimé</param>
        public void MiseAJourEtat(string typeEtat, Exercice lib)
        {
            //Je racalcul le nombre max d'élements
            this.recalculMax();
            //En fonction de l'libion, j'affiche le message
            if (typeEtat == "Filtrage")
            {
                ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "filtrage des exercices terminé : " + this.listExercice.Count() + " / " + this.max;
            }
            else if (typeEtat == "Ajout")
            {
                //J'ajoute la commande_fournisseur dans le linsting
                this.listExercice.Add(lib);
                //Je racalcul le nombre max d'élements après l'ajout
                this.recalculMax();
                ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Ajout d'un exercice dénommé '" + lib.Date_Debut + "' effectué avec succès. Nombre d'élements : " + this.listExercice.Count() + " / " + this.max;
            }
            else if (typeEtat == "Modification")
            {
                //Je raffraichis mon datagrid
                this._DataGridMain.Items.Refresh();
                ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Modification d'un exercice dénommé : '" + lib.Date_Debut + "' effectuée avec succès. Nombre d'élements : " + this.listExercice.Count() + " / " + this.max;
            }
            else if (typeEtat == "Suppression")
            {
                //Je supprime de mon listing l'élément supprimé
                this.listExercice.Remove(lib);
                //Je racalcul le nombre max d'élements après la suppression
                this.recalculMax();
                ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Suppression d'un exercice dénommé : '" + lib.Date_Debut + "' effectuée avec succès. Nombre d'élements : " + this.listExercice.Count() + " / " + this.max;
            }
            else if (typeEtat == "Look")
            {

            }
            else
            {
                ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Chargement des exercices terminé : " + this.listExercice.Count() + " / " + this.max;
            }
            //Je retri les données dans le sens par défaut
            this.triDatas();
            //J'arrete la progressbar
            ((App)App.Current)._theMainWindow.parametreMain.progressBarMainWindow.IsIndeterminate = false;
        }
Beispiel #33
0
 /// <summary>
 /// Constructeur
 /// </summary>
 /// <param name="exercice">l'exercice</param>
 public JeuHoraireViewModel(Exercice exercice) : base(exercice)
 {
     _random = new Random();
 }
        /// <summary>
        /// Ajoute une nouvelle Exercice à la liste à l'aide d'une nouvelle fenêtre
        /// </summary>
        public Exercice Add()
        {
            //Affichage du message "ajout en cours"
            ((App)App.Current)._theMainWindow.parametreMain.progressBarMainWindow.IsIndeterminate = true;
            ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Ajout d'un exercice en cours ...";

            //Initialisation de la fenêtre
            ExerciceWindow exerciceWindow = new ExerciceWindow();

            //Création de l'objet temporaire
            Exercice tmp = new Exercice();

            //Mise de l'objet temporaire dans le datacontext
            exerciceWindow.DataContext = tmp;

            //booléen nullable vrai ou faux ou null
            bool? dialogResult = exerciceWindow.ShowDialog();

            if (dialogResult.HasValue && dialogResult.Value == true)
            {
                //Si j'appuie sur le bouton Ok, je renvoi l'objet banque se trouvant dans le datacontext de la fenêtre
                return (Exercice)exerciceWindow.DataContext;
            }
            else
            {
                try
                {
                    //On détache la commande
                    ((App)App.Current).mySitaffEntities.Detach((Exercice)exerciceWindow.DataContext);
                }
                catch (Exception)
                {
                }

                //Si j'appuie sur le bouton annuler, je préviens que j'annule mon ajout
                ((App)App.Current)._theMainWindow.parametreMain.progressBarMainWindow.IsIndeterminate = false;
                this.recalculMax();
                ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Ajout d'un exercice annulé : " + this.listExercice.Count() + " / " + this.max;

                return null;
            }
        }
Beispiel #35
0
 /// <summary>
 /// Constructeur
 /// </summary>
 protected AbstractGame(Exercice exercice)
 {
     ExerciceEnCours = exercice;
     Initialization  = InitializeAsync();
     Difficulte      = exercice.Difficulte;
 }