コード例 #1
0
ファイル: AppDelegate.cs プロジェクト: ilin61/GoGoGoServer
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Shared = this;

            CommentService.GetInstance().Init();
            ParticipantService.GetInstance().Init();

            UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, false);

            _window = new UIWindow(UIScreen.MainScreen.Bounds);
            //UINavigationBar.Appearance.SetTitleTextAttributes (new UITextAttributes {
            //  TextColor = UIColor.Blue
            //});

            var loginViewController = new LoginViewController();

            _navigation = new UINavigationController(loginViewController);

            _navigation.NavigationBar.TintColor    = UIColor.Blue;
            _navigation.NavigationBar.BarTintColor = UIColor.White;
            _navigation.NavigationBar.Translucent  = false;

            _window.RootViewController = _navigation;
            _window.MakeKeyAndVisible();
            return(true);
        }
コード例 #2
0
 public RaceController(RaceService raceService, GroupService groupService, ParticipantService participantService, TimingValueService timingValueService)
 {
     _raceService        = raceService;
     _groupService       = groupService;
     _participantService = participantService;
     _timingValueService = timingValueService;
 }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: iOgre/CsvReader
        private async Task PopulateGridAsync()
        {
            var service = new ParticipantService(new ParticipantRepository());
            var items   = await service.GetAsync();

            Application.Current.Dispatcher.Invoke(() => { ParticipantsGrid.ItemsSource = items; });
        }
コード例 #4
0
        public void GetQueryable()
        {
            ParticipantService       participantService   = new ParticipantService(fixture.context);
            IQueryable <Participant> participantQueryable = participantService.GetAll();

            Assert.True(participantQueryable.Count() > 0);
        }
コード例 #5
0
ファイル: AnswerService.cs プロジェクト: ReedOnly/fusion-bmt
        public void CreateFollowUpAnswers()
        {
            ParticipantService participantService = new ParticipantService(fixture.context);
            QuestionService    questionService    = new QuestionService(fixture.context);
            AnswerService      answerService      = new AnswerService(fixture.context);

            ProjectService    projectService    = new ProjectService(fixture.context);
            Project           project           = projectService.Create("AnswerService_GetFromQuestionExists");
            EvaluationService evaluationService = new EvaluationService(fixture.context);
            Evaluation        evaluation        = evaluationService.Create("AnswerService_GetFromQuestionExists", project, "");

            Participant             participant = participantService.Create("CreateFollowUpAnswers_id", evaluation, Organization.All, Role.Facilitator);
            QuestionTemplateService qts         = new QuestionTemplateService(fixture.context);
            List <Question>         questions   = questionService.CreateBulk(qts.GetAll().ToList(), evaluation);

            answerService.Create(participant, questions[0], Severity.High, "test_answer_0", Progression.Workshop);
            answerService.Create(participant, questions[1], Severity.High, "test_answer_1", Progression.Workshop);
            answerService.Create(participant, questions[2], Severity.High, "test_answer_2", Progression.Workshop);

            int nAnswersFollowupBefore = answerService.GetAll().Where(a => (a.Progression.Equals(Progression.FollowUp) && a.Question.Evaluation.Equals(evaluation))).Count();
            int nAnswersWorkshop       = answerService.GetAll().Where(a => (a.Progression.Equals(Progression.Workshop) && a.Question.Evaluation.Equals(evaluation))).Count();

            answerService.CreateFollowUpAnswers(evaluation);
            int nAnswersFollowup = answerService.GetAll().Where(a => (a.Progression.Equals(Progression.FollowUp) && a.Question.Evaluation.Equals(evaluation))).Count();

            Assert.Equal(nAnswersFollowupBefore + nAnswersWorkshop, nAnswersFollowup);
        }
