Beispiel #1
0
        public void WhereClause_OptionalTestLike_ShouldFilter(string name, int count)
        {
            var applications = new ApplicationDto[]
            {
                new ApplicationDto {
                    Name = "Name1", User = "******", DefName = "Def1"
                },
                new ApplicationDto {
                    Name = "Name2", User = "******", DefName = "Def2"
                },
                new ApplicationDto {
                    Name = "Name3", User = "******", DefName = "Def3"
                },
            };
            const string sqlInsert = "INSERT INTO application ([Name], [User], [DefName]) VALUES (@Name, @User, @DefName)";

            using var connection = new MemoryDbConnection();
            connection.GetMemoryDatabase().Clear();
            connection.Execute(SqlStatements.SqlCreateTableApplication);
            connection.Execute(sqlInsert, applications);

            string sqlSelect   = $"{SqlStatements.SqlSelectApplication} WHERE @name is NULL OR [Name] LIKE @name";
            var    appsQueried = connection.Query <ApplicationDto>(sqlSelect, new { name = name }).ToList();

            appsQueried.Count.Should().Be(count);
            if (count == 1)
            {
                appsQueried.First().Name.Should().Be(name);
            }
        }
        private ApplicationDto Convert(ApplicationEntity source)
        {
            var result = new ApplicationDto();

            result.AppNavBarUrl          = source.AppNavBarUrl;
            result.IsOnline              = source.IsOnline;
            result.IsRegistered          = source.IsRegistered;
            result.IsHealthy             = source.IsHealthy;
            result.BackButtonUrl         = source.BackButtonUrl;
            result.Branding              = source.Branding;
            result.BreadcrumbsUrl        = source.BreadcrumbsUrl;
            result.Description           = source.Description;
            result.EntrypointUrl         = source.EntrypointUrl;
            result.HealthCheckUrl        = source.HealthCheckUrl;
            result.LayoutName            = source.LayoutName;
            result.MainMenuText          = source.MainMenuText;
            result.Name                  = source.Name;
            result.PersonalisationUrl    = source.PersonalisationUrl;
            result.RequiresAuthorization = source.RequiresAuthorization;
            result.RootUrl               = source.RootUrl;
            result.RouteName             = source.RouteName;
            result.ShowSideBar           = source.ShowSideBar;
            result.SidebarUrl            = source.SidebarUrl;
            result.Title                 = source.Title;
            return(result);
        }
Beispiel #3
0
        public void WhereClause_IntParameterWithCalculation_ShouldFilter( )
        {
            var applications = new ApplicationDto[]
            {
                new ApplicationDto {
                    Name = "Name1", User = "******", DefName = "Def1"
                },
                new ApplicationDto {
                    Name = "Name2", User = "******", DefName = "Def2"
                },
                new ApplicationDto {
                    Name = "Name3", User = "******", DefName = "Def3"
                },
            };
            const string sqlInsert = "INSERT INTO application ([Name], [User], [DefName]) VALUES (@Name, @User, @DefName)";

            using var connection = new MemoryDbConnection();
            connection.GetMemoryDatabase().Clear();
            connection.Execute(SqlStatements.SqlCreateTableApplication);
            connection.Execute(sqlInsert, applications);

            string sqlSelect   = $"{SqlStatements.SqlSelectApplication} WHERE Id = @id + 1";
            int    id          = 0;
            var    appsQueried = connection.Query <ApplicationDto>(sqlSelect, new { id }).ToList();

            appsQueried.Count.Should().Be(1);
            appsQueried.First().Id.Should().Be(id + 1);
        }
Beispiel #4
0
        public async Task <IActionResult> Edit(int id, ApplicationDto applicationDto)
        {
            var request  = new UpdateApplicationCommand(id, applicationDto);
            var response = await _mediator.Send(request);

            return(Ok(response));
        }
Beispiel #5
0
        /// <summary>
        /// Gets list object of the table Application.
        /// </summary>
        /// <param name="lFilterApplication">List that contains the DTOs from Application table that filter the query.</param>
        /// <returns>List object of the table Application.</returns>
        /// <author>Mauricio Suárez.</author>
        public List <ApplicationDto> GetApplication(ApplicationDto dtoApplication)
        {
            List <ApplicationDto> listFilterApplication = new List <ApplicationDto>();

            listFilterApplication.Add(dtoApplication);
            return(this.ExecuteGetApplication(null, listFilterApplication));
        }
