示例#1
0
        /// <inheritdoc />
        /// <summary>
        /// Перечень конструкций для данной ноды
        /// </summary>
        /// <param name="cIsso"></param>
        /// <param name="cGrConstr"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        public override bool Visible(int cIsso, int cGrConstr, VisibleMode mode)
        {
            var retV            = ChildrenNodes.Any(x => x.Visible(cIsso, cGrConstr, mode)) || DefectList.Count > 0;
            var connectionClass = ConnectionClass.CreateDatabase();

            switch (mode)
            {
            case VisibleMode.ExistConstructions:
                if (CGrConstr < 1000)                         // если эта нода связана с реальным сооружением и есть такая таблица
                {
                    var cnt = connectionClass.ExecuteScalar <int>($"select count(*) from {TableName} where c_isso={cIsso}");
                    retV = cnt > 0;
                }
                break;

            case VisibleMode.AllContructions:
                // Текущий тип ИССО
                var issoType = connectionClass.ExecuteScalar <int>(
                    $"select C_GR_CONSTR from S_TYPISSO where C_TYPISSO=(select CTYPEISSO from I_ISSO where C_ISSO={cIsso})");

                retV = connectionClass.ExecuteScalar <int>($"select count(*) from s_cnct where c_nmd1={issoType} and c_nmd2={CGrConstr}") > 0;
                break;

            case VisibleMode.All:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }
            connectionClass.Close();
            return(retV);
        }
        /// <summary>
        /// Проверка видимости этой ноды
        /// </summary>
        /// <param name="cIsso"></param>
        /// <param name="cGrConstr"></param>
        /// <param name="mode">режим видимости</param>
        /// <returns></returns>
        public virtual bool Visible(int cIsso, int cGrConstr, VisibleMode mode)
        {
            switch (mode)
            {
            case VisibleMode.All: return(true);

            case VisibleMode.AllContructions:
            case VisibleMode.ExistConstructions:
                return(DefectList.Count > 0 ||
                       ChildrenNodes.Any(x => x.Visible(cIsso, cGrConstr, mode)));

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }
        }