public override void OnActionExecuted(ActionExecutedContext filterContext) { ParticipantRepository participantRepository = new ParticipantRepository(); string userName = Membership.GetUserNameByEmail(filterContext.HttpContext.User.Identity.Name); Guid userId = Guid.Parse(Membership.GetUser(userName).ProviderUserKey.ToString()); filterContext.HttpContext.Session["currentTube"] = participantRepository.UserIsInTube(userId); }
public Service(OficiuRepository oficiuRepository, ParticipantRepository participantRepository, ProbaRepository probaRepository, InscriereRepository inscriereRepository) { this.oficiuRepository = oficiuRepository; this.participantRepository = participantRepository; this.probaRepository = probaRepository; this.inscriereRepository = inscriereRepository; }
public ActionResult Participants() { List <Participant> model = new ParticipantRepository().GetParticipants(this.CurrentFilm.FilmSubmissionId); ViewBag.Message = _message; return(View(model)); }
public ParticipantService(IDbContext dbContext, IMailService mailService) { _dbContext = dbContext; _repository = new ParticipantRepository(_dbContext); _mailService = mailService; }
public static Participant GetParticipantDetails(string emailID) { DataTable participantDataTable; participantDataTable = ParticipantRepository.GetParticipantDetails(emailID); return(InitializeParticipant(participantDataTable)); }
public ActionResult GetAll() { ParticipantRepository repository = new ParticipantRepository(); ModelState.Clear(); return(View(repository.GetAll())); }
static void Main(string[] args) { BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider(); serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider(); IDictionary props = new Hashtable(); props["port"] = 55555; TcpChannel channel = new TcpChannel(props, clientProv, serverProv); ChannelServices.RegisterChannel(channel, false); IDictionary <string, string> pr = new SortedList <string, string>(); pr.Add("ConnectionString", "URI=file:ConcursInot.db"); OficiuRepository oficiu = new OficiuRepository(pr); ParticipantRepository participant = new ParticipantRepository(pr); ProbaRepository proba = new ProbaRepository(pr); InscriereRepository inscriere = new InscriereRepository(pr); Service service = new Service(oficiu, participant, proba, inscriere); var server = new ServerImplementation(service); RemotingServices.Marshal(server, "Server"); //RemotingConfiguration.RegisterWellKnownServiceType(typeof(ServerImplementation), "Server", // WellKnownObjectMode.Singleton); Console.WriteLine("Server started ..."); Console.WriteLine("Press <enter> to exit..."); Console.ReadLine(); }
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); }
private async Task <Participant> GetContact(Guid id) { using var unitOfWork = _provider.GetService <UnitOfWork>(); var participantRepository = new ParticipantRepository(unitOfWork); unitOfWork.Begin(); return(await participantRepository.GetById(id)); }
public Service(AngajatRepository angajatRepository, CursaRepository cursaRepository, EchipaRepository echipaRepository, InscriereRepository inscriereRepository, ParticipantRepository participantRepository) { this.angajati = angajatRepository; this.curse = cursaRepository; this.echipe = echipaRepository; this.inscrieri = inscriereRepository; this.participanti = participantRepository; }
// GET: Participant/Edit/5 public ActionResult Edit(int id) { ParticipantRepository repository = new ParticipantRepository(); ParticipantModel model = repository.GetById(id); return(View(model)); }
/// <summary> /// Constructor of VideosConroller /// </summary> /// <param name="videoRepository">videoRepository</param> /// <param name="participantRepository">participantRepository</param> /// <param name="urlHelper">UrlHelper</param> /// <param name="propertyMappingService">propertyMappingService which helps to map the sort order of fields of model to the database field</param> /// <param name="typeHelperService">typehelper service which helps to know whether a property exists ina type</param> public VideosController(VideoRepository videoRepository, ParticipantRepository participantRepository, IUrlHelper urlHelper, IPropertyMappingService propertyMappingService, ITypeHelperService typeHelperService) { this.videoRepository = videoRepository; this.participantRepository = participantRepository; this.propertyMappingService = propertyMappingService; this.typeHelperService = typeHelperService; this.urlHelper = urlHelper; }
public ParticipantsController() { var connectionStr = Settings.GetStringDB(); this._participantsRepository = new ParticipantRepository(connectionStr); _userActionRepository = new UserActionRepository(connectionStr); ur = new UserRepository(connectionStr); }
public ParticipantService(ParticipantRepository participantRepository) { if (participantRepository == null) { throw new ArgumentNullException(nameof(participantRepository)); } _participantRepository = participantRepository; }
public ServiceImpl(UserRepository userRepo, ResultRepository resultRepo, ParticipantRepository participantRepo, StageRepository stageRepo) { this.userRepo = userRepo; this.resultRepo = resultRepo; this.participantRepo = participantRepo; this.stageRepo = stageRepo; loggedClients = new Dictionary <int, IObserver>(); }
private async Task UpdateParticipants(TeamViewModel teamViewModel, int managerId) { List <Participant> participants = null; participants = await ParticipantRepository.All.Where(p => p.TeamId == teamViewModel.Id).ToListAsync(); // if the team didn't have any participants before, just map all participants over if (participants.Count == 0) { // map any player information foreach (ParticipantViewModel participant in teamViewModel.Players) { Participant newParticipant = null; try { newParticipant = Mapper.Map <Participant>(participant); } catch (Exception e) { var exceptionMessage = e.Message; } newParticipant.TeamId = teamViewModel.Id; ParticipantRepository.InsertOrUpdate(newParticipant); } } else { // if the team had participants, update/add participant information foreach (ParticipantViewModel participant in teamViewModel.Players) { var existingParticipant = participants.Find(p => p.Id == participant.Id); // if found, then update if (existingParticipant != null) { Mapper.Map(participant, existingParticipant); existingParticipant.TeamId = existingParticipant.Team.Id; ParticipantRepository.InsertOrUpdate(existingParticipant); } else // insert new participant { var newParticipant = Mapper.Map <Participant>(participant); newParticipant.TeamId = teamViewModel.Id; ParticipantRepository.InsertOrUpdate(newParticipant); } } // check for deleted players foreach (Participant participant in participants) { if (teamViewModel.Players.Count(p => p.Id == participant.Id) == 0) { participant.IsDeleted = true; participant.DeletedOn = DateTime.Now; participant.DeletedBy = managerId; ParticipantRepository.InsertOrUpdate(participant); } } } }
public Gestacourse() { InitializeComponent(); Cr = new CourseRepository(); Rr = new ResultatRepository(); Pr = new ParticipantRepository(); ListeCourses = new List <Course>(); Initialisation(); }
public UnitOfWork(AboveAllContext db) { _context = db; Participants = new ParticipantRepository(db); Events = new EventRepository(db); Category = new CategoryRespository(db); Receipts = new ReceiptRepository(db); Users = new UserRepository(db); }
public BaseTestController() { am = new Mock <IAuthorizeService>(); am.Setup(a => a.isDictaatOwner(It.IsAny <string>(), It.IsAny <string>())) .Returns(Task.FromResult(true)); am.Setup(a => a.IsDictaatContributer(It.IsAny <string>(), It.IsAny <string>())) .Returns(Task.FromResult(true)); //mock user store var userStore = new Mock <IUserStore <ApplicationUser> >(); var umm = new Mock <UserManager <ApplicationUser> >(userStore.Object, null, null, null, null, null, null, null, null); _user = new TestPrincipal(new Claim[] { new Claim(ClaimTypes.Name, "ssmulder"), new Claim(ClaimTypes.NameIdentifier, "06c52646-53fd-4a03-8009-d2ad921e954e") }); _config = new Mock <IOptions <ConfigVariables> >(); ConfigVariables vars = new ConfigVariables() { DictaatRoot = "//resources", PagesDirectory = "pages", DictaatConfigName = "dictaat.config.json", DictatenDirectory = "dictaten", TemplatesDirectory = "templates", MenuConfigName = "nav-menu.json", ImagesDirectory = "images", StyleDirectory = "styles", }; _config.Setup(c => c.Value).Returns(vars); //database var options = new DbContextOptionsBuilder <WebdictaatContext>() .UseSqlServer("Data Source=(localdb)\\webdictaat;Initial Catalog=webdictaat.test;Integrated Security=False;User ID=ssmulder;Password=password;Connect Timeout=60;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False") .Options; _context = new WebdictaatContext(options); //managers and factories _dictaatFactory = new Mock <IDictaatFactory>(); _dictaatFactory.Setup(df => df.GetDictaat(It.IsAny <string>())).Returns(new Domain.Dictaat() { Name = "Test" }); _dictaatFactory.Setup(df => df.CopyDictaat(It.IsAny <string>(), It.IsAny <DictaatDetails>())).Returns(new Domain.Dictaat() { Name = "Test2" }); _analytics = new Mock <IGoogleAnalytics>(); //repos _assignmentRepo = new AssignmentRepository(_context, null); _dictaatRepo = new DictaatRepository(_config.Object, _analytics.Object, _dictaatFactory.Object, _context); _participantRepo = new ParticipantRepository(_context, umm.Object); }
protected void Session_End(Object sender, EventArgs e) { string userName = Membership.GetUserNameByEmail(User.Identity.Name); Guid userId = Guid.Parse(Membership.GetUser(userName).ProviderUserKey.ToString()); ParticipantRepository participantRepository = new ParticipantRepository(); participantRepository.RemoveUserFromAllTubes(userId); HttpContext.Current.Cache[userId.ToString() + "online"] = false; }
public ActionResult SaveParticipants(List <string> Actor, List <string> Director, List <string> Producer, List <string> Writer, string NextPage) { bool res = new ParticipantRepository().SaveParticipants(this.CurrentFilm.FilmSubmissionId, Actor, Director, Producer, Writer, this.User.UserId); if (!String.IsNullOrEmpty(NextPage)) { return(Redirect(NextPage)); } return(RedirectToAction("Participants", new { message = "Partisipants have been saved" })); }
public Importation(int mode, Course laCourse, Button bouton) { InitializeComponent(); choix = mode; course = laCourse; Pr = new ParticipantRepository(); Rr = new ResultatRepository(); cr = new CourseRepository(); BoutonAModifier = bouton; Ofd = new OpenFileDialog(); }
public UnitOfWork(PokiContext context) { _context = context; Participants = new ParticipantRepository(_context); Groups = new GroupsRepository(_context); ParticipantsInGroup = new ParticipantsInGroupRepository(_context); Results = new ResultsRepository(_context); ProperResultsQuestion = new ProperResultsQuestionRepository(_context); ProperResults = new ProperResultRepository(_context); Question = new QuestionRepository(_context); }
public OrganizationController() { db = new OrganizationDbEntities(); orgrep = new OrganizationRepository(db); imagerep = new ImageRepository(db); orgimagerep = new OrgImageRepository(db); partrep = new ParticipantRepository(db); orgparticipantrep = new OrganizationParticipantRepository(db); orgcommentrep = new OrganizationCommentRepository(db); commentrep = new CommentRepository(db); }
public ProjectController() { string connectionString = Settings.GetStringDB(); _localizationProjectRepository = new LocalizationProjectRepository(connectionString); _localizationProjectsLocalesRepository = new LocalizationProjectsLocalesRepository(connectionString); _localeRepository = new LocaleRepository(connectionString); _userActionRepository = new UserActionRepository(connectionString); ur = new UserRepository(connectionString); _participantsRepository = new ParticipantRepository(connectionString); _roleRepository = new RoleRepository(connectionString); }
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)); }
// 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)); }
public Event Create(string title, string description, string name, string email, bool addOrganizerAsParticipant) { var dbEvent = _repository.Create(title, description, name, email); // by default, add organizer as participant if (addOrganizerAsParticipant) { var dbParticipant = new ParticipantRepository(_dbContext).Add(dbEvent.ID, name, email); dbEvent.Participants.Add(dbParticipant); } return(EntityMapper.Map(dbEvent)); }
public static bool CheckParticipantTTID(int ttid) { DataTable participantDataTable = ParticipantRepository.GetParticipantDetails(ttid); if (participantDataTable.Rows.Count == 0) { return(false); } else { return(true); } }
public void Init() { // IoC in EF var context = new TestContext(); var uow = new UnitOfWork(context); _repo = new ParticipantRepository(uow); // arrange data for all tests _participants = Builder <Participant> .CreateListOfSize(4).WhereAll().Do(x => x.IsActive = true).Build().ToList(); context.Participants.AddRange(_participants); }
public ActionResult Index(Participant newParticipant) { try { var repo = new ParticipantRepository(); repo.Add(newParticipant); SendEmails(newParticipant); return(RedirectToAction("Betaling")); } catch (Exception ex) { return(View("Create")); } }
public override void OnActionExecuting(ActionExecutingContext filterContext) { var currentRouteValueDictionary = filterContext.Controller.ControllerContext.RouteData.Values; Tube tube = filterContext.HttpContext.Session["currentTube"] as Tube; if (tube == null) { ParticipantRepository participantRepository = new ParticipantRepository(); string userName = Membership.GetUserNameByEmail(filterContext.HttpContext.User.Identity.Name); Guid userId = Guid.Parse(Membership.GetUser(userName).ProviderUserKey.ToString()); tube = participantRepository.UserIsInTube(userId); } if (tube != null) { if (tube.TubeMode == TubeMode.Opened) { var newRouteValueDictionary = new RouteValueDictionary { {"controller", "Tube"}, {"action", "Index"}, {"tubeId", tube.TubeId} }; if (currentRouteValueDictionary["controller"].ToString() != newRouteValueDictionary["controller"].ToString() || currentRouteValueDictionary["action"].ToString() != newRouteValueDictionary["action"].ToString()) filterContext.Result = new RedirectToRouteResult(newRouteValueDictionary); } else if (tube.TubeMode == TubeMode.FirstPitch || tube.TubeMode == TubeMode.SecondPitch || tube.TubeMode == TubeMode.ThirdPitch || tube.TubeMode == TubeMode.FourthPitch || tube.TubeMode == TubeMode.FifthPitch) { var newRouteValueDictionary = new RouteValueDictionary { {"controller", "Tube"}, {"action", "StartPitch"}, {"mode", (int)tube.TubeMode} }; if (currentRouteValueDictionary["controller"].ToString() != newRouteValueDictionary["controller"].ToString() || currentRouteValueDictionary["action"].ToString() != newRouteValueDictionary["action"].ToString()) filterContext.Result = new RedirectToRouteResult(newRouteValueDictionary); } else if (tube.TubeMode == TubeMode.Nominations) { BaseRepository<Nomination> nominationRepository = new BaseRepository<Nomination>(); PersonRepository personRepository = new PersonRepository(); var user = filterContext.HttpContext.User; Guid userId = (Guid)Membership.GetUser(Membership.GetUserNameByEmail(user.Identity.Name)).ProviderUserKey; var investors = nominationRepository.FirstOrDefault(n => n.InvestorId == userId && n.TubeId == tube.TubeId); var newRouteValueDictionary = new RouteValueDictionary(); newRouteValueDictionary.Add("controller", "Tube"); string roleName = personRepository.GetRoleName(userId); if(roleName == "Investor" && investors == null) newRouteValueDictionary.Add("action", "Nomination"); else newRouteValueDictionary.Add("action", "Results"); newRouteValueDictionary.Add("tubeId", tube.TubeId); if (currentRouteValueDictionary["controller"].ToString() != newRouteValueDictionary["controller"].ToString() || currentRouteValueDictionary["action"].ToString() != newRouteValueDictionary["action"].ToString()) filterContext.Result = new RedirectToRouteResult(newRouteValueDictionary); } filterContext.HttpContext.Session["currentTube"] = tube; } base.OnActionExecuting(filterContext); }