Beispiel #6
0
        /// <summary>
        /// Save or update records for the table
        /// </summary>
        /// <param name="listDataApplication">List of data to store Application.</param>
        /// <returns>The result of processing the list.</returns>
        /// <author>Mauricio Suárez.</author>
        public bool SaveApplication(ApplicationDto dtoApplication)
        {
            List <ApplicationDto> listDataApplication = new List <ApplicationDto>();

            listDataApplication.Add(dtoApplication);
            return(this.SaveApplication(listDataApplication));
        }
Beispiel #7
0
 public void TestInit()
 {
     _builder    = new RandomBuilder();
     _repository = Ioc.Create <IApplicationRepository>();
     _service    = Ioc.Create <IApplicationService>();
     _dto        = ApplicationDtoTest.Create2(Guid.Empty);
 }
        // Update is called once per frame
        void Update()
        {
            // キャンセル以外の 何かボタンを押したらセレクト画面へ遷移
            foreach (var player in PlayerIndexes.All)
            {
                // プレイヤーのキー押下状態を確認。
                InputStateDto state = ApplicationDto.ReadInput(player);

                if (state.Lp.Pressing ||
                    state.Mp.Pressing ||
                    state.Hp.Pressing ||
                    state.Lk.Pressing ||
                    state.Mk.Pressing ||
                    state.Hk.Pressing ||
                    state.Pause.Pressing
                    )
                {
                    Debug.Log($"Push key. human={player} input {state.ToDisplay()}");
                    CommonScript.computerFlags[player] = false;

                    // * Configure scene.
                    //     * Click main menu [File] - [Build Settings...].
                    //     * Double click [Assets] - [Scenes] - [Title] in project view.
                    //     * Click [Add Open Scenes] button.
                    //     * Double click [Assets] - [Scenes] - [Select] in project view.
                    //     * Click [Add Open Scenes] button.
                    //     * Double click [Assets] - [Scenes] - [Fight] in project view.
                    //     * Click [Add Open Scenes] button.
                    //     * Double click [Assets] - [Scenes] - [Result] in project view.
                    //     * Click [Add Open Scenes] button.
                    //     * Right click `Scenes/SampleScene` from `Build Settings/Scene In Build`. and Click [Remove Selection].
                    SceneManager.LoadScene(CommonScript.Scene_to_name[(int)SceneIndex.Select]);
                }
            }
        }
Beispiel #9
0
        public async Task <IActionResult> Edit(int id, [FromBody] ApplicationDto applicationDto)
        {
            var updateApplicationCommand = new UpdateApplicationCommand(id, applicationDto);
            var response = await _mediator.Send(updateApplicationCommand);

            return(Ok(response));
        }
        public IActionResult Create([FromBody] ApplicationDto applicationDto)
        {
            // map dto to entity
            var application = _mapper.Map <Application>(applicationDto);

            _logger.LogInformation("Creating application: " + application.Title + " for the " + application.CandidateEmail);

            try
            {
                // Creates new application
                application.Id = Guid.NewGuid().ToString();
                application.CandidateSecret = _applicationService.GetRandomNumber(1000, 9999).ToString();
                application.Timestamp       = DateTime.Now;
                application.Status          = InterviuStatus.NotStarted.ToString();
                application.StatusTimestamp = DateTime.Now;

                _applicationService.Create(application, applicationDto.TemplateId, applicationDto.UserId);

                return(Ok(application));
            }
            catch (AppException ex)
            {
                // return error message if there was an exception
                return(BadRequest(new { message = ex.Message }));
            }
        }
        public async Task WhenFindingExistingApplicationWithWrongPasswordThenNullIsReturned()
        {
            // Arrange
            ApplicationEntity application = new ApplicationEntity()
            {
                Id           = 0,
                DisplayName  = "TestApplicationDisplayName",
                PasswordHash = "TestPasswordHash",
                PasswordSalt = "TestPasswordSalt"
            };

            IApplicationRepository fakeApplicationRepository = A.Fake <IApplicationRepository>();

            A.CallTo(() => fakeApplicationRepository.TryGetByDisplayNameAsync("TestApplicationDisplayName")).Returns(Task.FromResult(application));

            IUnitOfWork fakeUnitOfWork = A.Fake <IUnitOfWork>();

            IPasswordWithSaltHasher fakePasswordHasher = A.Fake <IPasswordWithSaltHasher>();

            A.CallTo(() => fakePasswordHasher.CheckPassword(A <string> .Ignored, A <string> .Ignored, A <string> .Ignored)).Returns(false);

            IApplicationService applicationService = new ApplicationService(fakeApplicationRepository, fakeUnitOfWork, fakePasswordHasher);

            // Act
            ApplicationDto applicationDto = await applicationService.FindApplicationAsync("TestApplicationDisplayName", "TestPassword");

            // Assert
            Assert.IsNull(applicationDto);
        }
