Exemple #1
0
        public IActionResult Put([FromBody] UpdateProjectRequest updateProjectRequest)
        {
            var project = new Project
            {
                Id          = updateProjectRequest.Id,
                Name        = updateProjectRequest.Name,
                Description = updateProjectRequest.Description,
                IsDone      = updateProjectRequest.IsDone
            };

            var updated = _projectService.UpdateProject(project);

            if (updated)
            {
                var getProjectResponse = new GetProjectResponse
                {
                    Id          = project.Id,
                    Name        = project.Name,
                    Description = project.Description,
                    IsDone      = project.IsDone
                };

                return(Ok(getProjectResponse));
            }

            return(NotFound());
        }
        public GetTeamCityProjectDetailsResponse Get(GetTeamCityProjectDetails request)
        {
            GetProjectResponse teamCityResponse = null;

            try
            {
                teamCityResponse = TeamCityClient.GetProject(new GetProject
                {
                    Locator = "id:" + request.ProjectId
                });
            }
            catch (WebServiceException e)
            {
                if (e.IsAny400())
                {
                    throw HttpError.NotFound("Project not found");
                }
            }

            if (teamCityResponse == null)
            {
                throw new HttpError(HttpStatusCode.InternalServerError, "Invalid response from TeamCity");
            }

            GetBuildResponse build = null;

            try
            {
                build = TeamCityClient.GetBuild(new GetBuild {
                    BuildLocator = "project:id:" + request.ProjectId
                });
            }
            catch (WebException e)
            {
                if (!e.HasStatus(HttpStatusCode.BadRequest))
                {
                    throw;
                }
            }
            catch (WebServiceException wse)
            {
                if (!wse.IsAny400())
                {
                    throw;
                }
            }

            build = build ?? new GetBuildResponse();

            var response = new GetTeamCityProjectDetailsResponse
            {
                ProjectName = teamCityResponse.Name,
                ProjectId   = teamCityResponse.Id,
                BuildNumber = build.Number,
                BuildState  = build.State,
                BuildStatus = build.StatusText
            };

            return(response);
        }
