示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="st"></param>
        /// <param name="mode"></param>
        /// <returns>True if struct exists in this mode</returns>
        public static MTZMetaModel.MTZMetaModel.STRUCTRESTRICTION GetPartRestriction(MTZMetaModel.MTZMetaModel.PART st, string mode)
        {
            MTZMetaModel.MTZMetaModel.OBJECTTYPE ot  = null;
            MTZMetaModel.MTZMetaModel.OBJECTMODE om  = null;
            MTZMetaModel.MTZMetaModel.OBJECTMODE dom = null;


            // Find object type
            ot = ObjectTypeHelper.TypeForStruct(st);

            for (int i = 1; i <= ot.OBJECTMODE.Count; i++)
            {
                if (ot.OBJECTMODE.Item(i).DefaultMode == MTZMetaModel.MTZMetaModel.enumBoolean.Boolean_Da)
                {
                    dom = ot.OBJECTMODE.Item(i);
                    break;
                }
            }

            for (int i = 1; i <= ot.OBJECTMODE.Count; i++)
            {
                if (ot.OBJECTMODE.Item(i).Name == mode)
                {
                    om = ot.OBJECTMODE.Item(i);
                    break;
                }
            }

            if (om == null)
            {
                om = dom;
            }

            if (om == null)
            {
                return(null);
            }

            for (int i = 1; i <= om.STRUCTRESTRICTION.Count; i++)
            {
                if (om.STRUCTRESTRICTION.Item(i).Struct.ID.Equals(st.ID))
                {
                    return(om.STRUCTRESTRICTION.Item(i));
                }
            }

            return(null);
        }
示例#2
0
        public static InterfaceType AnalyzeInterfaceForGUI(MTZMetaModel.MTZMetaModel.PART s, string mode)
        {
            MTZMetaModel.MTZMetaModel.OBJECTTYPE ot   = null;
            MTZMetaModel.MTZMetaModel.PART       prev = null;

            int level = 0;

            ot = ObjectTypeHelper.TypeForStruct(s, ref level);

            if (level > 2)
            {
                return(InterfaceType.InterfaceTypeCommon);
            }


            if (level == 2)
            {
                if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Stroka)
                {
                    return(InterfaceType.InterfaceTypeCommon);
                }

                //'        ' сколько детей у родительской структуры
                prev = (MTZMetaModel.MTZMetaModel.PART)s.Parent.Parent;
                if (LATIR2Framework.ObjectHelper.CountStructs(prev.PART, mode) > 1)
                {
                    return(InterfaceType.InterfaceTypeCommon);
                }
                // '        ' сколько детей у текущей структуры
                if (LATIR2Framework.ObjectHelper.CountStructs(s.PART, mode) > 0)
                {
                    return(InterfaceType.InterfaceTypeCommon);
                }
                if (prev.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Derevo)
                {
                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Derevo)
                    {
                        return(InterfaceType.InterfaceTypeCommon);
                    }
                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Kollekciy)
                    {
                        return(InterfaceType.InterfaceTypeTreeGrid);
                    }

                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Stroka)
                    {
                        return(InterfaceType.InterfaceTypeCommon);
                    }
                }
                else
                {
                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Derevo)
                    {
                        return(InterfaceType.InterfaceTypeCommon);
                    }
                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Kollekciy)
                    {
                        return(InterfaceType.InterfaceTypeGridGrid);
                    }

                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Stroka)
                    {
                        return(InterfaceType.InterfaceTypeCommon);
                    }
                }
            }


            if (level == 1)
            {
                if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Rassirenie)
                {
                    return(InterfaceType.InterfaceTypeExtention);
                }

                // много детей
                if (LATIR2Framework.ObjectHelper.CountStructs(s.PART, mode) > 1)
                {
                    return(InterfaceType.InterfaceTypeCommon);
                }

                for (int i = 1; i <= s.PART.Count; i++)
                {
                    if (LATIR2Framework.ObjectHelper.IsPresent(s.PART.Item(i), mode))
                    {
                        // ' у зависимой коллекции есть много детей
                        if (LATIR2Framework.ObjectHelper.CountStructs(s.PART.Item(1).PART, mode) > 0)
                        {
                            return(InterfaceType.InterfaceTypeCommon);
                        }
                    }
                }



                if (LATIR2Framework.ObjectHelper.CountStructs(s.PART, mode) == 1)
                {
                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Stroka)
                    {
                        return(InterfaceType.InterfaceTypeCommon);
                    }

                    //' если дочерняя строка - без вариантов
                    for (int i = 1; i <= s.PART.Count; i++)
                    {
                        if (LATIR2Framework.ObjectHelper.IsPresent(s.PART.Item(i), mode))
                        {
                            //'                    ' у зависимой коллекции есть много детей
                            if (s.PART.Item(i).PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Stroka)
                            {
                                return(InterfaceType.InterfaceTypeCommon);
                            }
                        }
                    }



                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Derevo)
                    {
                        return(InterfaceType.InterfaceTypeTreeGrid);
                    }

                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Kollekciy)
                    {
                        //'                ' исключаем вариант таблица - дерево
                        for (int i = 1; i <= s.PART.Count; i++)
                        {
                            if (LATIR2Framework.ObjectHelper.IsPresent(s.PART.Item(i), mode))
                            {
                                //'                        ' у зависимой коллекции есть много детей
                                if (s.PART.Item(i).PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Derevo)
                                {
                                    return(InterfaceType.InterfaceTypeCommon);
                                }
                            }
                        }
                        return(InterfaceType.InterfaceTypeGridGrid);
                    }
                }
                if (LATIR2Framework.ObjectHelper.CountStructs(s.PART, mode) == 0)
                {
                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Derevo)
                    {
                        return(InterfaceType.InterfaceTypeTree);
                    }
                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Kollekciy)
                    {
                        return(InterfaceType.InterfaceTypeGrid);
                    }

                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Stroka)
                    {
                        return(InterfaceType.InterfaceTypePanel);
                    }
                }
            }
            return(InterfaceType.InterfaceTypeCommon);
        }
