Beispiel #1
0
        /// <inheritdoc />
        public override void Decode(MinecraftStream stream)
        {
            TeamName   = stream.ReadString();
            PacketMode = (Mode)stream.ReadByte();

            switch (PacketMode)
            {
            case Mode.CreateTeam:
                var a = new CreateTeam();
                a.Read(stream);
                Payload = a;
                break;

            case Mode.RemoveTeam:
                break;

            case Mode.UpdateTeam:
                var upd = new UpdateTeam();
                upd.Read(stream);
                Payload = upd;
                break;

            case Mode.AddPlayer:
                var add = new AddPlayers();
                add.Read(stream);
                Payload = add;
                break;

            case Mode.RemovePlayer:
                var remove = new RemovePlayers();
                remove.Read(stream);
                Payload = remove;
                break;
            }
        }
        // GET: Team/Edit/5
        public ActionResult Edit(int id)
        {
            UpdateTeam          ViewModel = new UpdateTeam();
            string              url       = "teamdata/findteam/" + id;
            HttpResponseMessage response  = client.GetAsync(url).Result;

            if (response.IsSuccessStatusCode)
            {
                //Put data into Team data transfer object
                TeamDto SelectedTeam = response.Content.ReadAsAsync <TeamDto>().Result;
                ViewModel.team = SelectedTeam;

                //get information about players that could play for this team.
                url      = "playerdata/getplayers";
                response = client.GetAsync(url).Result;
                IEnumerable <PlayerDto> PotentialPlayers = response.Content.ReadAsAsync <IEnumerable <PlayerDto> >().Result;
                ViewModel.allplayers = PotentialPlayers;

                return(View(ViewModel));
            }
            else
            {
                return(RedirectToAction("Error"));
            }
        }
        public ActionResult Edit(int id)
        {
            UpdateTeam          ViewModel = new UpdateTeam();
            string              url       = "teamdata/findteam/" + id;
            HttpResponseMessage response  = client.GetAsync(url).Result;

            //Can catch the status code (200 OK, 301 REDIRECT), etc.
            //Debug.WriteLine(response.StatusCode);
            if (response.IsSuccessStatusCode)
            {
                //Put data into Team object
                TeamDto SelectedTeam = response.Content.ReadAsAsync <TeamDto>().Result;
                ViewModel.team = SelectedTeam;

                //get information about sports this team could be about.
                url      = "sportdata/getsports";
                response = client.GetAsync(url).Result;
                IEnumerable <SportDto> PotentialSports = response.Content.ReadAsAsync <IEnumerable <SportDto> >().Result;
                ViewModel.sports = PotentialSports;


                return(View(ViewModel));
            }
            else
            {
                return(RedirectToAction("Error"));
            }
        }
Beispiel #4
0
        private void txtUTeam_Click(object sender, EventArgs e)
        {
            UpdateTeam uTeam = new UpdateTeam();

            uTeam.Show();
            uTeam.name(txtName.Text);
            uTeam.logName(button1.Text);
            this.Close();
        }
            public void RequestsTheCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new TeamsClient(connection);
                var team = new UpdateTeam("Octokittens");

                client.UpdateTeam(1, team);

                connection.Received().Patch<Team>(Arg.Is<Uri>(u => u.ToString() == "teams/1"), team);
            }
Beispiel #6
0
            public void RequestsTheCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new TeamsClient(connection);
                var team       = new UpdateTeam("Octokittens");

                client.Update(1, team);

                connection.Received().Patch <Team>(Arg.Is <Uri>(u => u.ToString() == "teams/1"), team);
            }
        // GET: Team/Create
        public ActionResult Create()
        {
            UpdateTeam ViewModel = new UpdateTeam();
            //get information about players that could play for this team.
            string url = "playerdata/getplayers";
            HttpResponseMessage     response         = client.GetAsync(url).Result;
            IEnumerable <PlayerDto> PotentialPlayers = response.Content.ReadAsAsync <IEnumerable <PlayerDto> >().Result;

            ViewModel.allplayers = PotentialPlayers;

            return(View(ViewModel));
        }
        public ActionResult Create()
        {
            UpdateTeam ViewModel = new UpdateTeam();
            //get information about sports this team could be about.
            string url = "sportdata/getsports";
            HttpResponseMessage    response        = client.GetAsync(url).Result;
            IEnumerable <SportDto> PotentialSports = response.Content.ReadAsAsync <IEnumerable <SportDto> >().Result;

            ViewModel.sports = PotentialSports;

            return(View(ViewModel));
        }