Exemple #3
0
        public async Task <IActionResult> GetProjects(long projectId)
        {
            var getProjectResponse = new GetProjectResponse();

            Logger.Info($"Get Projects request is received. Time in UTC: {DateTime.UtcNow}");
            var commandHandlerResponse = await _projectMediator.Send(new GetProjectRequest { ProjectId = projectId });

            getProjectResponse.HandleSuccess(commandHandlerResponse);
            return(Ok(getProjectResponse));
        }
        public GetProjectResponse GetProject(GetProjectRequest request, UnitOfWork context)
        {
            var response = new GetProjectResponse();
            var project  = context.Projects.GetItem(request.Id);

            project.Tasks = project.Tasks?.Select(t => context.Tasks.GetItem(t.Id));

            response.Project = project;

            return(response);
        }
        public static GetProjectResponse Unmarshall(UnmarshallerContext _ctx)
        {
            GetProjectResponse getProjectResponse = new GetProjectResponse();

            getProjectResponse.HttpResponse   = _ctx.HttpResponse;
            getProjectResponse.HttpStatusCode = _ctx.IntegerValue("GetProject.HttpStatusCode");
            getProjectResponse.Success        = _ctx.BooleanValue("GetProject.Success");
            getProjectResponse.RequestId      = _ctx.StringValue("GetProject.RequestId");

            GetProjectResponse.GetProject_Data data = new GetProjectResponse.GetProject_Data();
            data.GmtModified = _ctx.StringValue("GetProject.Data.GmtModified");
            data.MaxFlowNode = _ctx.IntegerValue("GetProject.Data.MaxFlowNode");
            data.DefaultDiResourceGroupIdentifier = _ctx.StringValue("GetProject.Data.DefaultDiResourceGroupIdentifier");
            data.Destination            = _ctx.IntegerValue("GetProject.Data.Destination");
            data.IsAllowDownload        = _ctx.IntegerValue("GetProject.Data.IsAllowDownload");
            data.ProdStorageQuota       = _ctx.StringValue("GetProject.Data.ProdStorageQuota");
            data.SchedulerRetryInterval = _ctx.IntegerValue("GetProject.Data.SchedulerRetryInterval");
            data.ResidentArea           = _ctx.StringValue("GetProject.Data.ResidentArea");
            data.TablePrivacyMode       = _ctx.IntegerValue("GetProject.Data.TablePrivacyMode");
            data.ProjectOwnerBaseId     = _ctx.StringValue("GetProject.Data.ProjectOwnerBaseId");
            data.UseProxyOdpsAccount    = _ctx.BooleanValue("GetProject.Data.UseProxyOdpsAccount");
            data.DisableDevelopment     = _ctx.BooleanValue("GetProject.Data.DisableDevelopment");
            data.ProjectMode            = _ctx.IntegerValue("GetProject.Data.ProjectMode");
            data.GmtCreate              = _ctx.StringValue("GetProject.Data.GmtCreate");
            data.DevStorageQuota        = _ctx.StringValue("GetProject.Data.DevStorageQuota");
            data.IsDefault              = _ctx.IntegerValue("GetProject.Data.IsDefault");
            data.ProtectedMode          = _ctx.IntegerValue("GetProject.Data.ProtectedMode");
            data.BaseProject            = _ctx.BooleanValue("GetProject.Data.BaseProject");
            data.TenantId               = _ctx.LongValue("GetProject.Data.TenantId");
            data.ProjectDescription     = _ctx.StringValue("GetProject.Data.ProjectDescription");
            data.Appkey                 = _ctx.StringValue("GetProject.Data.Appkey");
            data.SchedulerMaxRetryTimes = _ctx.IntegerValue("GetProject.Data.SchedulerMaxRetryTimes");
            data.ProjectName            = _ctx.StringValue("GetProject.Data.ProjectName");
            data.ProjectIdentifier      = _ctx.StringValue("GetProject.Data.ProjectIdentifier");
            data.ProjectId              = _ctx.IntegerValue("GetProject.Data.ProjectId");
            data.Status                 = _ctx.IntegerValue("GetProject.Data.Status");
            data.DevelopmentType        = _ctx.IntegerValue("GetProject.Data.DevelopmentType");

            List <string> data_envTypes = new List <string>();

            for (int i = 0; i < _ctx.Length("GetProject.Data.EnvTypes.Length"); i++)
            {
                data_envTypes.Add(_ctx.StringValue("GetProject.Data.EnvTypes[" + i + "]"));
            }
            data.EnvTypes           = data_envTypes;
            getProjectResponse.Data = data;

            return(getProjectResponse);
        }
Exemple #6
0
        public IActionResult Get([FromRoute] Guid projectId)
        {
            var project = _projectService.GetProjectById(projectId);

            if (project == null)
            {
                return(NotFound("Project not found"));
            }

            var getProjectResponse = new GetProjectResponse
            {
                Id = project.Id, Name = project.Name, Description = project.Description, IsDone = project.IsDone
            };

            return(Ok(getProjectResponse));
        }
Exemple #7
0
        public static GetProjectResponse Unmarshall(UnmarshallerContext context)
        {
            GetProjectResponse getProjectResponse = new GetProjectResponse();

            getProjectResponse.HttpResponse = context.HttpResponse;
            getProjectResponse.RequestId    = context.StringValue("GetProject.RequestId");
            getProjectResponse.Project      = context.StringValue("GetProject.Project");
            getProjectResponse.ServiceRole  = context.StringValue("GetProject.ServiceRole");
            getProjectResponse.Endpoint     = context.StringValue("GetProject.Endpoint");
            getProjectResponse.CreateTime   = context.StringValue("GetProject.CreateTime");
            getProjectResponse.ModifyTime   = context.StringValue("GetProject.ModifyTime");
            getProjectResponse.Type         = context.StringValue("GetProject.Type");
            getProjectResponse.CU           = context.IntegerValue("GetProject.CU");
            getProjectResponse.BillingType  = context.StringValue("GetProject.BillingType");

            return(getProjectResponse);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>  
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            GetProjectResponse response = new GetProjectResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;
            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("project", targetDepth))
                {
                    var unmarshaller = ProjectUnmarshaller.Instance;
                    response.Project = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return response;
        }
        public override async Task <GetProjectResponse> GetProject(GetProjectRequest request, ServerCallContext context)
        {
            var resp = new GetProjectResponse();

            if (_projectManager.Project == null)
            {
                resp.HasProject = false;
                resp.Project    = null;
                return(resp);
            }

            resp.HasProject = true;
            resp.Project    = new Grpc.Editor.Project();

            resp.Project.HashCode                  = _projectManager.Project.GetHashCode();
            resp.Project.ProjectPath               = _projectManager.Project.ProjectPath.FullName;
            resp.Project.LoadingStatus             = _projectManager.Project.LoadingStatus ?? "";
            resp.Project.Name                      = _projectManager.Project.Name;
            resp.Project.DefaultGameDefinitionName = _projectManager.Project.DefaultGame.Name;
            resp.Project.SolutionFilePath          = _projectManager.Project.SolutionFile.FullName;
            resp.Project.DefaultGameBinPath        = _projectManager.Project.DefaultGameBinPath.FullName;
            foreach (var package in _projectManager.Project.Packages)
            {
                resp.Project.Packages.Add(new Package
                {
                    Package_   = package.Package,
                    Repository = package.Repository,
                    Version    = package.Version
                });
            }
            foreach (var definition in _projectManager.Project.Definitions)
            {
                resp.Project.Definitions.Add(new Definition
                {
                    Name            = definition.Name,
                    Type            = definition.Type,
                    Role            = definition.Role,
                    XmlDocumentPath = definition.LoadedDocumentPath
                });
            }

            return(resp);
        }
