public static Department Parse(SerializableDepartment department)
        {
            if (department == null)
            {
                return(null);
            }

            return(new Department(department.Id, department.Name, department.ManagerId)
            {
                ParentUnit = department.ParentUnit,
                StaffList = department.StaffList.Select(x => SerializableStaff.Parse(x)).ToList(),
                UnitList = department.UnitList
            });
        }
Beispiel #2
0
        public static Section Parse(SerializableSection section)
        {
            if (section == null)
            {
                return(null);
            }

            List <Unit> subUnits = new List <Unit>();

            foreach (var subUnit in section.SubUnits)
            {
                if (subUnit is SerializableSection)
                {
                    subUnits.Add(SerializableSection.Parse(subUnit as SerializableSection));
                }

                if (subUnit is SerializableTeam)
                {
                    subUnits.Add(SerializableTeam.Parse(subUnit as SerializableTeam));
                }
            }

            OrganizationUnit parentUnit = null;

            if (section.ParentUnit is SerializableSection)
            {
                parentUnit = SerializableSection.Parse(section.ParentUnit as SerializableSection);
            }
            if (section.ParentUnit is SerializableDepartment)
            {
                parentUnit = SerializableDepartment.Parse(section.ParentUnit as SerializableDepartment);
            }

            return(new Section(section.Id, section.Name, section.ParentUnitId, section.AuthorId)
            {
                Department = SerializableDepartment.Parse(section.Department),
                ParentUnit = parentUnit,
                StaffList = section.StaffList.Select(x => SerializableStaff.Parse(x)).ToList(),
                SubUnits = subUnits
            });
        }
Beispiel #3
0
        public static Team Parse(SerializableTeam team)
        {
            if (team == null)
            {
                return(null);
            }

            OrganizationUnit parentUnit = null;

            if (team.ParentUnit is SerializableSection)
            {
                parentUnit = SerializableSection.Parse(team.ParentUnit as SerializableSection);
            }
            if (team.ParentUnit is SerializableDepartment)
            {
                parentUnit = SerializableDepartment.Parse(team.ParentUnit as SerializableDepartment);
            }

            return(new Team(team.Id, team.Name, team.SectionId, team.DepartmentId, team.TeamLeadId)
            {
                ParentUnit = parentUnit,
                StaffList = team.StaffList.Select(x => SerializableStaff.Parse(x)).ToList(),
            });
        }