コード例 #1
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            if (_PassRank == null)
            {
                AddError(PASS_RANK_PROPERTY, PASS_RANK_PROPERTY_ERROR);
            }
            else if (_PassRank <= 0)
            {
                AddError(PASS_RANK_PROPERTY_ERROR2);
            }
            else if (HasPageItem)
            {
                int?passRank;
                int p = PageItem.GetTotalPoints(out passRank);
                if (passRank != null && p < passRank)
                {
                    AddError(PASS_RANK_IS_MORE_THAN_SUM_OF_RANKS);
                }
            }

            int buttonsCount = 0;

            foreach (Control c in Control.Controls)
            {
                if (c.Tag is HtmlButton)
                {
                    buttonsCount++;
                }
            }
            if (buttonsCount != 1)
            {
                if (buttonsCount == 0)
                {
                    AddError(NO_BUTTONS_ERROR);
                }
                else
                {
                    AddError(MORE_THEN_ONE_BUTTON);
                }
            }
        }