예제 #1
0
        public RegistratorModel Initizlie(CodeType baseCodeType)
        {
            RegistratorModel result = null;

            if (baseCodeType != null)
            {
                if (initialized)
                {
                    result = InitializeInternal(baseCodeType);
                }
                else
                {
                    BaseCodeType = baseCodeType;
                    result       = this;
                    initialized  = true;
                }
            }
            return(result);
        }
예제 #2
0
        private RegistratorModel InitializeInternal(CodeType baseCodeType)
        {
            RegistratorModel result = null;

            if (BaseCodeType.ChildrenCodeTypeId == baseCodeType.Id)
            {
                if (Child == null)
                {
                    Child = new RegistratorModel();
                    Child.Initizlie(baseCodeType);
                    Child.Parent = this;
                }
                result = Child;
            }
            else if (BaseCodeType.Id == baseCodeType.ChildrenCodeTypeId)
            {
                if (Parent == null)
                {
                    Parent = new RegistratorModel();
                    Parent.Initizlie(baseCodeType);
                    Parent.Child = this;
                }
                result = Parent;
            }
            else
            {
                if (Child != null)
                {
                    result = Child.InitializeInternal(baseCodeType);
                }
                if (result == null && Parent != null)
                {
                    result = Parent.InitializeInternal(baseCodeType);
                }
            }

            return(result);
        }