Ejemplo n.º 1
0
        public void GetAllTest()
        {
            string attendu = "Participant : Jean - Course : 300";

            // Sauvegarde du participant
            Participant           p  = new Participant("Jean", "Claude", "jc", new DateTime(2001, 01, 01), "M");
            Participant           p2 = new Participant("Van", "Dam", "vd", new DateTime(2001, 01, 01), "M");
            ParticipantRepository pr = new ParticipantRepository();

            pr.Save(p);
            pr.Save(p2);
            List <Participant> participants = pr.GetAll();

            //Sauvegarde de la course
            Course           c  = new Course(300);
            CourseRepository cr = new CourseRepository();

            cr.Save(c);
            List <Course> courses = cr.GetAll();

            //Sauvegarde du résultat
            Resultat r  = new Resultat(p, c, new DateTime(2001, 10, 10, 00, 00, 23));
            Resultat r2 = new Resultat(p2, c, new DateTime(2001, 10, 10, 00, 00, 55));

            c.ClasserResultats();
            ResultatRepository rr = new ResultatRepository();

            rr.Save(r);
            rr.Save(r2);
            List <Resultat> resultats = rr.GetAll();
            string          sortie    = r.ToString();

            //test
            Assert.AreEqual(attendu, sortie);
        }
Ejemplo n.º 2
0
        public List <Participant> GetParticipantInfoByCourseId(int id)
        {
            var participant            = _participantRepository.GetAll();
            var participantsByCourseId = participant.Where(x => x.CourseId == id).ToList();

            return(participantsByCourseId);
        }