コード例 #6
0
        //private readonly IParticipantService _participantService;
        //public ParticipantController(IParticipantService participantService)
        //{
        //    this._participantService = participantService;
        //}
        //public ParticipantController()
        //    : this(new ParticipantService(new ParticipantRepository()))
        //{
        //    CacheManager.SetProvider(new CacheProvider());
        //}


        public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
        {
            context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" });

            IParticipantService _participantService = new ParticipantService(new ParticipantRepository());
            Participant         participantModel    = new Participant();
            Hash baseCrypt = new Hash();

            var    user     = _participantService.GetParticipant(context.UserName, context.UserName);
            string password = baseCrypt.GetHash(context.Password, user.Salt, CypherType.SHA512);

            var participant = _participantService.Authenticate(context.UserName, password, user.Salt);

            if (participant == null)
            {
                context.SetError("invalid_grant", "The user name or password is incorrect.");
                return;
            }

            var identity = new ClaimsIdentity(context.Options.AuthenticationType);

            identity.AddClaim(new Claim(ClaimTypes.Sid, participant.Id.ToString()));
            identity.AddClaim(new Claim("sub", context.UserName));
            identity.AddClaim(new Claim("role", "user"));
            identity.AddClaim(new Claim("participant_Id", participant.Id.ToString()));

            context.Validated(identity);
        }
