Exemplo n.º 1
0
        protected internal virtual void RaiseUnsupportedCapabilityError(
            DataSourceCapabilities capability)
        {
            if ((capability & DataSourceCapabilities.Sort) != 0)
            {
                if (!CanSort)
                {
                    throw new NotSupportedException("Sort Capabilites");
                }
            }

            if ((capability & DataSourceCapabilities.Page) != 0)
            {
                if (!CanPage)
                {
                    throw new NotSupportedException("Page Capabilites");
                }
            }

            if ((capability & DataSourceCapabilities.RetrieveTotalRowCount) != 0)
            {
                if (!CanRetrieveTotalRowCount)
                {
                    throw new NotSupportedException("RetrieveTotalRowCount Capabilites");
                }
            }

            return;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Raises custom exception
        /// </summary>
        /// <param name="capability"></param>
        protected override void RaiseUnsupportedCapabilityError(DataSourceCapabilities capability)
        {
            string error = string.Empty;

            if ((capability & DataSourceCapabilities.Page) == DataSourceCapabilities.Page ||
                (capability & DataSourceCapabilities.RetrieveTotalRowCount) == DataSourceCapabilities.RetrieveTotalRowCount)
            {
                error += "For database server side paging, use SELECT$. " +
                         "Alternatively, for small number of rows only, set DataSourceMode=DataSet";
            }
            if ((capability & DataSourceCapabilities.Sort) == DataSourceCapabilities.Sort)
            {
                error += " For database server side paging, use SELECT$. " +
                         "Alternatively, for small number of rows only, set DataSourceMode=DataSet";
            }
            if (string.IsNullOrEmpty(error))
            {
                base.RaiseUnsupportedCapabilityError(capability);
            }
            else
            {
                throw new NotSupportedException(error);
            }
            return;
        }
Exemplo n.º 3
0
 protected internal virtual void RaiseUnsupportedCapabilityError(DataSourceCapabilities capability)
 {
     if (!this.CanPage && ((capability & DataSourceCapabilities.Page) != DataSourceCapabilities.None))
     {
         throw new NotSupportedException(System.Web.SR.GetString("DataSourceView_NoPaging"));
     }
     if (!this.CanSort && ((capability & DataSourceCapabilities.Sort) != DataSourceCapabilities.None))
     {
         throw new NotSupportedException(System.Web.SR.GetString("DataSourceView_NoSorting"));
     }
     if (!this.CanRetrieveTotalRowCount && ((capability & DataSourceCapabilities.RetrieveTotalRowCount) != DataSourceCapabilities.None))
     {
         throw new NotSupportedException(System.Web.SR.GetString("DataSourceView_NoRowCount"));
     }
 }
 protected internal override void RaiseUnsupportedCapabilityError(DataSourceCapabilities capability)
 {
     if (!this.CanPage && ((capability & DataSourceCapabilities.Page) != DataSourceCapabilities.None))
     {
         throw new NotSupportedException(System.Web.SR.GetString("SqlDataSourceView_NoPaging", new object[] { this._owner.ID }));
     }
     if (!this.CanSort && ((capability & DataSourceCapabilities.Sort) != DataSourceCapabilities.None))
     {
         throw new NotSupportedException(System.Web.SR.GetString("SqlDataSourceView_NoSorting", new object[] { this._owner.ID }));
     }
     if (!this.CanRetrieveTotalRowCount && ((capability & DataSourceCapabilities.RetrieveTotalRowCount) != DataSourceCapabilities.None))
     {
         throw new NotSupportedException(System.Web.SR.GetString("SqlDataSourceView_NoRowCount", new object[] { this._owner.ID }));
     }
     base.RaiseUnsupportedCapabilityError(capability);
 }
Exemplo n.º 5
0
        protected internal override void RaiseUnsupportedCapabilityError(DataSourceCapabilities capability)
        {
            if ((capability & DataSourceCapabilities.Sort) != 0 && !CanSort)
            {
                throw CreateNotSupportedException("Sort");
            }

            if ((capability & DataSourceCapabilities.Page) != 0 && !CanPage)
            {
                throw CreateNotSupportedException("Page");
            }

            if ((capability & DataSourceCapabilities.RetrieveTotalRowCount) != 0 && !CanRetrieveTotalRowCount)
            {
                throw CreateNotSupportedException("RetrieveTotalRowCount");
            }
        }
Exemplo n.º 6
0
        public void RaiseUnsupportedCapabilitiesError(DataSourceView view)
        {
            DataSourceCapabilities capabilities = this._requestedCapabilities & ~this._supportedCapabilities;

            if ((capabilities & DataSourceCapabilities.Sort) != DataSourceCapabilities.None)
            {
                view.RaiseUnsupportedCapabilityError(DataSourceCapabilities.Sort);
            }
            if ((capabilities & DataSourceCapabilities.Page) != DataSourceCapabilities.None)
            {
                view.RaiseUnsupportedCapabilityError(DataSourceCapabilities.Page);
            }
            if ((capabilities & DataSourceCapabilities.RetrieveTotalRowCount) != DataSourceCapabilities.None)
            {
                view.RaiseUnsupportedCapabilityError(DataSourceCapabilities.RetrieveTotalRowCount);
            }
        }
Exemplo n.º 7
0
        // The RaiseUnsupportedCapabilitiesError method is used by data-bound controls
        // to compare additional requested capabilities represented by the properties
        // of the DataSourceSelectArguments class, such as the ability to sort or page
        // through a result set, with the capabilities supported by the data source view.
        // The view calls its own RaiseUnsupportedCapabilityError method for each possible
        // capability defined in the DataSourceCapabilities enumeration.
        public void RaiseUnsupportedCapabilitiesError(DataSourceView view)
        {
            DataSourceCapabilities requestedCaps    = RequestedCapabilities;
            DataSourceCapabilities notSupportedCaps = (requestedCaps ^ dsc) & requestedCaps;

            if (notSupportedCaps == DataSourceCapabilities.None)
            {
                return;
            }

            if ((notSupportedCaps & DataSourceCapabilities.RetrieveTotalRowCount) > 0)
            {
                notSupportedCaps = DataSourceCapabilities.RetrieveTotalRowCount;
            }
            else if ((notSupportedCaps & DataSourceCapabilities.Page) > 0)
            {
                notSupportedCaps = DataSourceCapabilities.Page;
            }

            view.RaiseUnsupportedCapabilityError(notSupportedCaps);
        }
		protected internal virtual void RaiseUnsupportedCapabilityError (
						DataSourceCapabilities capability)
		{
			if ((capability & DataSourceCapabilities.Sort) != 0)
				if (!CanSort)
					throw new NotSupportedException ("Sort Capabilites");

			if ((capability & DataSourceCapabilities.Page) != 0)
				if (!CanPage)
					throw new NotSupportedException("Page Capabilites");

			if ((capability & DataSourceCapabilities.RetrieveTotalRowCount) != 0)
				if (!CanRetrieveTotalRowCount)
					throw new NotSupportedException("RetrieveTotalRowCount Capabilites");

			return;
		}
        /// <devdoc>
        /// Executes the SelectCountCommand to retrieve the total row count.
        /// </devdoc>
        /*protected virtual int QueryTotalRowCount(DbConnection connection, DataSourceSelectArguments arguments) {
            int totalRowCount = 0;
            bool eventRaised = false;

            if (SelectCountCommand.Length > 0) {
                // Create command and add parameters
                DbCommand command = _owner.CreateCommand(SelectCountCommand, connection);
                InitializeParameters(command, SelectParameters);
                command.CommandType = GetCommandType(SelectCountCommand, SelectCompareString);

                // Raise event to allow customization and cancellation
                SqlDataSourceSelectingEventArgs selectCountingEventArgs = new SqlDataSourceSelectingEventArgs(command, arguments, true);
                OnSelecting(selectCountingEventArgs);

                // If the operation was cancelled, exit immediately
                if (selectCountingEventArgs.Cancel) {
                    return totalRowCount;
                }

                // the arguments may have been changed
                arguments.RaiseUnsupportedCapabilitiesError(this);

                // 






































*/


        protected internal override void RaiseUnsupportedCapabilityError(DataSourceCapabilities capability) {
            if (!CanPage && ((capability & DataSourceCapabilities.Page) != 0)) {
                throw new NotSupportedException(SR.GetString(SR.SqlDataSourceView_NoPaging, _owner.ID));
            }

            if (!CanSort && ((capability & DataSourceCapabilities.Sort) != 0)) {
                throw new NotSupportedException(SR.GetString(SR.SqlDataSourceView_NoSorting, _owner.ID));
            }

            if (!CanRetrieveTotalRowCount && ((capability & DataSourceCapabilities.RetrieveTotalRowCount) != 0)) {
                throw new NotSupportedException(SR.GetString(SR.SqlDataSourceView_NoRowCount, _owner.ID));
            }
            base.RaiseUnsupportedCapabilityError(capability);
        }
 protected internal override void RaiseUnsupportedCapabilityError(DataSourceCapabilities capability)
 {
     if (!this.CanPage && ((capability & DataSourceCapabilities.Page) != DataSourceCapabilities.None))
     {
         throw new NotSupportedException(System.Web.SR.GetString("SqlDataSourceView_NoPaging", new object[] { this._owner.ID }));
     }
     if (!this.CanSort && ((capability & DataSourceCapabilities.Sort) != DataSourceCapabilities.None))
     {
         throw new NotSupportedException(System.Web.SR.GetString("SqlDataSourceView_NoSorting", new object[] { this._owner.ID }));
     }
     if (!this.CanRetrieveTotalRowCount && ((capability & DataSourceCapabilities.RetrieveTotalRowCount) != DataSourceCapabilities.None))
     {
         throw new NotSupportedException(System.Web.SR.GetString("SqlDataSourceView_NoRowCount", new object[] { this._owner.ID }));
     }
     base.RaiseUnsupportedCapabilityError(capability);
 }
 protected internal virtual new void RaiseUnsupportedCapabilityError (DataSourceCapabilities capability)
 {
 }
 public void DoRaiseUnsupportedCapabilityError(DataSourceCapabilities capability)
 {
     base.RaiseUnsupportedCapabilityError(capability);
 }
 // Methods
 public void AddSupportedCapabilities(DataSourceCapabilities capabilities)
 {
 }
Exemplo n.º 14
0
		protected internal override void RaiseUnsupportedCapabilityError (DataSourceCapabilities capability)
		{
			if ((capability & DataSourceCapabilities.Sort) != 0 && !CanSort)
				throw CreateNotSupportedException ("Sort");

			if ((capability & DataSourceCapabilities.Page) != 0 && !CanPage)
				throw CreateNotSupportedException ("Page");

			if ((capability & DataSourceCapabilities.RetrieveTotalRowCount) != 0 && !CanRetrieveTotalRowCount)
				throw CreateNotSupportedException ("RetrieveTotalRowCount");
		}
Exemplo n.º 15
0
 protected internal virtual void RaiseUnsupportedCapabilityError(DataSourceCapabilities capability) {
     if (!CanPage && ((capability & DataSourceCapabilities.Page) != 0)) {
         throw new NotSupportedException(SR.GetString(SR.DataSourceView_NoPaging));
     }
 
     if (!CanSort && ((capability & DataSourceCapabilities.Sort) != 0)) {
         throw new NotSupportedException(SR.GetString(SR.DataSourceView_NoSorting));
     }
 
     if (!CanRetrieveTotalRowCount && ((capability & DataSourceCapabilities.RetrieveTotalRowCount) != 0)) {
         throw new NotSupportedException(SR.GetString(SR.DataSourceView_NoRowCount));
     }
 }
 /// <summary>
 /// 向  <see cref="DataSourceSelectArgumentsEx"/> 实例添加一个功能,用于对支持的功能和请求的功能进行比较。 
 /// </summary>
 /// <param name="capabilities"></param>
 public void AddSupportedCapabilities(DataSourceCapabilities capabilities)
 {
     this.supportedCapabilities |= capabilities;
 }
Exemplo n.º 17
0
		public void DoRaiseUnsupportedCapabilityError (DataSourceCapabilities capability)
		{
			base.RaiseUnsupportedCapabilityError (capability);
		}
 public void AddSupportedCapabilities(DataSourceCapabilities capabilities)
 {
 }
		public void AddSupportedCapabilities (DataSourceCapabilities srcCapabilities)
		{
			this.dsc = this.dsc | srcCapabilities;
		}
 protected internal virtual new void RaiseUnsupportedCapabilityError(DataSourceCapabilities capability)
 {
 }
Exemplo n.º 21
0
 protected override void RaiseUnsupportedCapabilityError(DataSourceCapabilities capability)
 {
     RaiseUnsupportedCapabilityErrorCalled = true;
     DataSourceCapabilities = capability;
 }
Exemplo n.º 22
0
 /// <summary>
 /// 由 <see cref="DataSourceSelectArgumentsEx.RaiseUnsupportedCapabilitiesError"/> 方法调用,以将<see cref="ExecuteSelect"/> 操作所请求的功能与视图所支持的功能进行比较。
 /// </summary>
 /// <param name="capability"></param>
 protected internal virtual void RaiseUnsupportedCapabilityError(DataSourceCapabilities capability)
 {
     if (!this.CanPage && ((capability & DataSourceCapabilities.Page) != DataSourceCapabilities.None))
     {
         throw new NotSupportedException("DataSourceViewEx_NoPaging");
     }
     if (!this.CanSort && ((capability & DataSourceCapabilities.Sort) != DataSourceCapabilities.None))
     {
         throw new NotSupportedException("DataSourceViewEx_NoSorting");
     }
     if (!this.CanRetrieveTotalRowCount && ((capability & DataSourceCapabilities.RetrieveTotalRowCount) != DataSourceCapabilities.None))
     {
         throw new NotSupportedException("DataSourceViewEx_NoRowCount");
     }
 }
			protected internal override void RaiseUnsupportedCapabilityError (DataSourceCapabilities capability) {
				RaiseUnsupportedCapabilityErrorCalled = true;
				DataSourceCapabilities = capability;
			}
Exemplo n.º 24
0
 public void AddSupportedCapabilities(DataSourceCapabilities srcCapabilities)
 {
     this.dsc = this.dsc | srcCapabilities;
 }
Exemplo n.º 25
0
 public void AddSupportedCapabilities(DataSourceCapabilities capabilities)
 {
     this._supportedCapabilities |= capabilities;
 }