Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        rptEntities.DataSource = teamFac.GetAllEntities();
        rptEntities.DataBind();

        int id = Convert.ToInt32(Request.QueryString["ID"]);
        if (id != 0)
        {
            ShowContent.Attributes.Remove("hidden");
            member = teamFac.GetEntityByID(id);
            PopulateFields();

        }
        else if (Request.QueryString["NewItem"] == "true")
        {
            ShowContent.Attributes.Remove("hidden");
            member = new TeamMember();
        }
        else if (Convert.ToInt32(Request.QueryString["DID"]) > 0)
        {
            int deleteID = Convert.ToInt32(Request.QueryString["DID"]);

            teamFac.Delete(deleteID);

            var uri = new Uri(Request.Url.AbsoluteUri);
            string path = uri.GetLeftPart(UriPartial.Path);
            Response.Redirect(path);
        }
    }
Пример #2
0
 public void InitTeam(TeamElement teamElement)
 {
     InitParty(teamElement);
     bool foundMe = false;
     var currentUsername = GwupeClientAppContext.CurrentAppContext.CurrentUserManager.CurrentUser.Username;
     _teamMembers.Clear();
     _playerRequest = null;
     foreach (var teamMemberElement in teamElement.teamMembers)
     {
         var teamMember = new TeamMember(teamMemberElement);
         _teamMembers.Add(teamMember);
         Logger.Debug("Adding team member " + teamMember);
         if (!foundMe && teamMember.Username.Equals(currentUsername))
         {
             Logger.Debug("Found myself in the team list, adding my membership status " + teamMember);
             Admin = teamMember.Admin;
             Player = teamMember.Player;
             foundMe = true;
         }
     }
     if (!foundMe)
     {
         Admin = false;
         Player = PlayerMembership.none;
     }
 }
Пример #3
0
        public PlayerAI(TeamMember player)
        {
            this.player = player;
            instruction = TeamAI.Instruction.None;
            action = Action.NoAction;
            actionTimeSpan = TimeSpan.Zero;

            parentAi = player.Team.AI;
        }
Пример #4
0
        public void CurrentTeamMemberGetsProcessed()
        {
            var repo = new Mock<ITeamMemberRepository>();
            var processor = new Mock<ITeamPulseProcessor>();
            var teamMember = new TeamMember();

            TeamPulseCreator system = new TeamPulseCreator(repo.Object, processor.Object);
            system.Process(2016, 4);


        }
 public void Verify_Add_Should_AddTheEntityToTheContext()
 {
     // Arrange
     Mock<IDbSet<TeamMember>> mockSetTeamMembers;
     var mockContext = TeamMembersMockingSetup.DoMockingSetupForContext(false, out mockSetTeamMembers);
     var repository = new TeamMembersRepository(mockContext.Object);
     var teamMembers = new TeamMember { Active = true, CustomKey = "SALVATORE-RAA", };
     // Act
     repository.Add(teamMembers);
     // Assert
     mockSetTeamMembers.Verify(x => x.Add(teamMembers), Times.Once);
 }
Пример #6
0
	void Awake()
	{
		mc = GetComponent<MoveController> ();
		ac = GetComponent<AttackController> ();
		tm = GetComponent<TeamMember> ();
		hp = GetComponent<Health> ();
		xp = GetComponent<Experience> ();
		an = GetComponent<Animator> ();
		rb = GetComponent<Rigidbody2D> ();
		sr = GetComponent<SpriteRenderer> ();
		bc = GetComponent<BoxCollider2D> ();

	}
Пример #7
0
        public void TeamMemberConstructorTest()
        {
            // Arrange
            var expectedLastName = "LastName Test";
            var expectedFirstName = "FirstName Test";

            // Act
            var teamMember = new TeamMember(expectedFirstName, expectedLastName);
            var actualLastName = teamMember.LastName;
            var actualFirstName = teamMember.FirstName;

            // Assert
            Assert.AreEqual(expectedLastName, actualLastName);
            Assert.AreEqual(expectedFirstName, actualFirstName);
        }
        public override async Task OnNavigateTo(object parameter)
        {
            await base.OnNavigateTo(parameter);

            var teamMember = parameter as TeamMember;
            if (teamMember != null)
            {
                this.TeamMember = teamMember;
            }
            else
            {
                await this._dialogService.ShowMessageAsync("Navigation error", "TeamMember cannot be null");
                this._navigationService.GoBack();
            }
        }
Пример #9
0
    void OnGUI()
    {
        var isEnterPressed = (Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.Return);
        if (isEnterPressed && chatActive)
        {
            if (writeMessage == true)
            {
                writeMessage = false;
                nm.UnFreeze();
            }
            else
            {
                writeMessage = true;
                nm.FreezeForChat();
            }
        }

        var isLShiftPressed = (Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.Tab);
        if (isLShiftPressed && writeMessage)
        {
            tm = GameObject.FindObjectOfType<TeamMember>();

            if (team)
                team = false;
            else if (tm.teamID == 1 || tm.teamID == 2)
                team = true;
        }

        if(writeMessage)
        {
            GUI.BeginGroup(new Rect(Screen.width / 4, Screen.height / 8 * 7, Screen.width / 2, 50));

            if (!team)
                GUI.Label(new Rect(0, 0, 50, 50), "ALL");
            else
                GUI.Label(new Rect(0, 0, 50, 50), "TEAM");

            GUI.SetNextControlName("message");
            message = GUI.TextField(new Rect(50, 0, Screen.width / 2 - 50, 20), message.ToString());

            if (GUI.GetNameOfFocusedControl() == string.Empty)
                GUI.FocusControl("message");

            //end the group we started above
            GUI.EndGroup();
        }
    }
