public SelectMemberWindowVM(StudyUnitVM studyUnit) : base(studyUnit) { this.members = new ObservableCollection<MemberVM>(); this.selectedMember = null; this.Filter(""); }
public MemberFormVM(StudyUnitVM studyUnit) : base(studyUnit) { members = new ObservableCollection<MemberVM>(); organizations = new ObservableCollection<OrganizationVM>(); //OrganizationVMのリストを生成する(画面下部に表示される他、メンバーの組織選択コンボで使われる) int i = 1; foreach (Organization organizationModel in studyUnit.OrganizationModels) { OrganizationVM organization = new OrganizationVM(organizationModel); InitExistOrganization(organization, i++); organizations.Add(organization); } //MemberVMのリストを生成する i = 1; foreach (Member memberModel in studyUnit.MemberModels) { OrganizationVM organization = OrganizationVM.Find(organizations, memberModel.OrganizationId); MemberVM member = new MemberVM(memberModel, organization.OrganizationName); InitExistMember(member, i++); members.Add(member); } memberSyncher = new ModelSyncher<MemberVM, Member>(this, members, studyUnit.MemberModels); organizationSyncher = new ModelSyncher<OrganizationVM, Organization>(this, organizations, studyUnit.OrganizationModels); }
public MemberFormVM(StudyUnitVM studyUnit) : base(studyUnit) { members = new ObservableCollection <MemberVM>(); organizations = new ObservableCollection <OrganizationVM>(); //Create the list of OrganizationVM(showed at the bottom of the window and used by Organization of Members combo) int i = 1; foreach (Organization organizationModel in studyUnit.OrganizationModels) { OrganizationVM organization = new OrganizationVM(organizationModel); InitExistOrganization(organization, i++); organizations.Add(organization); } //Create MemberVM list i = 1; foreach (Member memberModel in studyUnit.MemberModels) { OrganizationVM organization = OrganizationVM.Find(organizations, memberModel.OrganizationId); MemberVM member = new MemberVM(memberModel, organization.OrganizationName); InitExistMember(member, i++); members.Add(member); } memberSyncher = new ModelSyncher <MemberVM, Member>(this, members, studyUnit.MemberModels); organizationSyncher = new ModelSyncher <OrganizationVM, Organization>(this, organizations, studyUnit.OrganizationModels); }
private void InitMember(MemberVM member, bool isLeader, int no) { InitRole(member, isLeader); member.Parent = this; member.No = no; member.EndEditAction = new Action <IEditableObject>(member_ItemEndEdit); }
public MemberVM AppendMember(string memberId, string lastName, string firstName, string organizationName, string position) { //This three are required? if (string.IsNullOrEmpty(lastName) || string.IsNullOrEmpty(firstName) || string.IsNullOrEmpty(organizationName)) { return(null); } MemberVM existMember = MemberVM.FindByNames(Members, lastName, firstName, organizationName, position); if (existMember != null) { return(existMember); } //other than the above is regarded as a new member and newly created. MemberVM newMember = new MemberVM(); members.Add(newMember); InitNewMember(newMember); newMember.LastName = lastName; newMember.FirstName = firstName; newMember.OrganizationName = organizationName; newMember.Position = position; InitRoleName(newMember, members.Count == 1); member_ItemEndEdit(newMember); return(newMember); }
public void member_ItemEndEdit(IEditableObject x) { ///// Process after ending of editing MemberVM MemberVM editedMember = (MemberVM)x; if (string.IsNullOrEmpty(editedMember.OrganizationName)) { return; } OrganizationVM existOrganization = FindOrganizationByName(editedMember.OrganizationName); if (existOrganization == null) { ////Create and add to VM if there is no match to existing organization. existOrganization = new OrganizationVM(editedMember.OrganizationName); InitNewOrganization(existOrganization); organizations.Add(existOrganization); } editedMember.OrganizationId = existOrganization.Id; //The screen also displays to follow because there may be members that refer to the same organization //List<MemberVM> relatedMembers = this.GetSameOrganizationMemberVMs(editedMember); //foreach (MemberVM member in relatedMembers) //{ // member.NotifyPropertyChanged("OrganizationName"); //} }
public void organization_ItemEndEdit(IEditableObject x) { OrganizationVM organization = (OrganizationVM)x; List <MemberVM> relatedMembers = MemberVM.FindByOrganizationId(Members, organization.Id); foreach (MemberVM member in relatedMembers) { member.OrganizationName = organization.OrganizationName; } }
private static void InitRole(MemberVM member, bool isLeader) { //if (isLeader) //{ // member.Roles = Options.FirstRoles; //} //else //{ // member.Roles = Options.OtherRoles; //} member.Roles = Options.Roles; }
private static void InitRoleName(MemberVM member, bool isLeader) { //if (isLeader) //{ // member.RoleCode = Options.ROLE_DAIHYOSHA_CODE; //} //else //{ // member.RoleCode = Options.ROLE_OTHER_CODE; //} member.RoleName = Options.FindLabel(Options.Roles, Options.ROLE_OTHER_CODE); }
public void RemoveOrganization() { List <MemberVM> usedMembers = MemberVM.FindByOrganizationName(members, SelectedOrganization.OrganizationName); if (usedMembers.Count > 0) { string msg = EDOUtils.CannotDeleteError(Resources.Member, usedMembers, param => param.FullName); MessageBox.Show(msg); return; } organizations.Remove(SelectedOrganization); SelectedOrganizationItem = null; }
private void InitExistMember(MemberVM member, int no) { InitMember(member, member.IsLeader, no); }
private static void InitRoleCode(MemberVM member, bool isLeader) { if (isLeader) { member.RoleCode = Options.ROLE_DAIHYOSHA_CODE; } else { member.RoleCode = Options.ROLE_OTHER_CODE; } }
private static void InitRole(MemberVM member, bool isLeader) { if (isLeader) { member.Roles = Options.FirstRoles; } else { member.Roles = Options.OtherRoles; } }
public void InitNewMember(MemberVM member) { InitMember(member, members.Count == 1, NextMemberNo); }
public MemberVM AppendMember(string memberId, string lastName, string firstName, string organizationName, string position) { //一応この三つは必須扱い? if (string.IsNullOrEmpty(lastName) || string.IsNullOrEmpty(firstName) || string.IsNullOrEmpty(organizationName)) { return null; } //メンバーを探す MemberVM existMember = MemberVM.FindById(this.Members, memberId); if (existMember != null && existMember.LastName == lastName && existMember.FirstName == firstName) { //メンバーが存在しかつ名前がかわっていない場合はそのメンバーを返す //(この場合データの収集方法の画面で指定された組織、ポジションは変更されない)。 return existMember; } //上記意外は新しいメンバーとみなし生成する。 MemberVM newMember = new MemberVM(); members.Add(newMember); InitNewMember(newMember); newMember.LastName = lastName; newMember.FirstName = firstName; newMember.OrganizationName = organizationName; newMember.Position = position; InitRoleCode(newMember, members.Count == 1); member_ItemEndEdit(newMember); return newMember; }
protected static string ToString(MemberVM member) { return member.LastName + ", " + member.FirstName; }
private void InitMember(MemberVM member, bool isLeader, int no) { InitRole(member, isLeader); member.Parent = this; member.No = no; member.EndEditAction = new Action<IEditableObject>(member_ItemEndEdit); }
private void updateMember(MemberVM member) { if (member == null) { return; } string memberId = null; string lastName = null; string firstName = null; string organizationName = null; string position = null; if (member != null) { memberId = member.Member.Id; lastName = member.LastName; firstName = member.FirstName; organizationName = member.OrganizationName; position = member.Position; } sampling.MemberId = memberId; this.LastName = lastName; this.FirstName = firstName; this.OrganizationName = organizationName; this.Position = position; }