Beispiel #12
0
        public ActionResult Edit(int id)
        {
            UpdateApplication ModelView = new UpdateApplication();

            //Get the selected application from the database
            string url = "ApplicationData/FindApplication/" + id;
            HttpResponseMessage response = client.GetAsync(url).Result;

            if (response.IsSuccessStatusCode)
            {
                ApplicationDto SelectedApplication = response.Content.ReadAsAsync <ApplicationDto>().Result;
                ModelView.Application = SelectedApplication;

                url      = "UserData/GetUsers";
                response = client.GetAsync(url).Result;
                IEnumerable <ApplicationUserDto> SelectedUsers = response.Content.ReadAsAsync <IEnumerable <ApplicationUserDto> >().Result;
                ModelView.ApplicationUsers = SelectedUsers;

                url      = "JobData/GetJobs";
                response = client.GetAsync(url).Result;
                IEnumerable <JobDto> SelectedJobs = response.Content.ReadAsAsync <IEnumerable <JobDto> >().Result;
                ModelView.Jobs = SelectedJobs;

                return(View(ModelView));
            }
            else
            {
                return(RedirectToAction("Error"));
            }
        }
Beispiel #13
0
        public ActionResult Details(int id)
        {
            ShowApplication ModelView = new ShowApplication();
            //Using the Show Application View Model
            //Find the application by Id from the database
            string url = "ApplicationData/FindApplication/" + id;
            HttpResponseMessage response = client.GetAsync(url).Result;

            //Response 200 code if it is ok
            if (response.IsSuccessStatusCode)
            {
                ApplicationDto SelectedApplication = response.Content.ReadAsAsync <ApplicationDto>().Result;
                ModelView.Application = SelectedApplication;

                //Errors n/a if it is null
                //Associated Application with User
                url      = "ApplicationData/GetUserForApplication/" + id;
                response = client.GetAsync(url).Result;
                ApplicationUserDto SelectedUser = response.Content.ReadAsAsync <ApplicationUserDto>().Result;
                ModelView.ApplicationUser = SelectedUser;

                //Errors n/a if it is null
                //Associated application with Job
                url      = "ApplicationData/GetJobForApplication/" + id;
                response = client.GetAsync(url).Result;
                JobDto SelectedJob = response.Content.ReadAsAsync <JobDto>().Result;
                ModelView.Job = SelectedJob;

                return(View(ModelView));
            }
            else
            {
                return(RedirectToAction("Error"));
            }
        }
Beispiel #14
0
        /// <summary>
        /// Gets list object of the table Application.
        /// </summary>
        /// <param name="paginationDto">Attributes to apply the pagination.</param>
        /// <param name="listFilterApplication">List that contains the DTOs from Application table that filter the query.</param>
        /// <returns>List object of the table Application.</returns>
        /// <author>Mauricio Suárez.</author>
        public List <ApplicationDto> GetApplication(PaginationDto paginationDto, ApplicationDto dtoApplication)
        {
            List <ApplicationDto> listFilterApplication = new List <ApplicationDto>();

            listFilterApplication.Add(dtoApplication);
            return(this.ExecuteGetApplication(paginationDto, listFilterApplication));
        }