示例#3
0
        //Count Stucts for mode
        public static int CountStructs(MTZMetaModel.MTZMetaModel.PART_col s, string mode)
        {
            MTZMetaModel.MTZMetaModel.OBJECTTYPE ot   = null;
            MTZMetaModel.MTZMetaModel.OBJECTMODE om   = null;
            MTZMetaModel.MTZMetaModel.OBJECTMODE dom  = null;
            MTZMetaModel.MTZMetaModel.PART       part = (MTZMetaModel.MTZMetaModel.PART)s.Parent;
            // Find object type
            ot = ObjectTypeHelper.TypeForStruct(part);
            // Find default mode
            for (int i = 1; i <= ot.OBJECTMODE.Count; i++)
            {
                if (ot.OBJECTMODE.Item(i).DefaultMode == MTZMetaModel.MTZMetaModel.enumBoolean.Boolean_Da)
                {
                    dom = ot.OBJECTMODE.Item(i);
                    break;
                }
            }

            for (int i = 1; i <= ot.OBJECTMODE.Count; i++)
            {
                if (ot.OBJECTMODE.Item(i).Name == mode)
                {
                    om = ot.OBJECTMODE.Item(i);
                    break;
                }
            }

            if (om == null)
            {
                om = dom;
            }

            if (om == null)
            {
                return(int.Parse(s.Count.ToString()));
            }

            int  CNT;
            bool OK = false;

            CNT = 0;
            for (int j = 1; j <= s.Count; j++)
            {
                OK = true;
                for (int i = 1; i <= om.STRUCTRESTRICTION.Count; i++)
                {
                    MTZMetaModel.MTZMetaModel.PART Struct = (MTZMetaModel.MTZMetaModel.PART)om.STRUCTRESTRICTION.Item(i).Struct;
                    if (Struct.ID.Equals(s.Item(j).ID))
                    {
                        if (om.STRUCTRESTRICTION.Item(i).AllowRead == MTZMetaModel.MTZMetaModel.enumBoolean.Boolean_Da)
                        {
                            OK = true;
                        }
                        else
                        {
                            OK = false;
                        }
                        break;
                    }
                }
            }
            if (OK)
            {
                CNT++;
            }
            return(CNT);
        }