Ejemplo n.º 3
0
        public ActionResult GetAll()
        {
            ParticipantRepository repository = new ParticipantRepository();

            ModelState.Clear();
            return(View(repository.GetAll()));
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public async Task <ICollection <ParticipantModel> > GetAll()
        {
            var paricipants = (await _participantRepository.GetAll().ConfigureAwait(false))
                              .Select(AutoMapper.Mapper.Map <ParticipantModel>)
                              .ToList();

            return(paricipants);
        }
Ejemplo n.º 5
0
        // GET: Deal/Create
        public ActionResult Create()
        {
            AuctionRepository     auctionRep     = new AuctionRepository();
            ParticipantRepository participantRep = new ParticipantRepository();
            DealStateRepository   dealStateRep   = new DealStateRepository();
            ItemRepository        itemRep        = new ItemRepository();

            DealModel model = new DealModel
            {
                Auctions   = auctionRep.GetAll(),
                Buyers     = participantRep.GetAll(),
                Sellers    = participantRep.GetAll(),
                DealStates = dealStateRep.GetAll(),
                Items      = itemRep.GetAll()
            };

            return(View(model));
        }
Ejemplo n.º 6
0
        // GET: Deal/Edit/5
        public ActionResult Edit(int id)
        {
            DealRepository        repository     = new DealRepository();
            AuctionRepository     auctionRep     = new AuctionRepository();
            ParticipantRepository participantRep = new ParticipantRepository();
            DealStateRepository   dealStateRep   = new DealStateRepository();
            ItemRepository        itemRep        = new ItemRepository();

            DealModel model = repository.GetById(id);

            model.Auctions   = auctionRep.GetAll();
            model.Buyers     = participantRep.GetAll();
            model.Sellers    = participantRep.GetAll();
            model.DealStates = dealStateRep.GetAll();
            model.Items      = itemRep.GetAll();

            return(View(model));
        }
        // GET: Deal/Create
        public ActionResult NewDeal(int id)
        {
            AuctionRepository     auctionRep     = new AuctionRepository();
            ParticipantRepository participantRep = new ParticipantRepository();
            DealStateRepository   dealStateRep   = new DealStateRepository();
            ItemRepository        itemRep        = new ItemRepository();

            DealModel model = new DealModel
            {
                Auctions   = auctionRep.GetAll(),
                Buyers     = participantRep.GetAll(),
                Sellers    = participantRep.GetAll(),
                DealStates = dealStateRep.GetAll(),
                Items      = itemRep.GetAll("GetAvailableItems")
            };

            ViewBag.Id = id;
            return(View(model));
        }
        // GET: TradingProgress/Create
        public ActionResult Create()
        {
            ParticipantRepository participantRep = new ParticipantRepository();
            DealRepository        dealRep        = new DealRepository();

            TradingProgressModel model = new TradingProgressModel
            {
                Buyers = participantRep.GetAll(),
                Deals  = dealRep.GetAll()
            };

            return(View(model));
        }
Ejemplo n.º 9
0
        public void GetAllTest()
        {
            string attendu = "Jean Claude";

            Participant           p  = new Participant("Jean", "Claude", "jc", new DateTime(2001, 01, 01), "M");
            ParticipantRepository pr = new ParticipantRepository();

            pr.Save(p);
            List <Participant> participants = pr.GetAll();
            string             sorti        = p.ToString();

            Assert.AreEqual(attendu, sorti);
        }
        // GET: TradingProgress/Edit/5
        public ActionResult Edit(int id)
        {
            TradingProgressRepository repository     = new TradingProgressRepository();
            ParticipantRepository     participantRep = new ParticipantRepository();
            DealRepository            dealRep        = new DealRepository();

            TradingProgressModel model = repository.GetById(id);

            model.Buyers = participantRep.GetAll();
            model.Deals  = dealRep.GetAll();

            return(View(model));
        }
Ejemplo n.º 11
0
        public ActionResult CSV()
        {
            var           repo         = new ParticipantRepository();
            var           participants = repo.GetAll();
            StringBuilder sb           = new StringBuilder(participants.Count());

            foreach (var p in participants)
            {
                sb.Append(
                    string.Format("{0};{1};{2};{3};{4};{5};{6};{7};{8};{9};{10};{11}\r\n",
                                  p.Name, p.Sex, p.BornYear, p.Address.Trim().Replace("\r\n", ", "), p.PostalCode, p.City, p.HomePhone, p.ParentName, p.ParentMobile, p.ParentEmail, p.TShirtSize, p.Comments != null ? p.Comments.Trim().Replace("\r\n", " ") : "")
                    );
            }
            return(File(new System.Text.UTF8Encoding().GetBytes(sb.ToString()), "text/csv", "Tilemeldinger.csv"));
        }
Ejemplo n.º 12
0
        public HistoryListViewModel()
        {
            using (var ctx = new YakinikuClubDbContext())
            {
                var reposClubActivity = new ClubActivityRepository(ctx);
                var reposParticipant  = new ParticipantRepository(ctx);
                var reposMember       = new MemberRepository(ctx);

                Mapper.CreateMap <Entity.Shop, ShopViewModel>();

                var list =
                    (from ca in reposClubActivity.GetAll().Include(x => x.Shop)
                     join p in reposParticipant.GetAll() on ca.Times equals p.Times
                     join m in reposMember.GetAll() on p.MemberId equals m.MemberId
                     where ca.StartDate < DateTime.Now
                     orderby ca.Times descending
                     group new { p, m } by new { ca.Times, ca.StartDate, ca.EndDate, ca.Shop, ca.Memo }
                    ).ToList();

                var result =
                    from item in list
                    let memo =
                        (item.Key.Memo + Environment.NewLine +
                         string.Join(Environment.NewLine, item.Select(x => x.m.NickName))
                        ).Trim('\r', '\n')
                        select new HistoryViewModel
                {
                    Times     = item.Key.Times,
                    StartDate = item.Key.StartDate,
                    EndDate   = item.Key.EndDate,
                    Shop      = Mapper.Map <Entity.Shop, ShopViewModel>(item.Key.Shop),
                    Memo      = memo
                };

                Histories = result;
            }
        }
        // GET: AuctionManage/Edit/5
        public ActionResult Start(int id)
        {
            DealRepository          dealRepository        = new DealRepository();
            ParticipantRepository   participantRepository = new ParticipantRepository();
            ItemRepository          itemRepository        = new ItemRepository();
            IEnumerable <DealModel> dealsForAuction       = dealRepository.GetForAuction(id);
            StartViewModel          startViewModel        = new StartViewModel
            {
                deals        = dealsForAuction,
                participants = participantRepository.GetAll()
            };

            ModelState.Clear();
            ViewBag.AuctionId = id;
            if (dealsForAuction.Count() > 0)
            {
                ItemModel firstDealItem = itemRepository.GetById(startViewModel.deals.ElementAt(0).Item_Id);

                ViewBag.startPrice = firstDealItem.StartedPrice;
                ViewBag.dealStep   = firstDealItem.PriceGrowth;
            }

            return(View(startViewModel));
        }
Ejemplo n.º 14
0
        public async Task <ActionResult> Read([DataSourceRequest] DataSourceRequest request)
        {
            var tmp = await _participantRepository.GetAll("Participant", _userManager);

            return(Json(tmp.ToDataSourceResult(request)));
        }
Ejemplo n.º 15
0
        public ActionResult Read([DataSourceRequest] DataSourceRequest request)
        {
            var tmp = _participantRepository.GetAll("Participant");

            return(Json(tmp.ToDataSourceResult(request)));
        }
Ejemplo n.º 16
0
        public int GetAllParticipantsForSearch(int courseId)
        {
            var participants = _participantRepository.GetAll().Where(x => x.CourseId == courseId).ToList();

            return(participants.Count);
        }
Ejemplo n.º 17
0
        public List <Participant> GetAll()
        {
            List <Participant> participantList = _participantRepository.GetAll();

            return(participantList);
        }
Ejemplo n.º 18
0
 public List <Participant> GetAllParticipants()
 {
     return(_participantRepository.GetAll());
 }
Ejemplo n.º 19
0
        public ActionResult CSV()
        {
            var repo = new ParticipantRepository();

            return(View(repo.GetAll()));
        }