コード例 #1
0
 public object this[string property]
 {
     get
     {
         DataColumn?column = _dataView.Table !.Columns[property];
         if (null != column)
         {
             return(Row[column, RowVersionDefault]);
         }
         else if (_dataView.Table.DataSet != null && _dataView.Table.DataSet.Relations.Contains(property))
         {
             return(CreateChildView(property));
         }
         throw ExceptionBuilder.PropertyNotFound(property, _dataView.Table.TableName);
     }
     set
     {
         DataColumn?column = _dataView.Table !.Columns[property];
         if (null == column)
         {
             throw ExceptionBuilder.SetFailed(property);
         }
         if (!_dataView.AllowEdit && !IsNew)
         {
             throw ExceptionBuilder.CanNotEdit();
         }
         SetColumnValue(column, value);
     }
 }
コード例 #2
0
        /// <include file='doc\DataRowView.uex' path='docs/doc[@for="DataRowView.this1"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Gets or sets a value in a specified column.
        ///    </para>
        /// </devdoc>
        public object this[string property] {
            get {
                if (dataView.Table.Columns.Contains(property))
                {
                    return(row[property, dataView.IsOriginalVersion(this.index) ? DataRowVersion.Original : DataRowVersion.Default]);
                }
                else if (dataView.Table.DataSet != null && dataView.Table.DataSet.Relations.Contains(property))
                {
                    return(dataView.CreateChildView(property, index));
                }

                throw ExceptionBuilder.PropertyNotFound(property, dataView.Table.TableName);
            }
            set {
                if (!dataView.Table.Columns.Contains(property))
                {
                    throw ExceptionBuilder.SetFailed(property);
                }
                if (!dataView.AllowEdit && (row != dataView.addNewRow))
                {
                    throw ExceptionBuilder.CanNotEdit();
                }
                SetColumnValue(dataView.Table.Columns[property], value);
            }
        }
コード例 #3
0
 public object this[string property]
 {
     get
     {
         DataColumn column = this.dataView.Table.Columns[property];
         if (column != null)
         {
             return(this.Row[column, this.RowVersionDefault]);
         }
         if ((this.dataView.Table.DataSet == null) || !this.dataView.Table.DataSet.Relations.Contains(property))
         {
             throw ExceptionBuilder.PropertyNotFound(property, this.dataView.Table.TableName);
         }
         return(this.CreateChildView(property));
     }
     set
     {
         DataColumn column = this.dataView.Table.Columns[property];
         if (column == null)
         {
             throw ExceptionBuilder.SetFailed(property);
         }
         if (!this.dataView.AllowEdit && !this.IsNew)
         {
             throw ExceptionBuilder.CanNotEdit();
         }
         this.SetColumnValue(column, value);
     }
 }
コード例 #4
0
 public object this[int ndx]
 {
     get { return(Row[ndx, RowVersionDefault]); }
     set
     {
         if (!_dataView.AllowEdit && !IsNew)
         {
             throw ExceptionBuilder.CanNotEdit();
         }
         SetColumnValue(_dataView.Table !.Columns[ndx], value);
     }
 }
コード例 #5
0
 /// <include file='doc\DataRowView.uex' path='docs/doc[@for="DataRowView.this"]/*' />
 /// <devdoc>
 ///    <para>
 ///       Gets or sets a value in a specified column.
 ///    </para>
 /// </devdoc>
 public object this[int ndx] {
     get {
         if (!(0 <= ndx && ndx < dataView.Table.Columns.Count))
         {
             throw ExceptionBuilder.ColumnOutOfRange(ndx);
         }
         return(row[ndx, dataView.IsOriginalVersion(this.index) ? DataRowVersion.Original : DataRowVersion.Default]);
     }
     set {
         if (!(0 <= ndx && ndx < dataView.Table.Columns.Count))
         {
             throw ExceptionBuilder.ColumnOutOfRange(ndx);
         }
         if (!dataView.AllowEdit && (row != dataView.addNewRow))
         {
             throw ExceptionBuilder.CanNotEdit();
         }
         SetColumnValue(dataView.Table.Columns[ndx], value);
     }
 }