Пример #10
0
        public void TeamMemberIdTest()
        {
            // Arrange
            var teamMemberFirstName = "Test";
            var teamMemberLastName = "TeamMember";
            var teamMember = new TeamMember(teamMemberFirstName, teamMemberLastName);
            var newExpected = 1;

            // Act
            var originalActual = teamMember.Id;
            teamMember.Id = newExpected;
            var newActual = teamMember.Id;

            // Assert
            Assert.AreEqual(0, originalActual);
            Assert.AreEqual(newExpected, newActual);
        }
Пример #11
0
        public void LastNameTest()
        {
            // Arrange
            var originalExpected = "LastName Test";
            var expectedFirstName = "FirstName Test";
            var teamMember = new TeamMember(expectedFirstName, originalExpected);
            var newExpected = "New LastName";

            // Act
            var originalActual = teamMember.LastName;
            teamMember.LastName = newExpected;
            var newActual = teamMember.LastName;

            // Assert
            Assert.AreEqual(originalExpected, originalActual);
            Assert.AreEqual(newExpected, newActual);
        }
Пример #12
0
    // Update is called once per frame
    void Update()
    {
        if (writeMessage == true)
            nm.FreezeForChat();

        if(message != "" && !writeMessage)
        {
            tm = GameObject.FindObjectOfType<TeamMember>();

            if(team)
                nm.AddChatMessage(nm.GetPlayerName() + ": " +  message, tm.teamID);
            else
                nm.AddChatMessage(nm.GetPlayerName() + ": " + message, -1);     //-1 to message everyone on the server

            message = "";
        }
    }
Пример #13
0
    public void OnTeamMemberItemClick(TeamMember member)
    {
        if (member == null)
        {
            return;
        }

        TeamMemberListItemLogic[] aItem = m_TeamInfoGrid.GetComponentsInChildren <TeamMemberListItemLogic>();
        for (int i = 0; i < aItem.Length; i++)
        {
            if (aItem[i].m_selfTeamMember == null)
            {
                continue;
            }

            if (aItem[i].m_selfTeamMember.Guid != member.Guid)
            {
                aItem[i].UpdateChoose(false);
            }
        }

        UpdateTeamMemberModel(member);
    }
Пример #14
0
        public void AddUserToTeam(int id, TeamMember member)
        {
            Data.TeamMember teamMember = null;

            var team = _teamRepo.FindById(id);

            if (team.TeamMembers.Any(i => i.UserId == member.EmailAddress))
            {
                teamMember = team.TeamMembers.Where(i => i.UserId == member.EmailAddress).First();
            }
            else
            {
                teamMember = new Data.TeamMember()
                {
                    UserId = member.EmailAddress
                };
                team.TeamMembers.Add(teamMember);
            }

            teamMember.IsAdmin = member.IsAdmin;

            _teamRepo.SaveChanges();
        }
        public void onSecondaryWeaponSelect(string memberKey)
        {
            //create the item swap panel
            GameObject itemSwapView = Instantiate(itemSwapMenu);

            itemSwapView.transform.SetParent(canvas, false);

            //get the team member definition
            TeamMember teamMember = employedMembers.members[memberKey];

            //create an action that is performed once the swap weapon has been chosen
            Action <WeaponDefinition> swapSecondary = (weaponDefinition) => {
                //update the weapon definition on the team members
                teamMember.secondaryWeapon = weaponDefinition;
                //update the view
                updateTeamMemberPanel(memberKey);
                //destroy the item swap panel
                Destroy(itemSwapView);
            };

            //setup the panels in the item swap view
            itemSwapView.GetComponent <ItemSwapMenu>().setupSecondaryMenu(teamMember.secondaryWeapon, swapSecondary);
        }
        public ActionResult Confirm(string invite, string status)
        {
            string passPhrase = System.Configuration.ConfigurationManager.AppSettings.Get("passPhrase");
            string data       = EncryptDecrypt.DecryptString(invite, passPhrase);
            var    details    = data.Split(new char[] { ',' });

            ViewBag.ErrorMessage = string.Empty;
            ViewBag.Message      = string.Empty;

            string teamId   = details[0];
            string inviteId = details[1];

            HttpClient client = WebApiServiceLogic.CreateClient(ServiceType.OnPremiseWebApi);
            TeamMember mem    = new TeamMember();

            mem.Id            = Convert.ToInt32(inviteId);
            mem.TeamId        = Convert.ToInt32(teamId);
            mem.InviteeStatus = status;
            var response = client.PutAsJsonAsync("api/TeamMember/UpdateInvitation", mem).Result;

            if (response.IsSuccessStatusCode)
            {
                var stat = (InviteStatus)Enum.Parse(typeof(InviteStatus), status);
                if (stat == InviteStatus.Accepted)
                {
                    ViewBag.Message = "You have accepted the invitation. Click below to Login with credentials which was shared through Mail";
                }
            }
            else
            {
                var jsonData = response.Content.ReadAsStringAsync().Result;
                var obj      = JsonConvert.DeserializeObject <ResponseFailure>(jsonData);
                ViewBag.ErrorMessage = response.ReasonPhrase + " - " + obj.Message;
            }

            return(View());
        }