Beispiel #15
0
        public async Task <ActionResult <Application> > Create(ApplicationDto applicationDto)
        {
            var request  = new CreateApplicationCommand(applicationDto);
            var response = await _mediator.Send(request);

            return(Ok(response));
        }
        public IHttpActionResult GetAllApplications()
        {
            //List of the Application from the database
            List <Application> Applications = db.Applications.ToList();

            //Using the ShowApplication View Model
            List <ShowApplication> ApplicationDtos = new List <ShowApplication> {
            };

            foreach (var Application in Applications)
            {
                ShowApplication application = new ShowApplication();

                //Get the user from the OurUsers Database and link them with the application
                ApplicationUser ApplicationUser = db.Users
                                                  .Where(c => c.Applications
                                                         .Any(a => a.ApplicationId == Application.ApplicationId))
                                                  .FirstOrDefault();

                ApplicationUserDto firstUser = new ApplicationUserDto
                {
                    Id          = ApplicationUser.Id,
                    FirstName   = ApplicationUser.FirstName,
                    LastName    = ApplicationUser.LastName,
                    Email       = ApplicationUser.Email,
                    PhoneNumber = ApplicationUser.PhoneNumber,
                    Address     = ApplicationUser.Address,
                };

                //Get the Job from Jobs Table and associate them with the application
                Job Job = db.Jobs
                          .Where(j => j.Applications
                                 .Any(a => a.ApplicationId == Application.ApplicationId))
                          .FirstOrDefault();

                JobDto job = new JobDto
                {
                    Position    = Job.Position,
                    Category    = Job.Category,
                    Type        = Job.Type,
                    Requirement = Job.Requirement,
                    Deadline    = Job.Deadline
                };

                ApplicationDto NewApplication = new ApplicationDto
                {
                    ApplicationId = Application.ApplicationId,
                    Comment       = Application.Comment,
                    JobId         = Application.JobId,
                    Id            = Application.Id
                };

                application.Application     = NewApplication;
                application.Job             = job;
                application.ApplicationUser = firstUser;
                ApplicationDtos.Add(application);
            }

            return(Ok(ApplicationDtos));
        }
Beispiel #17
0
        public async Task <Identity> ValidateRequestAsync(string jwt)
        {
            if (string.IsNullOrWhiteSpace(jwt))
            {
                throw new ArgumentNullException("jwt");
            }

            // Validate JWT
            JwtValidationResultDto fncConnectResult = await _jwtManager.ValidateJwtAsync(jwt).ConfigureAwait(false);

            ApplicationDto appInfo = fncConnectResult.JwtData.AppInfo;

            // check if Application is configured in EventPublisher
            Application application = await _repository.GetApplicationAsync(fncConnectResult.JwtData.AppInfo.ImmutableAppID).ConfigureAwait(false);

            if (application == null)
            {
                throw new NotAuthorizedException(string.Format("Application {0} is not configured.", appInfo.AppName));
            }

            return(new Identity()
            {
                Id = appInfo.ImmutableAppID,
                Name = appInfo.AppName
            });
        }
 /// <summary>
 /// 转换为应用程序实体
 /// </summary>
 /// <param name="dto">应用程序数据传输对象</param>
 public static Application ToEntity(this ApplicationDto dto)
 {
     if (dto == null)
     {
         return(new Application());
     }
     return(dto.MapTo(new Application(dto.Id.ToGuid())));
 }
Beispiel #19
0
        public async Task <IActionResult> Create(ApplicationDto applicationDto)
        {
            var createApplicationCommand = new CreateApplicationCommand(applicationDto);
            var response = await _mediator.Send(createApplicationCommand);

            return(response.StatusCode == HttpStatusCode.NotFound
                ? (IActionResult)NotFound(response)
                : Ok(response));
        }
 public virtual void Update(String id, ApplicationDto model)
 {
     Tiantianquan.Privilege.Domain.Application application = this.ApplicationRepository.GetById(id);
     application.CreatedAt   = model.CreatedAt;
     application.UpdatedAt   = model.UpdatedAt;
     application.Name        = model.Name;
     application.Description = model.Description;
     this.ApplicationRepository.Update(application);
 }
        public async Task <FileDto> GetUsersToExcel()
        {
            try
            {
                //Below code is will fetch data for export which will change as per requirement

                var ApplicationList = _applicationRepository.GetAll().AsNoTracking().Include(x => x.project).ToList();
                List <ApplicationDto> ApplicationDtoList = new List <ApplicationDto>();
                if (ApplicationList.Count == 0)
                {
                    ApplicationDto reportDto = new ApplicationDto();
                    ApplicationDtoList.Add(reportDto);
                }

                ApplicationDtoList = ObjectMapper.Map <List <ApplicationDto> >(ApplicationList);

                ApplicationDtoList.ForEach((x) =>
                {
                    x.ApplicationName = (x.Id != 0 && x.ApplicationName != null) ? x.ApplicationName : AppConsts.DashSymbol;
                    x.ProjectName     = (x.Id != 0 && x.project != null) ? x.project.Name : AppConsts.DashSymbol;
                    x.Time            = (x.CreationTime != null) ? x.CreationTime.ToShortDateString() : AppConsts.DashSymbol;
                });


                var applicationSortedList = ApplicationDtoList.OrderBy(x => x.CreationTime).ToList();


                // Below is File Generation code this will remain same for all export you just need to change parameter of createWorksheetForExcel method while calling.

                string fileName       = AppConsts.ExportFilename;
                string path           = Path.GetTempPath();
                string outputFileName = _fileExportService.CreateFilePath(fileName);
                fileName = fileName + AppConsts.ExcelFileExtention;


                var file = new FileDto(fileName, AppConsts.ExcelFormat);

                using (SpreadsheetDocument package = SpreadsheetDocument.Create(outputFileName, SpreadsheetDocumentType.Workbook))
                {
                    _fileExportService.CreateWorksheetForExcel(package, applicationSortedList);
                }

                var memory = await _fileExportService.GenerateMemoryStream(path, fileName);


                _tempFileCacheManager.SetFile(file.FileToken, memory.ToArray());
                //Delete generate file from server
                File.Delete(Path.Combine(path, fileName));

                return(file);
            }
            catch
            {
                throw;
            }
        }
        /// <summary>
        /// Creates application
        /// </summary>
        /// <param name="application">product</param>
        public async Task <Guid> CreateApplicationAsync(ApplicationDto application)
        {
            using (var uow = UnitOfWorkProvider.Create())
            {
                var applicationId = applicationService.Create(application);
                await uow.Commit();

                return(applicationId);
            }
        }
 public virtual String Save(ApplicationDto model)
 {
     Tiantianquan.Privilege.Domain.Application application = new Tiantianquan.Privilege.Domain.Application();
     application.Id          = model.Id;
     application.CreatedAt   = model.CreatedAt;
     application.UpdatedAt   = model.UpdatedAt;
     application.Name        = model.Name;
     application.Description = model.Description;
     return(this.ApplicationRepository.Save(application));
 }
        private async Task LoadRelatedApplicationOrDoNothing(string inGameName, CancellationToken cancellationToken)
        {
            if (!_isExistingApplicationChecked)
            {
                _existingApplication =
                    await _mediator.Send(new ApplicationQuery { InGameName = inGameName }, cancellationToken);

                _isExistingApplicationChecked = true;
            }
        }
