예제 #1
0
        public virtual void Move(long id, long?parentId)
        {
            var organizationUnit = OrganizationUnitRepository.Get(id);

            if (organizationUnit.ParentId == parentId)
            {
                return;
            }

            //Should find children before Code change
            var children = FindChildren(id, true);

            //Store old code of OU
            var oldCode = organizationUnit.Code;

            //Move OU
            organizationUnit.Code     = GetNextChildCode(parentId);
            organizationUnit.ParentId = parentId;

            ValidateOrganizationUnit(organizationUnit);

            //Update Children Codes
            foreach (var child in children)
            {
                child.Code = OrganizationUnit.AppendCode(organizationUnit.Code, OrganizationUnit.GetRelativeCode(child.Code, oldCode));
            }
        }
예제 #2
0
 public virtual string GetCode(long id)
 {
     return((OrganizationUnitRepository.Get(id)).Code);
 }