public SelectMemberWindowVM(StudyUnitVM studyUnit)
     : base(studyUnit)
 {
     this.members = new ObservableCollection<MemberVM>();
     this.selectedMember = null;
     this.Filter("");
 }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
 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);
 }
Пример #5
0
        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);
        }
Пример #6
0
        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");
            //}
        }
Пример #7
0
        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;
            }
        }
Пример #8
0
 private static void InitRole(MemberVM member, bool isLeader)
 {
     //if (isLeader)
     //{
     //    member.Roles = Options.FirstRoles;
     //}
     //else
     //{
     //    member.Roles = Options.OtherRoles;
     //}
     member.Roles = Options.Roles;
 }
Пример #9
0
 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);
 }
Пример #10
0
        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;
        }
Пример #11
0
 private void InitExistMember(MemberVM member, int no)
 {
     InitMember(member, member.IsLeader, no);
 }
Пример #12
0
 private static void InitRoleCode(MemberVM member, bool isLeader)
 {
     if (isLeader)
     {
         member.RoleCode = Options.ROLE_DAIHYOSHA_CODE;
     }
     else
     {
         member.RoleCode = Options.ROLE_OTHER_CODE;
     }
 }
Пример #13
0
 private static void InitRole(MemberVM member, bool isLeader)
 {
     if (isLeader)
     {
         member.Roles = Options.FirstRoles;
     }
     else
     {
         member.Roles = Options.OtherRoles;
     }
 }
Пример #14
0
 public void InitNewMember(MemberVM member)
 {
     InitMember(member, members.Count == 1, NextMemberNo);
 }
Пример #15
0
        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;
        }
Пример #16
0
 protected static string ToString(MemberVM member)
 {
     return member.LastName + ", " + member.FirstName;
 }
Пример #17
0
 public void InitNewMember(MemberVM member)
 {
     InitMember(member, members.Count == 1, NextMemberNo);
 }
Пример #18
0
 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);
 }
Пример #19
0
        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;
        }
Пример #20
0
 private void InitExistMember(MemberVM member, int no)
 {
     InitMember(member, member.IsLeader, no);
 }