Пример #17
0
    void DoTargetting()
    {
        // Do we have an enemy target in range?
        TeamMember closest = null;
        float      dist    = 0;

        foreach (TeamMember tm in GameObject.FindObjectsOfType <TeamMember>())          // WARNING: SLOW!
        {
            if (tm == GetComponent <TeamMember>())
            {
                // How Zen! We found ourselves.
                // Loop to the next possible target!
                continue;
            }

            if (tm.teamID == 0 || tm.teamID != GetComponent <TeamMember>().teamID)
            {
                // Target is on the enemy team!
                float d = Vector3.Distance(tm.transform.position, transform.position);
                if (d <= aggroRange)
                {
                    // Target is in range!

                    // TODO: Do a raycast to make sure we actually have line of sight!

                    // Is the target closer than the last target we found?
                    if (closest == null || d < dist)
                    {
                        closest = tm;
                        dist    = d;
                    }
                }
            }
        }

        myTarget = closest;
    }
Пример #18
0
        public ActionResult JoinMyTeam(string id)
        {
            // For users who received an email with the join link to join a team.
            // The user must have created an account by now and coming back to this link after registration

            try
            {
                var teamMemberRequest = repo.GetTeamMemberRequest(id);
                if (teamMemberRequest != null)
                {
                    var user = repo.GetUser(teamMemberRequest.EmailAddress);
                    if (user.ID == UserID)
                    {
                        //Add to the team
                        var teamMember = new TeamMember {
                            MemberID = UserID, TeamID = teamMemberRequest.TeamID, CreatedByID = teamMemberRequest.CreatedByID
                        };
                        repo.SaveTeamMember(teamMember);

                        //Keep that team as default team for the user
                        SetUserIDToSession(UserID, teamMemberRequest.TeamID, user.FirstName);

                        var userService = new UserService(repo);
                        userService.SaveActivityForNewUserJoinedTeam(teamMemberRequest, user, UserID, TeamID);

                        //Correct user
                        return(View("WelcomeToTeam"));
                    }
                }
                return(View("NotFound"));
            }
            catch (Exception ex)
            {
                log.Error(ex);
                return(View("Error"));
            }
        }
 public void Arrange()
 {
     SetUp();
     _accountTeamMembersRepository = new Mock <IAccountTeamRepository>();
     _account = new Domain.Data.Entities.Account.Account {
         Name = "Test", Id = 1
     };
     _teamMember = new TeamMember
     {
         Id        = 1,
         Email     = "*****@*****.**",
         AccountId = _account.Id,
         Role      = Role.Owner,
         UserRef   = "kaka-kakah"
     };
     _teamMembers = new List <TeamMember> {
         _teamMember
     };
     _accountTeamMembersRepository.Setup(repository => repository.GetAccountTeamMembersForUserId("1", _teamMember.UserRef)).ReturnsAsync(new List <TeamMember>(_teamMembers));
     RequestHandler = new GetAccountTeamMembersHandler(RequestValidator.Object, _accountTeamMembersRepository.Object);
     Query          = new GetAccountTeamMembersQuery {
         ExternalUserId = "kaka-kakah", HashedAccountId = "1"
     };
 }
Пример #20
0
        public bool ValidateTeamMembers(TeamMember TeamMember)
        {
            if (string.IsNullOrEmpty(TeamMember.FullName))
            {
                return(false);
            }

            if (string.IsNullOrEmpty(TeamMember.EmailAddress))
            {
                return(false);
            }

            if (string.IsNullOrEmpty(TeamMember.LinkedInUrl))
            {
                return(false);
            }

            if (string.IsNullOrEmpty(TeamMember.TwitterUrl))
            {
                return(false);
            }

            return(true);
        }
Пример #21
0
    public void RemoveMemberAt(int index)
    {
        GameObject go = members[index];

        if (members != null)
        {
            members.RemoveAt(index);
        }
        rosterUi.RemoveItem(go);
        TeamMember teamMember = go.GetComponent <TeamMember>();

        if (teamMember != null && teamMember.onLeaveTeam != null)
        {
            teamMember.onLeaveTeam.Invoke(this);
        }
        if (index == currentIndex)
        {
            Prev();
        }
        else if (index > currentIndex)
        {
            --currentIndex;
        }
    }
        public void EnableTeamMember(EnableTeamMemberCommand command)
        {
            var tenantId = new TenantId(command.TenantId);

            ApplicationServiceLifeCycle.Begin();
            try
            {
                var teamMember = this.teamMemberRepository.Get(tenantId, command.Username);
                if (teamMember != null)
                {
                    teamMember.Enable(command.OccurredOn);
                }
                else
                {
                    teamMember = new TeamMember(tenantId, command.Username, command.FirstName, command.LastName, command.EmailAddress, command.OccurredOn);
                    this.teamMemberRepository.Save(teamMember);
                }
                ApplicationServiceLifeCycle.Success();
            }
            catch (Exception ex)
            {
                ApplicationServiceLifeCycle.Fail(ex);
            }
        }
        public ActionResult Create(TeamMembercreateViewModel Model)
        {
            if (ModelState.IsValid)
            {
                if (Model.File != null)
                {
                    string uploads  = Path.Combine(_hosting.WebRootPath, @"AdminRoot\img\Teammember");
                    string fullPath = Path.Combine(uploads, Model.FullName + Model.File.FileName);
                    Model.File.CopyTo(new FileStream(fullPath, FileMode.Create));
                }


                var TeamMember = new TeamMember
                {
                    FullName    = Model.FullName,
                    TitleJob    = Model.TitleJob,
                    FBUrllink   = Model.FBUrllink,
                    TWUrllink   = Model.TWUrllink,
                    LinkedInUrl = Model.LinkedInUrl,

                    ImageUrl = Model.FullName + Model.File.FileName
                };



                _Team.Entity.Insert(TeamMember);
                _Team.Save();



                return(RedirectToAction("Index"));
            }


            return(View(Model));
        }
