public ActionResult Create(FormationViewModel FVM)
        {
            try
            {
                Formation f = new Formation();

                f.CodeFormateur = FVM.FormateurViewModel.CodeFormateur;
                //taw narj3oulha
                Formateur formateur = FrS.GetById(FVM.FormateurViewModel.CodeFormateur);
                f.Formateur      = formateur;
                f.Date           = FVM.Date;
                f.Description    = FVM.Description;
                f.Duree          = FVM.Duree;
                f.Prix           = FVM.Prix;
                f.TypeFormation  = FVM.TypeFormation;
                f.NomFormation   = FVM.NomFormation;
                f.NbParticipants = FVM.NbParticipants;

                FS.Add(f);
                FS.Commit();
                // TODO: Add insert logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        // GET: Formation
        public ActionResult Index(int id)
        {
            List <FormationViewModel> formationViewModels = new List <FormationViewModel>();

            foreach (var item in FS.getTodayFormation())
            {
                FormationViewModel FVM = new FormationViewModel()
                {
                    CodeFormateur  = item.CodeFormateur,
                    Date           = item.Date,
                    Description    = item.Description,
                    Duree          = item.Duree,
                    IdFormation    = item.IdFormation,
                    NbParticipants = item.NbParticipants,
                    NomFormation   = item.NomFormation,
                    Prix           = item.Prix,
                    TypeFormation  = item.TypeFormation
                };
                formationViewModels.Add(FVM);
            }

            ViewBag.idCandidat = id;

            return(View(formationViewModels));
        }
        // GET: Formation
        public ActionResult DetailFormation(string categorie, string nomSeo)
        {
            var vm = new FormationViewModel();

            vm.Categorie = categorie;
            vm.NomSeo    = nomSeo;
            return(View(vm));
        }
Esempio n. 4
0
 public ActionResult Edit(FormationViewModel frmViewModel)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     _repository.Update(Mapper.Map <Formation>(frmViewModel));
     return(RedirectToAction("Index"));
 }
        //
        // GET: /Formation/Create

        public ActionResult Create()
        {
            FormationViewModel fVm = new FormationViewModel();

            fVm.Cursus = repoCursus.Cursus;
            fVm.Site   = repoSite.Sites;

            return(View(fVm));
        }
Esempio n. 6
0
        public IActionResult Ethique()
        {
            var quey = _context.GCSMS_Formation.Single(x => x.Categorie == "Ethique" && x.Position == 2);
            var form = new FormationViewModel()
            {
                Content = quey.Content
            };

            return(View(form));
        }
Esempio n. 7
0
        public IActionResult EditeContenuEthique()
        {
            var query  = _context.GCSMS_Formation.SingleOrDefault(x => x.Categorie == "Ethique" && x.Position == 2);
            var requet = new FormationViewModel
            {
                Content = query.Content,
                Id      = query.Id
            };

            return(View(requet));
        }
Esempio n. 8
0
        public async Task <IActionResult> EditFormation(FormationViewModel model)
        {
            List <PlayerPosition> playerPositions = await _FormationService.GetAllPlayerPositions(model.Id);

            model.PlayerPositions = playerPositions;
            model.Positions       = GetAllPositions();
            if (ModelState.IsValid)
            {
                List <Player> players = await _PlayerService.GetAllPlayers(model.TeamId);

                List <Position> submittedPositions = new List <Position>();
                foreach (var player in players)
                {
                    Position position = (Position)Enum.Parse(typeof(Position), Request.Form[player.Id.ToString()], true);
                    submittedPositions.Add(position);
                }
                var errors = _FormationService.CheckFormation(submittedPositions);

                if (errors.Count == 0)
                {
                    Formation formation = new Formation()
                    {
                        Id     = model.Id,
                        TeamId = model.TeamId,
                        Name   = model.Name
                    };
                    await _FormationService.EditFormation(formation);

                    foreach (var pp in playerPositions)
                    {
                        Position       position       = (Position)Enum.Parse(typeof(Position), Request.Form[pp.PlayerId.ToString()], true);
                        PlayerPosition playerPosition = new PlayerPosition()
                        {
                            Id          = pp.Id,
                            PlayerId    = pp.PlayerId,
                            Position    = position,
                            FormationId = model.Id
                        };
                        await _FormationService.EditPlayerPosition(playerPosition);
                    }
                    return(RedirectToAction("TeamHome", "Team", new { id = model.TeamId }));
                }
                foreach (var error in errors)
                {
                    ModelState.AddModelError("", error);
                }

                return(View(model));
            }
            return(View(model));
        }
        public ActionResult Create(FormationViewModel fVm)
        {
            try
            {
                repository = new EFFormationRepository();
                repository.SaveFormation(fVm.Formation);

                return(RedirectToRoute("list_formation"));
            }
            catch
            {
                return(RedirectToRoute("create_formation"));
            }
        }
Esempio n. 10
0
        public async Task <IActionResult> AddFormation(FormationViewModel model)
        {
            List <Player> players = await _PlayerService.GetAllPlayers(model.TeamId);

            model.Players   = players;
            model.Positions = GetAllPositions();

            if (ModelState.IsValid)
            {
                List <Position> submittedPositions = new List <Position>();
                foreach (var player in players)
                {
                    Position position = (Position)Enum.Parse(typeof(Position), Request.Form[player.Id.ToString()], true);
                    submittedPositions.Add(position);
                }
                var errors = _FormationService.CheckFormation(submittedPositions);
                //check if there are exactly 11 field players and only 1 keeper
                if (errors.Count == 0)
                {
                    Formation formation = new Formation()
                    {
                        Name   = model.Name,
                        TeamId = model.TeamId
                    };
                    int id = await _FormationService.AddFormation(formation);

                    foreach (var player in players)
                    {
                        Position       position = (Position)Enum.Parse(typeof(Position), Request.Form[player.Id.ToString()], true);
                        PlayerPosition pp       = new PlayerPosition()
                        {
                            PlayerId    = player.Id,
                            Position    = position,
                            FormationId = id
                        };
                        await _FormationService.AddPlayerPosition(pp);
                    }
                    return(RedirectToAction("TeamHome", "Team", new { id = model.TeamId }));
                }
                foreach (var error in errors)
                {
                    ModelState.AddModelError("", error);
                }

                return(View(model));
            }
            return(View(model));
        }
Esempio n. 11
0
        public async Task <IActionResult> EditeContenuEthique(FormationViewModel vm)
        {
            var form = _context.GCSMS_Formation.Single(p => p.Id == vm.Id && p.Position == 2);

            try
            {
                form.Content = vm.Content;

                await _context.SaveChangesAsync();

                return(RedirectToAction("Ethique", "Home", new { confirm = "ok" }));
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 12
0
        public ActionResult Create(FormationViewModel frmViewModel, HttpPostedFileBase fileUpload)
        {
            try {
                if (!ModelState.IsValid)
                {
                    return(View());
                }
                if (fileUpload != null && fileUpload.ContentLength > 0)
                {
                    frmViewModel.FrmImage = ImageConverter.ConvertToBytes(fileUpload);
                }

                _repository.Add(Mapper.Map <Formation>(frmViewModel));

                return(RedirectToAction("Index"));
            } catch (RetryLimitExceededException) {
                ModelState.AddModelError(string.Empty, "Unable to save changes. Try again, and if the problem persists see your system administrator.");
            }

            return(View(frmViewModel));
        }
Esempio n. 13
0
        // GET: Formation/Details/5
        public ActionResult Details(int id, int idCandidat)
        {
            Formation f = FS.GetById(id);

            if (f.NbParticipants > 0)
            {
                ViewBag.confirmed = true;
                f.NbParticipants -= 1;
                FS.Update(f);
                FS.Commit();
            }
            else
            {
                ViewBag.confirmed = false;
            }

            FormationViewModel formation = new FormationViewModel()
            {
                CodeFormateur  = f.CodeFormateur,
                Date           = f.Date,
                Description    = f.Description,
                Duree          = f.Duree,
                IdFormation    = f.IdFormation,
                NbParticipants = f.NbParticipants,
                NomFormation   = f.NomFormation,
                Prix           = f.Prix,
                TypeFormation  = f.TypeFormation
            };

            Candidat c = CS.GetById(idCandidat);

            ViewBag.nomCandidat    = c.Nom;
            ViewBag.prenomCandidat = c.Prenom;

            return(View(formation));
        }
Esempio n. 14
0
 public override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     myVieWModel = new FormationViewModel(DbManager.Instance.FormationDbManager);
     // Create your fragment here
 }
Esempio n. 15
0
        public void SetPresentation()
        {
            lbSelectedFiles.Items.Clear();

            foreach (PresentationPlay pPlay in Presentation.Plays)
            {
                string strStandardFilePath = new System.IO.FileInfo(pPlay.PlayPath).FullName;

                if (strStandardFilePath.EndsWith(".Ttl", true, null))
                {
                    Title title = new Title(strStandardFilePath);

                    TitleViewModel tvm = new TitleViewModel(title, null);

                    lbSelectedFiles.Items.Add(tvm);
                }
                else
                {
                    if (strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Offensive\Formation\Offensive") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Defensive\Formation\Offensive") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Kicks\Formation\Offensive"))
                    {
                        Formation formation = new Formation(strStandardFilePath);

                        FormationViewModel fvm = new FormationViewModel(formation, null);

                        lbSelectedFiles.Items.Add(fvm);
                    }

                    if (strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Offensive\Formation\Defensive") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Defensive\Formation\Defensive") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Kicks\Formation\Defensive"))
                    {
                        Formation formation = new Formation(strStandardFilePath);

                        FormationViewModel fvm = new FormationViewModel(formation, null);

                        lbSelectedFiles.Items.Add(fvm);
                    }

                    if (strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Offensive\Formation\Kicks") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Defensive\Formation\Kicks") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Kicks\Formation\Kicks"))
                    {
                        Formation formation = new Formation(strStandardFilePath);

                        FormationViewModel fvm = new FormationViewModel(formation, null);

                        lbSelectedFiles.Items.Add(fvm);
                    }

                    if (strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Offensive\Playbook") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Defensive\Playbook") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Kicks\Playbook"))
                    {
                        Play play = new Play(strStandardFilePath);

                        PlayViewModel pvm = new PlayViewModel(play, null);

                        lbSelectedFiles.Items.Add(pvm);
                    }
                }

                foreach (Object objVideo in pPlay.Videos)
                {
                    if (objVideo.ToString().EndsWith(".ppt", true, null))
                    {
                        PowerPoint ppt = new PowerPoint(objVideo.ToString());

                        PPTViewModel pptVM = new PPTViewModel(ppt, null);

                        lbSelectedFiles.Items.Add(pptVM);
                    }
                    else
                    {
                        VideoCoachingPointInfo vcpi = null;

                        if (!(objVideo is VideoCoachingPointInfo))
                        {
                            vcpi = new VideoCoachingPointInfo(objVideo.ToString());
                        }
                        else
                        {
                            vcpi = objVideo as VideoCoachingPointInfo;
                        }

                        VideoViewModel vvm = new VideoViewModel(vcpi, null);

                        this.lbSelectedFiles.Items.Add(vvm);
                    }
                }
            }
        }
Esempio n. 16
0
        private bool Contains(ViewModel.TreeViewItemViewModel tvivSelect)
        {
            string strSelectPath = string.Empty;

            PlayViewModel      pvmSelect   = tvivSelect as PlayViewModel;
            FormationViewModel fvmSelect   = tvivSelect as FormationViewModel;
            TitleViewModel     tvmSelect   = tvivSelect as TitleViewModel;
            PPTViewModel       pptVMSelect = tvivSelect as PPTViewModel;

            if (pvmSelect != null)
            {
                strSelectPath = pvmSelect.PlayPath;
            }

            if (fvmSelect != null)
            {
                strSelectPath = fvmSelect.FormationPath;
            }

            if (tvmSelect != null)
            {
                strSelectPath = tvmSelect.TitlePath;
            }

            if (pptVMSelect != null)
            {
                strSelectPath = pptVMSelect.PptPath;
            }

            if (strSelectPath != string.Empty)
            {
                foreach (object o in lbSelectedFiles.Items)
                {
                    if (o is PlayViewModel)
                    {
                        PlayViewModel pvm = o as PlayViewModel;

                        if (strSelectPath == pvm.PlayPath)
                        {
                            return(true);
                        }
                    }

                    if (o is FormationViewModel)
                    {
                        FormationViewModel fvm = o as FormationViewModel;

                        if (strSelectPath == fvm.FormationPath)
                        {
                            return(true);
                        }
                    }

                    if (o is TitleViewModel)
                    {
                        TitleViewModel tvm = o as TitleViewModel;

                        if (strSelectPath == tvm.TitlePath)
                        {
                            return(true);
                        }
                    }

                    if (o is PPTViewModel)
                    {
                        PPTViewModel pptVM = o as PPTViewModel;

                        if (strSelectPath == pptVM.PptPath)
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }