예제 #1
0
        private async void Export_Click(object sender, EventArgs e)
        {
            var saveData = new ProjectInfoDto
            {
                Cars                 = city.Cars,
                ParkingCars          = city.Parking.Cars,
                ParkingCapacity      = city.Parking.Capacity,
                LookingParkingCars   = city.LookingParkingCarsCount,
                NewCarsPerMonth      = city.NewCarsPerMonthCount,
                UtilizedCarsPerMonth = city.UtilizeCarsPerMonthCount,

                NewCarChance          = cityProbabilityChanger.NewCarChance,
                CarsUtilizationChance = cityProbabilityChanger.CarsUtilizationChance,
                CarsStatusChance      = cityProbabilityChanger.CarsStatusChance
            };

            try
            {
                await exportImportService.Export(saveData, "exportData.json");
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Export data exception! Exception: { ex.Message }");
            }
        }
        public void GetProjectInfoReturnsOkIfProjectExists()
        {
            var requestData = new ProjectInfoRequestDto()
            {
                ProjectId = 1,
                UserId    = 1
            };
            Project        project        = TestValuesProvider.GetProjects().FirstOrDefault();
            ProjectInfoDto expectedResult = new ProjectInfoDto()
            {
                Id          = project.Id,
                Description = project.Description,
                Name        = project.Name,
                UserId      = project.UserId
            };

            _projectServiceMock.Setup(service => service.GetProjectById(requestData.ProjectId.Value))
            .Returns(project);
            _mapperMock.Setup(mapper => mapper.Map <Project, ProjectInfoDto>(It.IsAny <Project>()))
            .Returns(expectedResult);

            IActionResult result = this.ProjectsControllerInstance.GetProjectInfo(requestData);

            Assert.IsType <OkObjectResult>(result);
            Assert.Equal(expectedResult, (result as OkObjectResult)?.Value);
        }
예제 #3
0
        /// <summary>
        /// Loads a <see cref="ProjectInfo"/> object from the given <see cref="ProjectInfoDto"/>.
        /// </summary>
        /// <param name="data">The ProjectInfoDto to use.</param>
        private void Child_Fetch(ProjectInfoDto data)
        {
            // Value properties
            LoadProperty(ProjectIdProperty, data.ProjectId);
            LoadProperty(ProjectNameProperty, data.ProjectName);
            var args = new DataPortalHookArgs(data);

            OnFetchRead(args);
        }
예제 #4
0
        private ProjectInfoDto Fetch(SafeDataReader dr)
        {
            var projectInfo = new ProjectInfoDto();

            // Value properties
            projectInfo.ProjectId   = dr.GetInt32("ProjectId");
            projectInfo.ProjectName = dr.GetString("ProjectName");

            return(projectInfo);
        }
예제 #5
0
 public int Insert(ProjectInfoDto model)
 {
     return(Connection(connection =>
     {
         var sql = "insert into ProjectInfo(Title,AdminId,AdminName,CreateTime) output inserted.id values (@Title,@AdminId,@AdminName,@CreateTime)";
         model.AdminId = _user.UserId;
         model.AdminName = _user.UserName;
         model.CreateTime = DateTime.Now;
         return connection.Execute(sql, model);
     }));
 }
예제 #6
0
        public TestCaseContext WithReviewRequest(ProjectInfoDto projectInfo, out ReviewRequestInfoDto reviewRequest)
        {
            ReviewRequestAddDto reviewRequestAddDto =
                InstanceFactory.CreateReviewRequestAddDto(projectInfo.UserId, projectInfo.ProjectId);

            reviewRequest = ReviewController.CreateReviewRequest(reviewRequestAddDto).Value;

            Assert.NotNull(reviewRequest);

            return(this);
        }
예제 #7
0
        public ProjectInfoDto GetProjectInfoDto()
        {
            ProjectInfoDto projectInfoDto = new ProjectInfoDto();

            projectInfoDto.MC         = this.Text;
            projectInfoDto.Remark     = this.Desciption;
            projectInfoDto.SortList   = this.SortList.ConvertTo();
            projectInfoDto.GroupList  = this.GroupList.ConvertTo();
            projectInfoDto.CreateTime = this.CreateTime;
            projectInfoDto.UpdateTime = DateTime.Now;

            return(projectInfoDto);
        }
예제 #8
0
        public ProjectData(ProjectInfoDto c)
        {
            ID         = c.Id.ToString();
            Text       = c.MC;
            Desciption = c.Remark;
            CreateTime = c.CreateTime;
            UpdateTime = c.UpdateTime;

            GroupList = new GroupInfoQueue();
            SortList  = new SortInfoQueue();

            GroupList.ConvertFrom(c.GroupList);
            SortList.ConvertFrom(c.SortList);
        }
예제 #9
0
        public TestCaseContext WithNewProjectForUser(UserInfoDto user, AddProjectDto addProjectDto, out ProjectInfoDto projectInfo)
        {
            projectInfo = ProjectController.CreateProject(addProjectDto).Value;

            Assert.NotNull(projectInfo);

            return(this);
        }
예제 #10
0
 public TestCaseContext WithNewProjectForUser(UserInfoDto user, out ProjectInfoDto projectInfo)
 {
     return(WithNewProjectForUser(user, InstanceFactory.CreateAddProjectDto(user.Id), out projectInfo));
 }