Beispiel #9
0
        public async Task <IActionResult> Update([FromBody] UpdateTeam data, [FromHeader] string CompanyId)
        {
            if (ModelState.IsValid)
            {
                data.UpdatedBy = User.Claims.FirstOrDefault(s => s.Type == "userName").Value;
                data.CompanyId = CompanyId;
                var result = await _updateTeamRequestClient.Request(data);

                return(Ok(result));
            }
            return(BadRequest(ModelState));
        }
        private UpdateTeam.Response UpdateTeamHandler(UpdateTeam command)
        {
            ITracer tracer = platform.Tracer;

            tracer.Write("Siemens-SimaticIT-Trace-Custom", Category.Informational, "update Team Start...");
            try
            {
                var entity = platform.GetEntity <ITeam>(command.Id);
                if (entity == null)
                {
                    return(new UpdateTeam.Response {
                        Error = new ExecutionError(-1010, string.Format("[{0}]已经不存在,不允许更新", command.Team.Name))
                    });
                }
                else
                {
                    PropertyValuesSpecification <ITeam> pv = new PropertyValuesSpecification <ITeam>();
                    pv.Add("Name", command.Team.Name);
                    var existentity = platform.GetEntity(pv);
                    if (existentity != null)
                    {
                        if (!command.Id.Equals(entity.Id))
                        {
                            return new UpdateTeam.Response {
                                       Error = new ExecutionError(-1010, string.Format("[{0}]已经有其它记录,不允许更新", command.Team.Name))
                            }
                        }
                        ;
                    }
                    entity.Name        = command.Team.Name;
                    entity.Description = command.Team.Description;
                    entity.Number      = command.Team.Number;
                    entity.IsActive    = command.IsActive;
                    entity.IsLeader    = command.IsLeader;
                }
                platform.Submit(entity);
                tracer.Write("Siemens-SimaticIT-Trace-Custom", Category.Informational, "Update Team End...");
                return(new UpdateTeam.Response {
                });
            }
            catch (Exception ex)
            {
                return(new UpdateTeam.Response {
                    Error = new ExecutionError(-1010, string.Format("[{0}]更新发生异常,异常信息是:{1}", command.Team.Name, ex.Message))
                });
            }
        }
        public async Task UpdatesTeam()
        {
            using (var teamContext = await _github.CreateTeamContext(Helper.Organization, new NewTeam(Helper.MakeNameWithTimestamp("team-fixture"))))
            {
                var teamName        = Helper.MakeNameWithTimestamp("updated-team");
                var teamDescription = Helper.MakeNameWithTimestamp("updated description");
                var update          = new UpdateTeam(teamName)
                {
                    Description = teamDescription,
                    Privacy     = TeamPrivacy.Closed
                };

                var team = await _github.Organization.Team.Update(teamContext.TeamId, update);

                Assert.Equal(teamName, team.Name);
                Assert.Equal(teamDescription, team.Description);
                Assert.Equal(TeamPrivacy.Closed, team.Privacy);
            }
        }
Beispiel #12
0
        private UpdateTeam.Response UpdateTeamHandler(UpdateTeam command)
        {
            try
            {
                var existEntity = platform.GetEntity <ITeam>(command.Id);
                if (existEntity != null)
                {
                    existEntity.Name        = command.Team.Name;
                    existEntity.Description = command.Team.Description;
                    existEntity.Number      = command.Team.Number;
                    existEntity.IsActive    = command.IsActive;
                    platform.Submit(existEntity);
                }

                return(new UpdateTeam.Response());
            }catch (Exception ex)
            {
                throw ex;
            }
        }
 /// <summary>
 /// Returns updated <see cref="Team" /> for the current org.
 /// </summary>
 /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
 /// <returns>Updated <see cref="Team"/></returns>
 public IObservable<Team> UpdateTeam(int id, UpdateTeam team)
 {
     return _client.UpdateTeam(id, team).ToObservable();
 }
        /// <summary>
        /// Returns updated <see cref="Team" /> for the current org.
        /// </summary>
        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
        /// <returns>Updated <see cref="Team"/></returns>
        public IObservable<Team> Update(int id, UpdateTeam team)
        {
            Ensure.ArgumentNotNull(team, "team");

            return _client.Update(id, team).ToObservable();
        }
 public Task Update([FromBody] UpdateTeam request) => _bus.Request(request);
Beispiel #16
0
 public ITeamModel Any(UpdateTeam request)
 {
     return(workflow.Update(request));
 }
        /// <summary>
        /// Returns updated <see cref="Team" /> for the current org.
        /// </summary>
        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
        /// <returns>Updated <see cref="Team"/></returns>
        public IObservable <Team> Update(int id, UpdateTeam team)
        {
            Ensure.ArgumentNotNull(team, nameof(team));

            return(_client.Update(id, team).ToObservable());
        }
 /// <summary>
 /// Returns updated <see cref="Team" /> for the current org.
 /// </summary>
 /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
 /// <returns>Updated <see cref="Team"/></returns>
 public IObservable <Team> UpdateTeam(int id, UpdateTeam team)
 {
     return(_client.UpdateTeam(id, team).ToObservable());
 }