コード例 #7
0
        public async void List()
        {
            var service = new ParticipantService(_config);

            var result = await service.List();

            Assert.NotNull(result);
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: iOgre/CsvReader
        private static void ShowParticipants()
        {
            var service = new ParticipantService(new ParticipantRepository());

            foreach (var item in service.Get(0, 5))
            {
                Console.WriteLine($"{item.Id};{item.FIO};{item.Birthdate.ToShortDateString()};{item.Email};{item.Phone}");
            }
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: iOgre/CsvReader
        private static async Task ShowParticipantsAsync()
        {
            var service = new ParticipantService(new ParticipantRepository());

            foreach (ParticipantDTO item in await service.GetAsync(0, 5))
            {
                Console.WriteLine($"{item.Id};{item.FIO};{item.Birthdate.ToShortDateString()};{item.Email};{item.Phone}");
            }
        }
コード例 #10
0
 public ServerImpl(AgeCategoryService ageCategoryService, TrialService trialService, UserService userService,
                   ParticipantService participantService)
 {
     this._ageCategoryService = ageCategoryService;
     this._trialService       = trialService;
     this._userService        = userService;
     this._participantService = participantService;
     this._loggedClients      = new Dictionary <string, IServerStreamWriter <Response> >();
 }
コード例 #11
0
        public IActionResult Info(int id)
        {
            var participant = ParticipantService
                              .Include(t => t.User)
                              .Include(t => t.SkillWorkers)
                              .FindById(id);

            return(View(participant));
        }
コード例 #12
0
        private void LoadData()
        {
            Participant faculty = new Participant()
            {
            };
            IParticipant facultyObj = new ParticipantService(new Data.WpfDbContext());

            ParticipantDetails = new ObservableCollection <Participant>(facultyObj.GetDetails());
        }
コード例 #13
0
        /// <summary>
        /// Все участники
        /// </summary>
        /// <returns></returns>
        public IActionResult All()
        {
            var model = ParticipantService
                        .Include(t => t.SkillWorkers)
                        .Include(t => t.Projects)
                        .Include(t => t.User)
                        .FindAll();

            return(View(model.ToList()));
        }
コード例 #14
0
        public void AddParticipant(object parameter)
        {
            Participant participant = new Participant()
            {
                Id = id, Name = name, DateOfBirth = dob, Batchid = batchId, CourseRegistered = course, DateOfRegistration = registration
            };
            IParticipant participantObj = new ParticipantService(new Data.WpfDbContext());

            participantObj.AddParticipant(participant);
        }
コード例 #15
0
 public AuthService(
     IHttpContextAccessor contextAccessor,
     ParticipantService participantService,
     EvaluationService evaluationService
     )
 {
     _contextAccessor    = contextAccessor;
     _participantService = participantService;
     _evaluationService  = evaluationService;
 }
コード例 #16
0
        public void GetAzureIdNotExists()
        {
            EvaluationService evaluationService = new EvaluationService(_context);
            Evaluation        evaluation        = evaluationService.GetAll().First();

            ParticipantService participantService = new ParticipantService(_context);
            string             azureUniqueId      = "get_azure_unique_id_not_exists";

            Assert.Throws <NotFoundInDBException>(() => participantService.GetParticipant(azureUniqueId, evaluation));
        }
コード例 #17
0
ファイル: Console.cs プロジェクト: Jidou/schletter-timing
 public Console(IConfiguration configuration, SaveLoad repo, TimingValueService timingValueService, RaceService raceService, ParticipantService participantService, GroupService groupService, CategoryService categoryService, ClassService classService)
 {
     _configuration      = configuration;
     _repo               = repo;
     _timingValueService = timingValueService;
     _raceService        = raceService;
     _participantService = participantService;
     _groupService       = groupService;
     _categoryService    = categoryService;
     _classService       = classService;
 }
コード例 #18
0
 public async Task <List <MeetingDto> > GetMeetingsForParticipant(int participantId)
 {
     try
     {
         return(await ParticipantService.GetMeetingsForParticipant(participantId));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }
コード例 #19
0
        public void CreateGetsCorrectEvaluationId()
        {
            ParticipantService participantService = new ParticipantService(_context);
            EvaluationService  evaluationService  = new EvaluationService(_context);
            Evaluation         evaluation         = evaluationService.GetAll().First();

            string      evaluationIdBefore = evaluation.Id;
            Participant participant        = participantService.Create("CreateGetsCorrectEvaluationId_id", evaluation, Organization.Engineering, Role.Participant);
            string      evaluationIdAfter  = participant.Evaluation.Id;

            Assert.Equal(evaluationIdBefore, evaluationIdAfter);
        }
コード例 #20
0
        public void GetExist()
        {
            EvaluationService evaluationService = new EvaluationService(_context);
            Evaluation        evaluation        = evaluationService.GetAll().First();

            ParticipantService participantService = new ParticipantService(_context);
            Participant        participantCreate  = participantService.Create("GetExist_id", evaluation, Organization.Engineering, Role.Participant);

            Participant participantGet = participantService.GetParticipant(participantCreate.Id);

            Assert.Equal(participantCreate, participantGet);
        }
コード例 #21
0
        public void Delete()
        {
            EvaluationService evaluationService = new EvaluationService(_context);
            Evaluation        evaluation        = evaluationService.GetAll().First();

            ParticipantService participantService = new ParticipantService(_context);

            Participant participantCreate = participantService.Create("Delete_id", evaluation, Organization.Engineering, Role.Participant);

            participantService.Remove(participantCreate.Id);

            Assert.Throws <NotFoundInDBException>(() => participantService.GetParticipant(participantCreate.Id));
        }
コード例 #22
0
        public void GetAzureId()
        {
            EvaluationService evaluationService = new EvaluationService(_context);
            Evaluation        evaluation        = evaluationService.GetAll().First();

            ParticipantService participantService = new ParticipantService(_context);
            string             azureUniqueId      = "GetAzureId_id";
            Participant        participantCreated = participantService.Create(azureUniqueId, evaluation, Organization.Engineering, Role.Participant);

            Participant participantGet = participantService.GetParticipant(azureUniqueId, evaluation);

            Assert.Equal(participantCreated, participantGet);
        }
コード例 #23
0
 public RegisterController(
     UserManager <IdentityUser> userManager,
     SignInManager <IdentityUser> signInManager,
     ILogger <RegisterController> logger,
     ParticipantService participantService,
     TeamService teamService)
 {
     _userManager        = userManager;
     _signInManager      = signInManager;
     _logger             = logger;
     _participantService = participantService;
     _teamService        = teamService;
 }
コード例 #24
0
        public void ParticipantAddedToEvaluation()
        {
            EvaluationService  evaluationService  = new EvaluationService(_context);
            Evaluation         evaluation         = evaluationService.GetAll().First();
            ParticipantService participantService = new ParticipantService(_context);

            int participantsBefore = evaluation.Participants.Count;

            participantService.Create("ParticipantAddedToEvaluation_id", evaluation, Organization.Engineering, Role.Participant);
            int participantsAfter = evaluation.Participants.Count;

            Assert.Equal(participantsBefore + 1, participantsAfter);
        }
コード例 #25
0
        public void Create()
        {
            EvaluationService evaluationService = new EvaluationService(_context);
            Evaluation        evaluation        = evaluationService.GetAll().First();

            ParticipantService participantService = new ParticipantService(_context);

            int nParticipantsBefore = participantService.GetAll().Count();

            participantService.Create("Create_id", evaluation, Organization.Engineering, Role.Participant);
            int nParticipantsAfter = participantService.GetAll().Count();

            Assert.Equal(nParticipantsBefore + 1, nParticipantsAfter);
        }
コード例 #26
0
        public void GetExists()
        {
            ClosingRemarkService closingRemarkService = new ClosingRemarkService(fixture.context);
            ParticipantService   participantService   = new ParticipantService(fixture.context);
            Participant          participant          = participantService.GetAll().First();
            ActionService        actionService        = new ActionService(fixture.context);
            Action action = actionService.GetAll().First();

            ClosingRemark ClosingRemarkCreate = closingRemarkService.Create(participant, "text", action);

            ClosingRemark ClosingRemarkGet = closingRemarkService.GetClosingRemark(ClosingRemarkCreate.Id);

            Assert.Equal(ClosingRemarkCreate, ClosingRemarkGet);
        }
コード例 #27
0
        public void ParticipantAddedToProject()
        {
            ProjectService     projectService     = new ProjectService(_context);
            Project            project            = projectService.GetAll().First();
            Evaluation         evaluation         = project.Evaluations.First();
            ParticipantService participantService = new ParticipantService(_context);

            int participantsBefore = project.Evaluations.First().Participants.Count;

            participantService.Create("ParticipantAddedToProject", evaluation, Organization.Engineering, Role.Participant);
            int participantsAfter = project.Evaluations.First().Participants.Count;

            Assert.Equal(participantsBefore + 1, participantsAfter);
        }
コード例 #28
0
        public async Task Get_DontExist_ShouldReturnNull()
        {
            // Arrange
            var options = BuildContextOptions();

            using (var context = new BorrowBuddyContext(options)) {
                var service = new ParticipantService(context);
                // Act
                var result = await service.GetAsync(Guid.NewGuid());

                // Assert
                Assert.Null(result);
            }
        }
コード例 #29
0
        public void GetExists()
        {
            ActionService      actionService      = new ActionService(_context);
            ParticipantService participantService = new ParticipantService(_context);
            Participant        participant        = participantService.GetAll().First();
            QuestionService    questionService    = new QuestionService(_context);
            Question           question           = questionService.GetAll().First();

            Action actionCreate = actionService.Create(participant, participant, "description", DateTimeOffset.UtcNow, "title", Priority.High, question);

            Action actionGet = actionService.GetAction(actionCreate.Id).First();

            Assert.Equal(actionCreate, actionGet);
        }
コード例 #30
0
ファイル: NoteService.cs プロジェクト: ReedOnly/fusion-bmt
        public void GetExists()
        {
            NoteService        noteService        = new NoteService(fixture.context);
            ParticipantService participantService = new ParticipantService(fixture.context);
            Participant        participant        = participantService.GetAll().First();
            ActionService      actionService      = new ActionService(fixture.context);
            Action             action             = actionService.GetAll().First();

            Note NoteCreate = noteService.Create(participant, "text", action);

            Note NoteGet = noteService.GetNote(NoteCreate.Id);

            Assert.Equal(NoteCreate, NoteGet);
        }