Exemplo n.º 1
0
        internal void CalculateFullPathAndGlobalSort(SchemaObjectBase parent, SchemaObjectBase child)
        {
            this.InnerSort = ((ISCRelationContainer)parent).GetCurrentMaxInnerSort() + 1;

            string parentGlobalSort = "000000";
            string parentFullPath   = ((ISCQualifiedNameObject)parent).GetQualifiedName();

            if (parent.ID == SCOrganization.GetRoot().ID)
            {
                parentGlobalSort = string.Empty;
                parentFullPath   = string.Empty;
            }
            else
            {
                if (parent.CurrentParentRelations.Count > 0)
                {
                    if (parent.CurrentParentRelations[0].FullPath.IsNotEmpty())
                    {
                        parentFullPath = parent.CurrentParentRelations[0].FullPath;
                    }

                    if (parent.CurrentParentRelations[0].GlobalSort.IsNotEmpty())
                    {
                        parentGlobalSort = parent.CurrentParentRelations[0].GlobalSort;
                    }
                }
            }

            string childName = ((ISCQualifiedNameObject)child).GetQualifiedName();

            if (parentFullPath.IsNotEmpty())
            {
                this.FullPath = parentFullPath + "\\" + childName;
            }
            else
            {
                this.FullPath = childName;
            }

            this.GlobalSort = parentGlobalSort + string.Format("{0:000000}", this.InnerSort);
        }
Exemplo n.º 2
0
        public void FillDetails()
        {
            SchemaObjectCollection allObjs = ToSchemaObjects();

            this.ForEach(sor =>
            {
                sor.Detail = allObjs[sor.ID];

                if (sor.Detail == null)
                {
                    if (string.Compare(SCOrganization.RootOrganizationID, sor.ID, true) == 0)
                    {
                        sor.Detail = SCOrganization.GetRoot();
                    }
                    else
                    {
                        throw new ObjectNotFoundException("Can not find matching detail of object (ID:" + sor.ID + "), there may have data errors");
                    }
                }
            });
        }
Exemplo n.º 3
0
        /// <summary>
        /// 得到根对象的实例
        /// </summary>
        /// <returns></returns>
        public static SCObjectAndRelation GetRoot()
        {
            SCOrganization   root         = SCOrganization.GetRoot();
            SCRelationObject rootRelation = SCOrganization.GetRootRelationObject();

            SCObjectAndRelation result = new SCObjectAndRelation();

            result.ID          = root.ID;
            result.Name        = root.Name;
            result.CodeName    = root.CodeName;
            result.DisplayName = root.DisplayName;
            result.SchemaType  = root.SchemaType;
            result.Status      = root.Status;

            result.Default    = rootRelation.Default;
            result.InnerSort  = rootRelation.InnerSort;
            result.GlobalSort = rootRelation.GlobalSort;
            result.ParentID   = rootRelation.ParentID;
            result.FullPath   = rootRelation.FullPath;

            return(result);
        }