Beispiel #25
0
        /// <summary>
        /// 修改应用程序
        /// </summary>
        /// <param name="dto">应用程序参数</param>
        public async Task UpdateAsync(ApplicationDto dto)
        {
            var entity = dto.ToEntity();

            await ValidateUpdateAsync(entity);

            await ApplicationRepository.UpdateAsync(entity);

            await UnitOfWork.CommitAsync();
        }
        public async Task <ActionResult> ApplicationCreate(Guid jobOfferId)
        {
            var jobOffer = await JobOfferFacade.GetJobOfferAsync(jobOfferId);

            var model = new ApplicationDto {
                JobOffer = jobOffer, JobOfferId = jobOfferId
            };

            return(View(model));
        }
        /// <inheritdoc/>
        public Task <EmailContentDto> RenderNewApplicationContentAsync(ApplicationDto applicationDto, CancellationToken cancellationToken)
        {
            var content = new EmailContentDto()
            {
                Subject = "Система жалоб и предложений: Новая жалоба",
                Body    = $"<p>Название: {applicationDto.Name}</p>" +
                          $"<p>Описание: {applicationDto.Description}</p>"
            };

            return(Task.FromResult(content));
        }
 public static AppPreviewViewModel MapToViewModelPreview(this ApplicationDto app)
 {
     return(new AppPreviewViewModel
     {
         Id = app.Id.ToString(),
         EGN = app.EGN,
         Name = app.Name,
         Phone = app.PhoneNumber,
         Status = app.Status
     });
 }
 public PlayStreamProxyDto(StreamProxyDto streamProxy, DomainDto domain, ApplicationDto application) : this()
 {
     this.StreamProxy = streamProxy;
     this.Domain      = domain;
     this.Application = application;
     vHost            = domain.DomainName;
     if (GloableCache.ZLMediaServerConfig.ContainsKey("general.enableVhost") && GloableCache.ZLMediaServerConfig["general.enableVhost"] != "1")
     {
         vHost = "__defaultVhost__";
     }
 }
        /// <summary>
        /// 获取
        /// </summary>
        /// <param name="id"></param>
        public virtual ApplicationDto GetApplicationById(String id)
        {
            Tiantianquan.Privilege.Domain.Application application = this.ApplicationRepository.GetById(id);
            ApplicationDto model = new ApplicationDto();

            model.Id          = application.Id;
            model.CreatedAt   = application.CreatedAt;
            model.UpdatedAt   = application.UpdatedAt;
            model.Name        = application.Name;
            model.Description = application.Description;
            return(model);
        }