Пример #24
0
        public JsonResult AddMember(TeamMember teamMember, string member, int TeamId)
        {
            if (!ModelState.IsValid)
            {
                Response.StatusCode = 400;

                var errorList = ModelState.Values.SelectMany(m => m.Errors)
                                .Select(e => e.ErrorMessage)
                                .ToList();

                return(Json(errorList, JsonRequestBehavior.AllowGet));
            }
            teamMember.TeamId = TeamId;

            string[] emails = member.Split(' ');
            foreach (var email in emails)
            {
                string e   = email.Split(',', '\t', ';')[0];
                var    usr = db.Users.FirstOrDefault(u => u.Email == e);
                if (usr != null)
                {
                    teamMember.UserId = usr.Id;
                }
                db.TeamMembers.Add(teamMember);
                db.SaveChanges();
            }
            teamMember.Team = db.Teams.Find(teamMember.TeamId);
            teamMember.User = db.Users.Find(teamMember.UserId);

            return(Json(new {
                teamMember.Id,
                User = teamMember.User.Name + " " + teamMember.User.Surname,
                teamMember.User.Photo,
                teamMember.User.Position
            }, JsonRequestBehavior.AllowGet));
        }
Пример #25
0
        private GameObject createTeamBreakdownPanel(string memberKey, TeamMember teamMember)
        {
            //instantiating the new team member panel and adding to the view
            Transform memberPanel = Instantiate(teamMemberPanel, Vector3.zero, Quaternion.identity).transform;

            memberPanel.SetParent(teamBreakdownView, false);

            //Set the panel title to something meaningful
            string name = PeopleUtil.getRankDetails(teamMember.rank).abbreviation + ". " + teamMember.forename + " " + teamMember.surname;

            memberPanel.Find("Name").GetComponent <Text>().text = name;

            //tting the rank image on the panel
            memberPanel.Find("RankImage").GetComponent <Image>().sprite = rankSprites[teamMember.rank];

            //set the primary weapon text on the panel
            memberPanel.Find("PrimaryWeapon").GetComponent <Text>().text = teamMember.primaryWeapon.name + "\n" + teamMember.primaryWeapon.minimumDamage + " - " + teamMember.primaryWeapon.maximumDamage;

            //set the secondary weapon text on the panel
            memberPanel.Find("SecondaryWeapon").GetComponent <Text>().text = teamMember.secondaryWeapon.name + "\n" + teamMember.secondaryWeapon.minimumDamage + " - " + teamMember.secondaryWeapon.maximumDamage;

            //set the primary weapon text on the panel
            memberPanel.Find("ThrowableWeapon").GetComponent <Text>().text = teamMember.throwableWeapon.name + "\n" + teamMember.throwableWeapon.minimumDamage + " - " + teamMember.throwableWeapon.maximumDamage;

            //set the secondary weapon text on the panel
            memberPanel.Find("Armour").GetComponent <Text>().text = teamMember.armour.name + "\n" + teamMember.armour.minimumDamage + " - " + teamMember.armour.maximumDamage;

            //set the onclick listener for the primary weapon allowing it to be swapped
            memberPanel.Find("PrimarySelectButton").GetComponent <Button>().onClick.AddListener(() => { onPrimaryWeaponSelect(memberKey); });

            //set the onclick listener for the secondary weapon allowing it to be swapped
            memberPanel.Find("SecondarySelectButton").GetComponent <Button>().onClick.AddListener(() => { onSecondaryWeaponSelect(memberKey); });

            //return the newly created panel object
            return(memberPanel.gameObject);
        }
