private void buttonEditMember_Click(object sender, EventArgs e) { // this button should only be enabled if a team member is selected System.Diagnostics.Debug.Assert(listBoxTeamMembers.SelectedIndex != -1); int nIndex = listBoxTeamMembers.SelectedIndex; m_strSelectedMember = (string)listBoxTeamMembers.SelectedItem; System.Diagnostics.Debug.Assert(_dataTeamMembers.ContainsKey(m_strSelectedMember)); TeamMemberData theMemberData = _dataTeamMembers[m_strSelectedMember]; EditMemberForm dlg = new EditMemberForm(theMemberData); if (dlg.ShowDialog() != DialogResult.OK) { return; } Modified = true; // if the name of the edited item has been changed and the new name is already // in use, then don't change the name if ((dlg.MemberName != m_strSelectedMember) && _dataTeamMembers.ContainsKey(dlg.MemberName)) { MessageBox.Show(String.Format("Oops... you already have a member with the name, '{0}'. If you meant to edit that member, then select the name in the listbox and click the 'Edit Member' button.", dlg.MemberName)); } else { theMemberData.Name = dlg.MemberName; } theMemberData.MemberType = dlg.MemberType; theMemberData.Email = dlg.Email; theMemberData.AltPhone = dlg.AltPhone; theMemberData.Phone = dlg.Phone; theMemberData.BioData = dlg.BioData; theMemberData.SkypeID = dlg.SkypeID; theMemberData.TeamViewerID = dlg.TeamViewerID; // update the role listbox listBoxMemberRoles.Items[nIndex] = TeamMemberData.GetMemberTypeAsDisplayString(theMemberData.MemberType); if (theMemberData.Name != m_strSelectedMember) { _dataTeamMembers.Remove(m_strSelectedMember); m_strSelectedMember = theMemberData.Name; _dataTeamMembers.Add(m_strSelectedMember, theMemberData); } listBoxTeamMembers.Items[nIndex] = theMemberData.Name; // keep a hang on it so we don't try to, for example, give it a new guid if (!m_mapNewMembersThisSession.ContainsKey(dlg.MemberName)) { m_mapNewMembersThisSession.Add(dlg.MemberName, theMemberData); } }
static string MemberGuid(TeamMembersData members, string strName, TeamMemberData.UserTypes eType) { if (String.IsNullOrEmpty(strName)) { return(strName); } if (!members.ContainsKey(strName)) { members.Add(strName, new TeamMemberData(strName, eType, "mem-" + Guid.NewGuid(), null, null, null, null, null, null)); } return(members[strName].MemberGuid); }
// this can be used to determine whether a given member name and type are one // of the ones in this project (for auto-login) public bool CanLoginMember(string strMemberName, string strMemberType) { if (TeamMembers.ContainsKey(strMemberName)) { TeamMemberData aTMD = TeamMembers[strMemberName]; if (aTMD.MemberTypeAsString == strMemberType) { // kind of a kludge, but necessary for the state logic // If we're going to return true (meaning that we can auto-log this person in), then // if we have an English Back-translator person in the team, then we have to set the // member with the edit token when we get to the EnglishBT state as that person // otherwise, it's a crafter /* * StoryStageLogic.stateTransitions[StoryStageLogic.ProjectStages.eBackTranslatorTypeInternationalBT].MemberTypeWithEditToken = * (TeamMembers.HasOutsideEnglishBTer) ? TeamMemberData.UserTypes.eEnglishBacktranslator : TeamMemberData.UserTypes.eProjectFacilitator; */ return(true); } } return(false); }