示例#4
0
        public static InterfaceType AnalyzeInterface(MTZMetaModel.MTZMetaModel.PART s, string mode)
        {
            MTZMetaModel.MTZMetaModel.OBJECTTYPE ot   = null;
            MTZMetaModel.MTZMetaModel.PART       prev = null;
            int level = 0;

            //MTZMetaModel.MTZMetaModel.PART prev = (MTZMetaModel.MTZMetaModel.PART)s.Parent.Parent;
            ot = ObjectTypeHelper.TypeForStruct(s, ref level);
            if (level > 2)
            {
                return(InterfaceType.InterfaceTypeCommon);
            }
            if (level == 2)
            {
                prev = (MTZMetaModel.MTZMetaModel.PART)s.Parent.Parent;
                if (LATIR2Framework.ObjectHelper.CountStructs(prev.PART, mode) > 1)
                {
                    return(InterfaceType.InterfaceTypeCommon);
                }
                if (LATIR2Framework.ObjectHelper.CountStructs(s.PART, mode) > 0)
                {
                    return(InterfaceType.InterfaceTypeCommon);
                }
                if (prev.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Stroka || prev.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Derevo)
                {
                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Derevo)
                    {
                        return(InterfaceType.InterfaceTypeRightTree);
                    }
                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Kollekciy)
                    {
                        return(InterfaceType.InterfaceTypeRightGrid);
                    }
                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Stroka)
                    {
                        return(InterfaceType.InterfaceTypeRightPanel);
                    }
                }
                else
                {
                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Derevo)
                    {
                        return(InterfaceType.InterfaceTypeBottomTree);
                    }
                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Kollekciy)
                    {
                        return(InterfaceType.InterfaceTypeBottomGrid);
                    }
                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Stroka)
                    {
                        return(InterfaceType.InterfaceTypeBottomPanel);
                    }
                }
            }

            if (level == 1)
            {
                if (LATIR2Framework.ObjectHelper.CountStructs(s.PART, mode) > 1)
                {
                    return(InterfaceType.InterfaceTypeCommon);
                }
                for (int i = 1; i <= s.PART.Count; i++)
                {
                    if (LATIR2Framework.ObjectHelper.IsPresent(s.PART.Item(i), mode))
                    {
                        if (LATIR2Framework.ObjectHelper.CountStructs(s.PART.Item(1).PART, mode) > 0)
                        {
                            return(InterfaceType.InterfaceTypeCommon);
                        }
                    }
                }

                if (LATIR2Framework.ObjectHelper.CountStructs(s.PART, mode) == 1)
                {
                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Derevo)
                    {
                        return(InterfaceType.InterfaceTypeLeftTree);
                    }
                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Kollekciy)
                    {
                        return(InterfaceType.InterfaceTypeTopGrid);
                    }
                    if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Stroka)
                    {
                        return(InterfaceType.InterfaceTypeLeftPanel);
                    }
                    else
                    {
                        if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Derevo)
                        {
                            return(InterfaceType.InterfaceTypeLeftTree);
                        }
                        if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Kollekciy)
                        {
                            return(InterfaceType.InterfaceTypeRightGrid);
                        }
                        if (s.PartType == MTZMetaModel.MTZMetaModel.enumPartType.PartType_Stroka)
                        {
                            return(InterfaceType.InterfaceTypePanel);
                        }
                    }
                }
            }
            return(InterfaceType.InterfaceTypeCommon);
        }