Пример #26
0
 private Task(int teamId,
              int sprintId,
              Team team,
              string name           = "",
              int storyPoints       = 0,
              string link           = "",
              int?memberId          = null,
              bool isCompleted      = false,
              int id                = 0,
              Sprint sprint         = null,
              TeamMember teamMember = null)
 {
     TeamId      = teamId;
     Team        = team;
     Name        = name;
     StoryPoints = storyPoints;
     Link        = link;
     SprintId    = sprintId;
     MemberId    = memberId;
     Completed   = isCompleted;
     Sprint      = sprint;
     TeamMember  = teamMember;
     Id          = id;
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="_codeTeam"></param>
        /// <returns></returns>
        public static List <pojo.TeamMember> readTeamMembers(String _codeTeam)
        {
            using (var context = new synupEntities())
            {
                List <TeamMember> toReturn = new List <TeamMember>();

                var query = from employee in context.Employees
                            join record in context.TeamHistories on employee.nif equals record.id_employee
                            where record.id_team.Equals(_codeTeam) && record.exitDate == null
                            select new
                {
                    Emp = employee,
                    His = record
                };

                foreach (var s in query)
                {
                    TeamMember tm = new TeamMember(s.Emp.nif, s.Emp.name, s.Emp.surname, s.His.entranceDay);
                    toReturn.Add(tm);
                }

                return(toReturn);
            }
        }
        public void UpdateTeamMember_ShouldUpdateTeamMember_WhenValidTeamMember()
        {
            var teamMemberUpdateDto = new TeamMemberUpdateDto
            {
                Id        = id,
                Email     = email,
                Firstname = firstname,
                Lastname  = lastname,
                IsActive  = isActive
            };

            var updatedTeamMember = new TeamMember
            {
                Id        = id,
                Email     = teamMemberUpdateDto.Email,
                Firstname = teamMemberUpdateDto.Firstname,
                Lastname  = teamMemberUpdateDto.Lastname,
                IsActive  = isActive,
                TeamId    = teamId
            };

            _unitOfWork.Setup(x => x.TeamMemberRepository.UpdateTeamMember(It.Is <TeamMember>(x => x.Email == teamMemberUpdateDto.Email &&
                                                                                              x.Firstname == teamMemberUpdateDto.Firstname &&
                                                                                              x.Lastname == teamMemberUpdateDto.Lastname &&
                                                                                              x.Id == teamMemberUpdateDto.Id &&
                                                                                              x.IsActive == teamMemberUpdateDto.IsActive)))
            .Returns(updatedTeamMember);

            var result = _service.UpdateTeamMember(teamMemberUpdateDto);

            Assert.Equal(id, result.Id);
            Assert.Equal(email, result.Email);
            Assert.Equal(firstname, result.Firstname);
            Assert.Equal(lastname, result.Lastname);
            Assert.Equal(isActive, result.IsActive);
        }
Пример #29
0
        public ActionResult Edit([Bind(Include = "TeamMemberID,FirstName,LastName,Description,Affiliation,HomepageLink,Image")] TeamMemberEditViewModel teamMemberView)
        {
            if (ModelState.IsValid)
            {
                TeamMember teamMember = db.TeamMembers.Find(teamMemberView.TeamMemberID);;
                teamMember.FirstName    = teamMemberView.FirstName;
                teamMember.LastName     = teamMemberView.LastName;
                teamMember.Description  = teamMemberView.Description;
                teamMember.Affiliation  = teamMemberView.Affiliation;
                teamMember.HomepageLink = teamMemberView.HomepageLink;

                teamMember.DateModified   = DateTime.Now;
                teamMember.UserModifiedID = User.Identity.GetUserId();

                // Handle the image
                if (teamMemberView.Image != null && teamMemberView.Image.ContentLength > 0)
                {
                    if (!Auxiliaries.ValidImageTypes.Contains(teamMemberView.Image.ContentType))
                    {
                        ModelState.AddModelError("Image", "Choose an image in one of the following formats: GIF, JPG, or PNG.");
                    }
                    else
                    {
                        using (var reader = new BinaryReader(teamMemberView.Image.InputStream))
                        {
                            teamMember.Image = reader.ReadBytes(teamMemberView.Image.ContentLength);
                        }
                    }
                }

                db.Entry(teamMember).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(teamMemberView));
        }
Пример #30
0
        private List <TeamMember> GetTeamMembers(int teamId)
        {
            List <TeamMember> teamMembers = new();

            var players = _context.DoubleLeaguePlayers
                          .Where(x => x.DoubleLeagueTeamId == teamId)
                          .Select(x => new { UserId = x.UserId })
                          .Distinct()
                          .ToList();

            foreach (var player in players)
            {
                var user = _context.Users
                           .Where(x => x.Id == player.UserId)
                           .Select(m => new User
                {
                    Id        = m.Id,
                    FirstName = m.FirstName,
                    LastName  = m.LastName,
                    Email     = m.Email
                })
                           .FirstOrDefault();

                TeamMember teamMember = new TeamMember
                {
                    Id        = user.Id,
                    FirstName = user.FirstName,
                    LastName  = user.LastName,
                    Email     = user.Email
                };

                teamMembers.Add(teamMember);
            }

            return(teamMembers);
        }
Пример #31
0
        public static void PeopleInheritance()
        {
            TeamMember QLTeamMember = new TeamMember
            {
                FirstName   = "David",
                MiddleName  = "Slacker",
                LastName    = "Esseily",
                Anniversary = new DateTime(2013, 8, 26, 8, 30, 0),
                TeamLeader  = new Person("Kevin", "Lang"),
                Salary      = 50000
            };

            QLTeamMember.SaySomething("I like .NET");
            QLTeamMember.TeamLeader.SaySomething("David deserves less money");
            Logger.Log(string.Format("David's Salary is ${0}", QLTeamMember.Salary));
            var newSalary = QLTeamMember.GiveRaise(-10000);

            Logger.Log(string.Format("David's Salary is ${0}", newSalary));
            QLTeamMember.GiveRaise1(-10000);
            Logger.Log(string.Format("David's Salary is ${0}", QLTeamMember.Salary));
            QLTeamMember.AddVacationTime(-10);

            QLTeamMember.GiveRaise(-10, true);
        }
Пример #32
0
        public void SignUpServiceUnitTest_to_GetTeamMember_for_Null()
        {
            //Arrange
            List <AvailTeamMember> teams = new List <AvailTeamMember>();

            teams = null;
            List <TeamMember> members = new List <TeamMember>();
            var member = new TeamMember()
            {
                TeamId = 1
            };

            member = null;
            var mockRepoTask = new Mock <ITaskBacklogReposiory>();

            mockRepoTask.Setup(x => x.AllTeamMember()).Returns(members);
            TaskBacklogService obj = new TaskBacklogService(mockRepoTask.Object);
            //Act
            var res = obj.getTeamMember(1);

            res = teams;
            //Assert
            Assert.Null(res);
        }
Пример #33
0
        public void AllocateTeamMember_GivenReasonForAdmissionAndNoAdmissionTypeId_WherePatientHasNoTeamMembers()
        {
            // Arrange
            var            connection     = GetConnection();
            ListRepository listRepository = new ListRepository(connection);

            PatientService patientService = new PatientService(connection);

            Patient patient = new Patient()
            {
                Firstname   = _nameDataSet.FirstName(),
                Lastname    = _nameDataSet.LastName(),
                DateOfBirth = _dateDataSet.Past()
            };

            Guid patientId  = patientService.Create(patient);
            Guid facilityId = listRepository.GetFacilities().First(x => x.Name == "Tijger Mental Health Clinic Loevenstein").Id;
            Guid userId     = listRepository.GetFacilityUsers(facilityId).First().Id;

            TeamMember teamMember = new TeamMember()
            {
                FacilityId                  = facilityId,
                PatientId                   = patientId,
                ReasonForAdmissionName      = "G46.4 - Cerebellar stroke syndrome (I60-I67+)",
                ReasonForAdmissionTimestamp = _dateDataSet.Past(),
                UserIds = new Guid[] {
                    userId
                }
            };

            // Act

            patientService.AllocateTeamMember(teamMember);

            // Assert
        }
        public override DynamicDictionary BuildTableForTeam(IAssignmentTeam discussionTeam)
        {
            dynamic data = Builder.BuildTableForTeam(discussionTeam);

            data.Replies = new DynamicDictionary();

            TeamMember member = discussionTeam.Team.TeamMembers.FirstOrDefault();

            data.Replies.PostCount = 0;
            if (member != null)
            {
                data.Replies.PostCount = (from a in AllUserPosts
                                          where a.CourseUserID == member.CourseUserID &&
                                          a.DiscussionTeamID == (discussionTeam as DiscussionTeam).ID &&
                                          a.IsReply
                                          select a).Count();
            }

            data.Replies.CourseUserID     = member.CourseUserID;
            data.Replies.AssignmentID     = discussionTeam.AssignmentID;
            data.Replies.DiscussionTeamID = (discussionTeam as DiscussionTeam).ID;

            return(data);
        }
Пример #35
0
        public void Process(TeamViewModel source, Team destination, ResolutionContext context)
        {
            List <TeamMember> destinationMembers = new List <TeamMember>();

            foreach (TeamMemberViewModel member in source.Members)
            {
                if (member.Id == Guid.Empty)
                {
                    TeamMember newMember = context.Mapper.Map <TeamMember>(member);
                    destinationMembers.Add(newMember);
                }
                else
                {
                    TeamMember destinationMember = destination.Members.FirstOrDefault(x => x.Id == member.Id);
                    if (destinationMember != null)
                    {
                        context.Mapper.Map(member, destinationMember);
                        destinationMembers.Add(destinationMember);
                    }
                }
            }

            destination.Members = destinationMembers;
        }
        public ActionResult AddNewTeamMember(string teamMemberName)
        {
            var newTeamMember = new TeamMember
            {
                Headline = teamMemberName,
                PublishDate = DateTime.Now,
                LinkPath = "/Team/" + MakeUrl(teamMemberName),
                Culture = _curCult
            };
            try
            {
                _context.TeamMembers.Add(newTeamMember);

                if (_settings.CreateContentOnAllLanguages)
                {
                    var cultList = _settings.ImplementedCultures;
                    cultList.Remove(_curCult);
                    foreach (var cult in cultList)
                    {
                        var newItem = new TeamMember
                        {
                            Headline = teamMemberName,
                            PublishDate = DateTime.Now,
                            LinkPath = "/Team/" + MakeUrl(teamMemberName),
                            Culture = cult
                        };
                        _context.TeamMembers.Add(newItem);
                    }
                }

                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                return Json(new { status = "SPCD: ERR - " + ex.Message });
            }

            return Json(new { status = "SPCD: TMADDED", teamMember = newTeamMember });
        }
Пример #37
0
 private void selectActionForDefendPlayer()
 {
     action = Action.DefendPlayer;
     actionTeamMember = instructionTeamMember;
 }
Пример #38
0
 public TeamMemberForm(TeamMember tm)
 {
     this.tm = tm;
     InitializeComponent();
 }
 public void Update(TeamMember entity)
 {
     _repoTeamMember.Update(entity);
     _repoTeamMember.SaveChanges();
 }
        public async Task <IActionResult> EditTeam(int?Id, int[] teamCnt, string[] selectLst)
        {
            //SubGameId
            if (Id == null)
            {
                return(NotFound());
            }

            var subGame = _context.SubGames.Single(g => g.ID == Id);  //gameID, round

            var teamMembers = await _context.TeamMembers
                              .Include(t => t.Bowler)
                              //    .ThenInclude(b => b.BowlerAverage)
                              .Include(t => t.Team)
                              .Where(t => t.Team.SubGameID == Id)
                              .OrderBy(t => t.Team.TeamOrder)
                              .ThenBy(t => t.Sequence)
                              .ToListAsync();

            //팀수정
            var AddTeamMembers  = new List <TeamMember>();
            var EditTeamMembers = new List <TeamMember>();
            var EditMember      = new TeamMember();


            var         imsiTMId            = teamMembers.Select(t => t.Team.ID).Distinct().ToList();
            int         teamMemberTeamIDCnt = imsiTMId.Count();
            List <Team> team = new List <Team>();


            int cnt  = 0;
            int tcnt = 0;

            int teamCntCnt = teamCnt.Count();


            //팀 추가 시 정리 부분
            if (teamMemberTeamIDCnt < teamCntCnt)
            {
                for (int i = teamMemberTeamIDCnt; i < teamCntCnt; i++)
                {
                    team.Add(new Team
                    {
                        SubGameID = Id ?? 0,
                        TeamName  = ((Char)(65 + i)).ToString(),
                        TeamOrder = i
                    });
                }

                _context.AddRange(team);


                //팀 추가에 따른 팀 순서 새로 정리
                foreach (var item in team)
                {
                    imsiTMId.Add(item.ID);
                }
            }



            //팀 삭제 시 정리 부분
            if (teamMemberTeamIDCnt > teamCntCnt)
            {
                for (int i = teamCntCnt; i < teamMemberTeamIDCnt; i++)
                {
                    team.Add(_context.Teams.Where(t => t.ID == imsiTMId[i]).Single());
                    //teamMembers.RemoveRange((teamMembers.Where(t => t.TeamID == teamMemberTeamID[i]).ToList());
                    var imsi = (teamMembers.Where(t => t.TeamID == imsiTMId[i]).ToList());
                    foreach (var item in imsi)
                    {
                        teamMembers.Remove(item);
                    }


                    _context.RemoveRange(team);
                }

                //팀 추가에 따른 팀 순서 새로 정리
                foreach (var item in team)
                {
                    imsiTMId.Remove(item.ID);
                }
            }


            //팀 추가 삭제에 따른 정리 부분
            teamMemberTeamIDCnt = imsiTMId.Count();
            int[] teamMemberTeamID = new int[teamMemberTeamIDCnt];


            int halfcnt = teamMemberTeamIDCnt % 2 == 0 ? teamMemberTeamIDCnt / 2 : teamMemberTeamIDCnt / 2 + 1;


            for (int i = 0; i < teamMemberTeamIDCnt; i++)
            {
                int idx = 0;

                if (i < halfcnt)
                {
                    idx = i * 2;
                }
                else
                {
                    idx = (i - halfcnt) * 2 + 1;
                }
                teamMemberTeamID[i] = imsiTMId[idx];
            }



            foreach (var item in teamCnt)
            {
                for (int i = 0; i < item; i++)
                {
                    EditMember = teamMembers.Find(t => t.BowlerID == selectLst[cnt]);

                    if (EditMember == null)
                    {
                        AddTeamMembers.Add(new TeamMember
                        {
                            BowlerID = selectLst[cnt],
                            Score    = 0,
                            TeamID   = teamMemberTeamID[tcnt], //(teamMemberTeamIDCnt > tcnt) ? teamMemberTeamID[tcnt] : team[tcnt - (teamMemberTeamIDCnt)].ID,
                            Average  = _context.BowlerAverages.Find(selectLst[cnt]).Average,
                            Sequence = i
                        });
                    }
                    else
                    {
                        if (EditMember.TeamID != teamMemberTeamID[tcnt] || //((teamMemberTeamIDCnt > tcnt) ? teamMemberTeamID[tcnt] : team[tcnt - (teamMemberTeamIDCnt)].ID) ||
                            EditMember.Sequence != i)
                        {
                            EditMember.TeamID   = teamMemberTeamID[tcnt]; //(teamMemberTeamIDCnt > tcnt) ? teamMemberTeamID[tcnt] : team[tcnt - (teamMemberTeamIDCnt)].ID;
                            EditMember.Sequence = i;
                            EditTeamMembers.Add(EditMember);
                        }

                        teamMembers.Remove(EditMember);
                    }
                    cnt++;
                }

                tcnt++;
            }

            if (AddTeamMembers.Count() > 0)
            {
                _context.AddRange(AddTeamMembers);
            }

            if (EditTeamMembers.Count() > 0)
            {
                _context.UpdateRange(EditTeamMembers);
            }

            if (teamMembers.Count() > 0)
            {
                _context.RemoveRange(teamMembers);
            }

            _context.SaveChanges();


            return(RedirectToAction(nameof(Index), new { Id = subGame.GameID, game = subGame.Round }));
        }
Пример #41
0
 /// <summary>
 /// Créez un nouvel objet TeamMember.
 /// </summary>
 /// <param name="teammemberid">Valeur initiale de teammemberid.</param>
 /// <param name="teammembername">Valeur initiale de teammembername.</param>
 /// <param name="teammemberextension">Valeur initiale de teammemberextension.</param>
 /// <param name="issupervisor">Valeur initiale de issupervisor.</param>
 public static TeamMember CreateTeamMember(global::System.Guid teammemberid, string teammembername, string teammemberextension, bool issupervisor)
 {
     TeamMember teamMember = new TeamMember();
     teamMember.teammemberid = teammemberid;
     teamMember.teammembername = teammembername;
     teamMember.teammemberextension = teammemberextension;
     teamMember.issupervisor = issupervisor;
     return teamMember;
 }
Пример #42
0
	// Use this for initialization
	void Start () {
        tm = GetComponent<TeamMember>();
        pv = GetComponent<PhotonView>();
    }
 public void Verify_MapToEntity_WithExistingEntity_AssignsTeamMemberProperties()
 {
     // Arrange
     var mapper = new TeamMemberMapper();
     var model = TeamMembersMockingSetup.DoMockingSetupForTeamMemberModel();
     // Act
     ITeamMember existingEntity = new TeamMember { Id = 1 };
     mapper.MapToEntity(model.Object, ref existingEntity);
     // Assert
     // <None>
     // Related Objects
     Assert.Equal(model.Object.TeamId, existingEntity.TeamId);
     Assert.Equal(model.Object.CharacterId, existingEntity.CharacterId);
     // Associated Objects
     // <None>
 }
Пример #44
0
	void DoTargetting() {
		// Do we have an enemy target in range?
		TeamMember closest = null;
		float dist = 0;
		foreach(TeamMember tm in GameObject.FindObjectsOfType<TeamMember>()) {	// WARNING: SLOW!
			if(tm == GetComponent<TeamMember>()) {
				// How Zen! We found ourselves.
				// Loop to the next possible target!
				continue;
			}
			
			if(tm.teamID==0 || tm.teamID != GetComponent<TeamMember>().teamID) {
				// Target is on the enemy team!
				float d = Vector3.Distance(tm.transform.position, transform.position);
				if( d <= aggroRange ) {
					// Target is in range!
					
					// TODO: Do a raycast to make sure we actually have line of sight!
					
					// Is the target closer than the last target we found?
					if(closest==null || d < dist) {
						closest = tm;
						dist = d;
					}
				}
			}
		}

		myTarget = closest;
	}
Пример #45
0
 public void AppointAsChairman(TeamMember member)
 {
     Enforce.That(member.IsPartOf(_teamId), Sorry.NotPartOfTheTeam);
       Enforce.That(member.IsMemberSinceAtLeastTwoYears(), Sorry.NotMemberSinceAtLeastTwoYears);
       _chairman = member.TeamMemberId;
 }
        /// <summary>
        /// Finds the team with a mean closest to the member's rating change value.
        /// </summary>
        private static Team FindClosestTeam(List<Team> teams, TeamMember teamMember)
        {
            Team closestTeam = null;
            var closestDistance = double.MaxValue;

            foreach (var team in teams)
            {
                var currentDistance = GetTeamMemberDistanceToTeam(team, teamMember);
                if (currentDistance < closestDistance)
                {
                    closestTeam = team;
                    closestDistance = currentDistance;
                }
            }

            return closestTeam;
        }
Пример #47
0
 public void AppointChairman(TeamMember member)
 {
     member.GuardAppointmentAsChairman(_teamId);
       _chairman = member.Id;
 }
 /// <summary>
 /// Removes the member from all teams.
 /// </summary>
 private static void RemoveMemberFromTeam(List<Team> teams, TeamMember teamMemberToRemove)
 {
     foreach (var team in teams)
     {
         for (var i = 0; i < team.TeamMembers.Count; i++)
         {
             var member = team.TeamMembers[i];
             if (member.CharacterID == teamMemberToRemove.CharacterID)
             {
                 team.TeamMembers.RemoveAt(i);
             }
         }
     }
 }
Пример #49
0
 public static bool HasTeam(this TeamMember member)
 {
     return(member.TeamId.HasValue);
 }
 /// <summary>
 /// Gets the distance between the team and team member. 
 /// This is using the basic distance formula (as if they were points on a graph), 
 /// and should eventually be replaced with the sum of square differences formula. 
 /// </summary>
 private static double GetTeamMemberDistanceToTeam(Team team, TeamMember teamMember)
 {
     var ratingDiff = team.MeanRating - teamMember.CurrentRating;
     var ratingChangeDiff = team.MeanRatingChange - teamMember.RatingChangeValue;
     return Math.Sqrt(Math.Pow(ratingDiff, 2) + Math.Pow(ratingChangeDiff, 2));
 }
Пример #51
0
        public void AssignTaskVolunteer(TaskId taskId, TeamMember volunteer)
        {
            var task = LoadTask(taskId);

            task.AssignVolunteer(volunteer);
        }
Пример #52
0
 /// <summary>
 /// Il n'existe aucun commentaire pour TeamMember dans le schéma.
 /// </summary>
 public void AddToTeamMember(TeamMember teamMember)
 {
     base.AddObject("TeamMember", teamMember);
 }
        public void Delete(TeamMember entity)
        {
            _repoTeamMember.Delete(entity);

            _repoTeamMember.SaveChanges();
        }
Пример #54
0
 public override void Execute(TeamMember TM)
 {
     throw new NotImplementedException();
 }
Пример #55
0
 public void AppointAsChairman(TeamMember member)
 {
     Enforce.That(member.IsPartOf(_teamId), Sorry.NotPartOfTheTeam);
     Enforce.That(member.IsMemberSinceAtLeastTwoYears(), Sorry.NotMemberSinceAtLeastTwoYears);
     _chairman = member.TeamMemberId;
 }
Пример #56
0
        private void selectActionForDefendClosestPlayer()
        {
            Vector2 ballPos = parentAi.Team.Manager.Ball.Position;
            TeamMember closest = null;
            foreach (TeamMember m in parentAi.Opposition.Members) {
                if (closest == null
                    || Vector2.DistanceSquared(m.Position, ballPos) < Vector2.DistanceSquared(closest.Position, ballPos)) {
                    closest = m;
                }
            }

            action = Action.DefendPlayer;
            actionTeamMember = closest;
        }
Пример #57
0
        private void selectActionForDefendArea()
        {
            if (Vector2.DistanceSquared(player.Position, instructionPosition) < instructionRadius * instructionRadius) {
                /* Where should we go? */
                Vector2 ballPos = parentAi.Team.Manager.Ball.Position;
                TeamMember closest = null;
                foreach (TeamMember m in parentAi.Opposition.Members) {
                    if (Vector2.DistanceSquared(m.Position, actionPosition) < actionRadius * actionRadius) {
                        if (closest == null
                            || Vector2.DistanceSquared(m.Position, ballPos) < Vector2.DistanceSquared(closest.Position, ballPos)) {
                            closest = m;
                        }
                    }
                }

                if (closest == null) {
                    /* Move to Point nearest ball-carrier within our radius */
                    Vector2 direction = (ballPos - instructionPosition);
                    direction.Normalize();

                    actionPosition = instructionPosition + direction * instructionRadius;
                    action = Action.MoveToPosition;
                    return;
                }

                /* GOT IT! */
                if (closest.HasBall) {
                    actionTeamMember = closest;
                    action = Action.DefendPlayer;
                }
                return;
            }

            action = Action.MoveToPosition;
            actionPosition = instructionPosition;
        }
Пример #58
0
        string GetRemainingDescription(TeamMember player)
        {
            if (player.Remaining > 0) return "You have " + player.Remaining.ToString("c") + " remaining to pay";
            if (player.Credit < 0) return "You have " + (-player.Credit).ToString("c") + " credit for next season";

            return "Thanks, your fees are fully paid.";
        }