コード例 #1
0
ファイル: Service.cs プロジェクト: Tuanm/compony
 private static void Create(Member member, Department department)
 {
     foreach (var subinfo in member.Info.SubMembers)
     {
         Member submember;
         if (subinfo.Position == MemberPosition.HeadOfDepartment)
         {
             submember = new HeadOfDepartment(subinfo);
             var subdepartment = new Department(new DepartmentInfo()
             {
                 Number = submember.Info.Department,
                 Upper  = member.Info.Department,
                 Head   = submember.Name
             });
             Create(submember, subdepartment);
             department.Add(subdepartment);
             _departments.Add(subdepartment);
         }
         else
         {
             submember = new Employee(subinfo);
         }
         _members.Add(submember, new ImageService());
     }
 }
コード例 #2
0
ファイル: Service.cs プロジェクト: Tuanm/compony
        private static void Load()
        {
            string data       = File.ReadAllText(_source);
            var    info       = JsonConvert.DeserializeObject <MemberInfo>(data);
            var    root       = new HeadOfDepartment(info);
            var    department = new Department(new DepartmentInfo()
            {
                Number = root.Info.Department,
                Upper  = 0,
                Head   = root.Name
            });

            Create(root, department);
            _members.Add(root, new ImageService());
            _departments.Add(department);
            _root       = root;
            _workspaces = new List <Workspace>();
        }
コード例 #3
0
ファイル: Service.cs プロジェクト: Tuanm/compony
 private static bool TryCreateMember(MemberInfo info,
                                     out Member mem)
 {
     mem = null;
     foreach (var member in _members.Keys)
     {
         if (member.Name.Equals(info.Name))
         {
             return(false);
         }
     }
     if (info.Position == MemberPosition.HeadOfDepartment)
     {
         mem = new HeadOfDepartment(info);
     }
     else
     {
         mem = new Employee(info);
     }
     return(true);
 }