Exemple #10
0
        public void GetAll()
        {
            System.Console.WriteLine("Get all the projects...");

            GetProjectRequest request   = new GetProjectRequest {
            };
            GetProjectResponse response = _projectClient.GetProject(request);
            var projectlist             = response.Projects;

            foreach (var p in projectlist)
            {
                System.Console.WriteLine($"Id {p.Id}\n" +
                                         $"Area {p.Area}\n" +
                                         $"Name {p.Name}\n" +
                                         $"Technology Stack {p.TechnologyStack}");
                System.Console.WriteLine("-------------");
            }
            System.Console.WriteLine("-------------");
            System.Console.WriteLine("-------------");
        }
Exemple #11
0
        public static GetProjectResponse Unmarshall(UnmarshallerContext context)
        {
            GetProjectResponse getProjectResponse = new GetProjectResponse();

            getProjectResponse.HttpResponse = context.HttpResponse;
            getProjectResponse.Code         = context.IntegerValue("GetProject.Code");
            getProjectResponse.Message      = context.StringValue("GetProject.Message");
            getProjectResponse.RequestId    = context.StringValue("GetProject.RequestId");

            GetProjectResponse.GetProject_Data data = new GetProjectResponse.GetProject_Data();

            List <GetProjectResponse.GetProject_Data.GetProject_Project> data_projectList = new List <GetProjectResponse.GetProject_Data.GetProject_Project>();

            for (int i = 0; i < context.Length("GetProject.Data.ProjectList.Length"); i++)
            {
                GetProjectResponse.GetProject_Data.GetProject_Project project = new GetProjectResponse.GetProject_Data.GetProject_Project();
                project.ApiNum               = context.IntegerValue("GetProject.Data.ProjectList[" + i + "].ApiNum");
                project.CsbId                = context.LongValue("GetProject.Data.ProjectList[" + i + "].CsbId");
                project.DeleteFlag           = context.IntegerValue("GetProject.Data.ProjectList[" + i + "].DeleteFlag");
                project.Description          = context.StringValue("GetProject.Data.ProjectList[" + i + "].Description");
                project.GmtCreate            = context.LongValue("GetProject.Data.ProjectList[" + i + "].GmtCreate");
                project.GmtModified          = context.LongValue("GetProject.Data.ProjectList[" + i + "].GmtModified");
                project.Id                   = context.LongValue("GetProject.Data.ProjectList[" + i + "].Id");
                project.InterfaceJarLocation = context.StringValue("GetProject.Data.ProjectList[" + i + "].InterfaceJarLocation");
                project.InterfaceJarName     = context.StringValue("GetProject.Data.ProjectList[" + i + "].InterfaceJarName");
                project.JarFileKey           = context.StringValue("GetProject.Data.ProjectList[" + i + "].JarFileKey");
                project.OwnerId              = context.StringValue("GetProject.Data.ProjectList[" + i + "].OwnerId");
                project.ProjectName          = context.StringValue("GetProject.Data.ProjectList[" + i + "].ProjectName");
                project.ProjectOwnerEmail    = context.StringValue("GetProject.Data.ProjectList[" + i + "].ProjectOwnerEmail");
                project.ProjectOwnerName     = context.StringValue("GetProject.Data.ProjectList[" + i + "].ProjectOwnerName");
                project.ProjectOwnerPhoneNum = context.StringValue("GetProject.Data.ProjectList[" + i + "].ProjectOwnerPhoneNum");
                project.Status               = context.IntegerValue("GetProject.Data.ProjectList[" + i + "].Status");
                project.UserId               = context.StringValue("GetProject.Data.ProjectList[" + i + "].UserId");

                data_projectList.Add(project);
            }
            data.ProjectList        = data_projectList;
            getProjectResponse.Data = data;

            return(getProjectResponse);
        }
        public static GetProjectResponse Unmarshall(UnmarshallerContext context)
        {
            GetProjectResponse getProjectResponse = new GetProjectResponse();

            getProjectResponse.HttpResponse = context.HttpResponse;
            getProjectResponse.RequestId    = context.StringValue("GetProject.RequestId");
            getProjectResponse.Project      = context.StringValue("GetProject.Project");
            getProjectResponse.ServiceRole  = context.StringValue("GetProject.ServiceRole");
            getProjectResponse.Endpoint     = context.StringValue("GetProject.Endpoint");
            getProjectResponse.CreateTime   = context.StringValue("GetProject.CreateTime");
            getProjectResponse.ModifyTime   = context.StringValue("GetProject.ModifyTime");
            getProjectResponse.Type         = context.StringValue("GetProject.Type");
            getProjectResponse.CU           = context.IntegerValue("GetProject.CU");

            List <GetProjectResponse.GetProject_IndexersItem> getProjectResponse_indexers = new List <GetProjectResponse.GetProject_IndexersItem>();

            for (int i = 0; i < context.Length("GetProject.Indexers.Length"); i++)
            {
                GetProjectResponse.GetProject_IndexersItem indexersItem = new GetProjectResponse.GetProject_IndexersItem();
                indexersItem.Name   = context.StringValue("GetProject.Indexers[" + i + "].Name");
                indexersItem.Status = context.StringValue("GetProject.Indexers[" + i + "].Status");

                getProjectResponse_indexers.Add(indexersItem);
            }
            getProjectResponse.Indexers = getProjectResponse_indexers;

            List <GetProjectResponse.GetProject_EnginesItem> getProjectResponse_engines = new List <GetProjectResponse.GetProject_EnginesItem>();

            for (int i = 0; i < context.Length("GetProject.Engines.Length"); i++)
            {
                GetProjectResponse.GetProject_EnginesItem enginesItem = new GetProjectResponse.GetProject_EnginesItem();
                enginesItem.Name   = context.StringValue("GetProject.Engines[" + i + "].Name");
                enginesItem.JobTtl = context.LongValue("GetProject.Engines[" + i + "].JobTtl");

                getProjectResponse_engines.Add(enginesItem);
            }
            getProjectResponse.Engines = getProjectResponse_engines;

            return(getProjectResponse);
        }
        public static GetProjectResponse Unmarshall(UnmarshallerContext context)
        {
            GetProjectResponse getProjectResponse = new GetProjectResponse();

            getProjectResponse.HttpResponse = context.HttpResponse;
            getProjectResponse.RequestId    = context.StringValue("GetProject.RequestId");

            GetProjectResponse.GetProject_Project project = new GetProjectResponse.GetProject_Project();
            project.Name               = context.StringValue("GetProject.Project.Name");
            project.State              = context.StringValue("GetProject.Project.State");
            project.Creator            = context.StringValue("GetProject.Project.Creator");
            project.CreateTime         = context.LongValue("GetProject.Project.CreateTime");
            project.Modifier           = context.StringValue("GetProject.Project.Modifier");
            project.ModifyTime         = context.LongValue("GetProject.Project.ModifyTime");
            project.Description        = context.StringValue("GetProject.Project.Description");
            project.DeployType         = context.StringValue("GetProject.Project.DeployType");
            project.ClusterId          = context.StringValue("GetProject.Project.ClusterId");
            project.ManagerIds         = context.StringValue("GetProject.Project.ManagerIds");
            project.Region             = context.StringValue("GetProject.Project.Region");
            project.Id                 = context.StringValue("GetProject.Project.Id");
            getProjectResponse.Project = project;

            return(getProjectResponse);
        }