示例#5
0
        public static bool IsFieldMandatory(MTZMetaModel.MTZMetaModel.PART s, Guid FieldID, string mode)
        {
            MTZMetaModel.MTZMetaModel.FIELD      fld = null;
            MTZMetaModel.MTZMetaModel.OBJECTTYPE ot  = null;
            MTZMetaModel.MTZMetaModel.OBJECTMODE om  = null;
            MTZMetaModel.MTZMetaModel.OBJECTMODE dom = null;

            ot = ObjectTypeHelper.TypeForStruct(s);


            for (int i = 1; i <= ot.OBJECTMODE.Count; i++)
            {
                if (ot.OBJECTMODE.Item(i).DefaultMode == MTZMetaModel.MTZMetaModel.enumBoolean.Boolean_Da)
                {
                    dom = ot.OBJECTMODE.Item(i);
                    break;
                }
            }


            for (int i = 1; i <= ot.OBJECTMODE.Count; i++)
            {
                if (ot.OBJECTMODE.Item(i).Name == mode)
                {
                    om = ot.OBJECTMODE.Item(i);
                    break;
                }
            }

            if (om == null)
            {
                om = dom;
            }

            if (om == null)
            {
                fld = (MTZMetaModel.MTZMetaModel.FIELD)(s.FIELD.Item(FieldID.ToString()));
                if (fld != null)
                {
                    if (fld.AllowNull == MTZMetaModel.MTZMetaModel.enumBoolean.Boolean_Da)
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                return(false);
            }


            for (int i = 1; i <= om.FIELDRESTRICTION.Count; i++)
            {
                if (om.FIELDRESTRICTION.Item(i).ThePart != null)
                {
                    if (om.FIELDRESTRICTION.Item(i).ThePart.ID.Equals(s.ID))
                    {
                        if (om.FIELDRESTRICTION.Item(i).TheField != null)
                        {
                            if (om.FIELDRESTRICTION.Item(i).TheField.ID.Equals(FieldID))
                            {
                                if (om.FIELDRESTRICTION.Item(i).MandatoryField == MTZMetaModel.MTZMetaModel.enumTriState.TriState_Da)
                                {
                                    return(true);
                                }

                                else if (om.FIELDRESTRICTION.Item(i).MandatoryField == MTZMetaModel.MTZMetaModel.enumTriState.TriState_Net)
                                {
                                    return(false);
                                }
                                else
                                {
                                    fld = (MTZMetaModel.MTZMetaModel.FIELD)(om.FIELDRESTRICTION.Item(i).TheField);
                                    if (fld.AllowNull == MTZMetaModel.MTZMetaModel.enumBoolean.Boolean_Da)
                                    {
                                        return(false);
                                    }
                                    else
                                    {
                                        return(true);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            fld = (MTZMetaModel.MTZMetaModel.FIELD)(s.FIELD.Item(FieldID.ToString()));
            if (fld != null)
            {
                if (fld.AllowNull == MTZMetaModel.MTZMetaModel.enumBoolean.Boolean_Da)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            return(false);
        }
示例#6
0
        public static bool IsFieldReadOnly(MTZMetaModel.MTZMetaModel.PART s, Guid FieldID, string mode)
        {
            MTZMetaModel.MTZMetaModel.OBJECTTYPE ot  = null;
            MTZMetaModel.MTZMetaModel.OBJECTMODE om  = null;
            MTZMetaModel.MTZMetaModel.OBJECTMODE dom = null;
            MTZMetaModel.MTZMetaModel.FIELD      fld = null;
            //MTZMetaModel.MTZMetaModel.PART obj = (MTZMetaModel.MTZMetaModel.PART)s.Parent.Parent;
            ot = ObjectTypeHelper.TypeForStruct(s);


            for (int i = 1; i <= ot.OBJECTMODE.Count; i++)
            {
                if (ot.OBJECTMODE.Item(i).DefaultMode == MTZMetaModel.MTZMetaModel.enumBoolean.Boolean_Da)
                {
                    dom = ot.OBJECTMODE.Item(i);
                    break;
                }
            }


            for (int i = 1; i <= ot.OBJECTMODE.Count; i++)
            {
                if (ot.OBJECTMODE.Item(i).Name == mode)
                {
                    om = ot.OBJECTMODE.Item(i);
                    break;
                }
            }

            if (om == null)
            {
                om = dom;
            }

            if (om == null)
            {
                fld = (MTZMetaModel.MTZMetaModel.FIELD)(s.FIELD.Item(FieldID.ToString()));
                if (fld != null)
                {
                    if (fld.TheStyle.ToLower().Contains("readonly"))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                return(false);
            }

            bool OK = false;

            for (int i = 1; i <= om.FIELDRESTRICTION.Count; i++)
            {
                if (om.FIELDRESTRICTION.Item(i).ThePart != null)
                {
                    if (om.FIELDRESTRICTION.Item(i).ThePart.ID.Equals(s.ID))
                    {
                        if (om.FIELDRESTRICTION.Item(i).TheField != null)
                        {
                            if (om.FIELDRESTRICTION.Item(i).TheField.ID.Equals(FieldID))
                            {
                                if (om.FIELDRESTRICTION.Item(i).AllowModify == MTZMetaModel.MTZMetaModel.enumBoolean.Boolean_Da)
                                {
                                    return(false);
                                }
                                else
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }
            fld = (MTZMetaModel.MTZMetaModel.FIELD)(s.FIELD.Item(FieldID.ToString()));
            if (fld != null)
            {
                if (fld.TheStyle.ToLower().Contains("readonly"))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
示例#7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="s"></param>
        /// <param name="FieldID"></param>
        /// <param name="mode"></param>
        /// <returns>Yes if field exists for mode</returns>
        public static bool IsFieldPresent(MTZMetaModel.MTZMetaModel.PART s, Guid FieldID, string mode)
        {
            MTZMetaModel.MTZMetaModel.OBJECTTYPE ot  = null;
            MTZMetaModel.MTZMetaModel.OBJECTMODE om  = null;
            MTZMetaModel.MTZMetaModel.OBJECTMODE dom = null;
            //MTZMetaModel.MTZMetaModel.PART obj = (MTZMetaModel.MTZMetaModel.PART)s.Parent.Parent;
            ot = ObjectTypeHelper.TypeForStruct(s);
            for (int i = 1; i <= ot.OBJECTMODE.Count; i++)
            {
                if (ot.OBJECTMODE.Item(i).DefaultMode == MTZMetaModel.MTZMetaModel.enumBoolean.Boolean_Da)
                {
                    dom = ot.OBJECTMODE.Item(i);
                    break;
                }
            }
            for (int i = 1; i <= ot.OBJECTMODE.Count; i++)
            {
                if (ot.OBJECTMODE.Item(i).Name == mode)
                {
                    om = ot.OBJECTMODE.Item(i);
                    break;
                }
            }
            if (om == null)
            {
                om = dom;
            }

            if (om == null)
            {
                return(true);
            }

            bool OK = true;

            for (int i = 1; i <= om.FIELDRESTRICTION.Count; i++)
            {
                if (om.FIELDRESTRICTION.Item(i).ThePart != null)
                {
                    MTZMetaModel.MTZMetaModel.FIELDRESTRICTION FIELDRESTRICTION = om.FIELDRESTRICTION.Item(i);
                    if (FIELDRESTRICTION.ThePart.ID.Equals(s.ID))
                    {
                        if (FIELDRESTRICTION.TheField.ID.Equals(FieldID))
                        {
                            if (om.FIELDRESTRICTION.Item(i).AllowRead == MTZMetaModel.MTZMetaModel.enumBoolean.Boolean_Da)
                            {
                                OK = true;
                            }
                            else
                            {
                                OK = false;
                            }
                            break;
                        }
                    }
                }
                else
                {
                    om.FIELDRESTRICTION.Item(i).Delete();
                }
            }
            return(OK);
        }
示例#8
0
        //Count fields for mode
        public static int CountFields(MTZMetaModel.MTZMetaModel.PART s, string mode)
        {
            MTZMetaModel.MTZMetaModel.OBJECTTYPE ot  = null;
            MTZMetaModel.MTZMetaModel.OBJECTMODE om  = null;
            MTZMetaModel.MTZMetaModel.OBJECTMODE dom = null;
            MTZMetaModel.MTZMetaModel.PART       obj = (MTZMetaModel.MTZMetaModel.PART)s.Parent.Parent;
            ot = ObjectTypeHelper.TypeForStruct(obj);
            for (int i = 1; i <= ot.OBJECTMODE.Count; i++)
            {
                if (ot.OBJECTMODE.Item(i).DefaultMode == MTZMetaModel.MTZMetaModel.enumBoolean.Boolean_Da)
                {
                    dom = ot.OBJECTMODE.Item(i);
                    break;
                }
            }
            for (int i = 1; i <= ot.OBJECTMODE.Count; i++)
            {
                if (ot.OBJECTMODE.Item(i).Name == mode)
                {
                    om = ot.OBJECTMODE.Item(i);
                    break;
                }
            }
            if (om == null)
            {
                om = dom;
            }
            if (om == null)
            {
                return(int.Parse(s.FIELD.Count.ToString()));
            }

            int  CNT = 0;
            bool OK  = false;

            for (int j = 1; j <= s.FIELD.Count; j++)
            {
                OK = true;
                for (int i = 1; i <= om.FIELDRESTRICTION.Count; i++)
                {
                    if (om.FIELDRESTRICTION.Item(i).ThePart.ID.Equals(s.ID))
                    {
                        if (om.FIELDRESTRICTION.Item(i).TheField.ID.Equals(s.FIELD.Item(j).ID))
                        {
                            if (om.FIELDRESTRICTION.Item(i).AllowRead == MTZMetaModel.MTZMetaModel.enumBoolean.Boolean_Da)
                            {
                                OK = true;
                            }
                            else
                            {
                                OK = false;
                            }
                        }
                        break;
                    }
                }
                if (OK)
                {
                    CNT++;
                }
            }
            return(CNT);
        }
示例#9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="st"></param>
        /// <param name="mode"></param>
        /// <returns>True if struct exists in this mode</returns>
        public static bool IsPresent(MTZMetaModel.MTZMetaModel.PART st, string mode)
        {
            MTZMetaModel.MTZMetaModel.OBJECTTYPE ot  = null;
            MTZMetaModel.MTZMetaModel.OBJECTMODE om  = null;
            MTZMetaModel.MTZMetaModel.OBJECTMODE dom = null;


            //MTZMetaModel.MTZMetaModel.PART obj = (MTZMetaModel.MTZMetaModel.PART)st.Parent.Parent;
            // Find object type
            ot = ObjectTypeHelper.TypeForStruct(st);

            for (int i = 1; i <= ot.OBJECTMODE.Count; i++)
            {
                if (ot.OBJECTMODE.Item(i).DefaultMode == MTZMetaModel.MTZMetaModel.enumBoolean.Boolean_Da)
                {
                    dom = ot.OBJECTMODE.Item(i);
                    break;
                }
            }

            for (int i = 1; i <= ot.OBJECTMODE.Count; i++)
            {
                if (ot.OBJECTMODE.Item(i).Name == mode)
                {
                    om = ot.OBJECTMODE.Item(i);
                    break;
                }
            }

            if (om == null)
            {
                om = dom;
            }

            if (om == null)
            {
                return(true);
            }
            bool OK = true;

            for (int i = 1; i <= om.STRUCTRESTRICTION.Count; i++)
            {
                if (om.STRUCTRESTRICTION.Item(i).Struct != null)
                {
                    if (om.STRUCTRESTRICTION.Item(i).Struct.ID.Equals(st.ID))
                    {
                        if (om.STRUCTRESTRICTION.Item(i).AllowRead == MTZMetaModel.MTZMetaModel.enumBoolean.Boolean_Da)
                        {
                            OK = true;
                        }
                        else
                        {
                            OK = false;
                        }
                        break;
                    }
                }
            }
            if (OK)
            {
                return(true);
            }
            return(false);
        }