⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 templates.cs

📁 客户关系管理系统ASP.NET+VB.NET编程完整程序!
💻 CS
📖 第 1 页 / 共 5 页
字号:
				else
					return row.IsNull(row.Table.Columns["RelationshipType"], DataRowVersion.Original) ? null : (System.String) row["RelationshipType", DataRowVersion.Original]; 

				//System.String 
			} 
			set
			{ 
				row["RelationshipType"] = value; 
 
			} 
		}
		/// <summary>
		/// Gets and Sets the ChildAccessorName.
		/// </summary>
		/// <value>
		/// The underlying rows ChildAccessorName cell
		/// </value>
		public virtual System.String ChildAccessorName 
		{ 
			get
			{ 
				if (row.RowState != DataRowState.Deleted)
					return row.IsNull("ChildAccessorName") ? null : (System.String) row["ChildAccessorName"]; 
				else
					return row.IsNull(row.Table.Columns["ChildAccessorName"], DataRowVersion.Original) ? null : (System.String) row["ChildAccessorName", DataRowVersion.Original]; 

				//System.String 
			} 
			set
			{ 
				row["ChildAccessorName"] = value; 
 
			} 
		}
		/// <summary>
		/// Gets and Sets the ParentAccessorName.
		/// </summary>
		/// <value>
		/// The underlying rows ParentAccessorName cell
		/// </value>
		public virtual System.String ParentAccessorName 
		{ 
			get
			{ 
				if (row.RowState != DataRowState.Deleted)
					return row.IsNull("ParentAccessorName") ? null : (System.String) row["ParentAccessorName"]; 
				else
					return row.IsNull(row.Table.Columns["ParentAccessorName"], DataRowVersion.Original) ? null : (System.String) row["ParentAccessorName", DataRowVersion.Original]; 

				//System.String 
			} 
			set
			{ 
				row["ParentAccessorName"] = value; 
 
			} 
		}
		/// <summary>
		/// Gets and Sets the ChildSetAccessor.
		/// </summary>
		/// <value>
		/// The underlying rows ChildSetAccessor cell
		/// </value>
		public virtual System.String ChildSetAccessor 
		{ 
			get
			{ 
				if (row.RowState != DataRowState.Deleted)
					return row.IsNull("ChildSetAccessor") ? null : (System.String) row["ChildSetAccessor"]; 
				else
					return row.IsNull(row.Table.Columns["ChildSetAccessor"], DataRowVersion.Original) ? null : (System.String) row["ChildSetAccessor", DataRowVersion.Original]; 

				//System.String 
			} 
			set
			{ 
				row["ChildSetAccessor"] = value; 
 
			} 
		}
		/// <summary>
		/// Gets and Sets the ChildGetAccessor.
		/// </summary>
		/// <value>
		/// The underlying rows ChildGetAccessor cell
		/// </value>
		public virtual System.String ChildGetAccessor 
		{ 
			get
			{ 
				if (row.RowState != DataRowState.Deleted)
					return row.IsNull("ChildGetAccessor") ? null : (System.String) row["ChildGetAccessor"]; 
				else
					return row.IsNull(row.Table.Columns["ChildGetAccessor"], DataRowVersion.Original) ? null : (System.String) row["ChildGetAccessor", DataRowVersion.Original]; 

				//System.String 
			} 
			set
			{ 
				row["ChildGetAccessor"] = value; 
 
			} 
		}
		/// <summary>
		/// Gets and Sets the ParentSetAccessor.
		/// </summary>
		/// <value>
		/// The underlying rows ParentSetAccessor cell
		/// </value>
		public virtual System.String ParentSetAccessor 
		{ 
			get
			{ 
				if (row.RowState != DataRowState.Deleted)
					return row.IsNull("ParentSetAccessor") ? null : (System.String) row["ParentSetAccessor"]; 
				else
					return row.IsNull(row.Table.Columns["ParentSetAccessor"], DataRowVersion.Original) ? null : (System.String) row["ParentSetAccessor", DataRowVersion.Original]; 

				//System.String 
			} 
			set
			{ 
				row["ParentSetAccessor"] = value; 
 
			} 
		}
		/// <summary>
		/// Gets and Sets the ParentGetAccessor.
		/// </summary>
		/// <value>
		/// The underlying rows ParentGetAccessor cell
		/// </value>
		public virtual System.String ParentGetAccessor 
		{ 
			get
			{ 
				if (row.RowState != DataRowState.Deleted)
					return row.IsNull("ParentGetAccessor") ? null : (System.String) row["ParentGetAccessor"]; 
				else
					return row.IsNull(row.Table.Columns["ParentGetAccessor"], DataRowVersion.Original) ? null : (System.String) row["ParentGetAccessor", DataRowVersion.Original]; 

				//System.String 
			} 
			set
			{ 
				row["ParentGetAccessor"] = value; 
 
			} 
		}
		/// <summary>
		/// Gets and Sets the IsMandatory.
		/// </summary>
		/// <value>
		/// The underlying rows IsMandatory cell
		/// </value>
		public virtual System.String IsMandatory 
		{ 
			get
			{ 
				if (row.RowState != DataRowState.Deleted)
					return row.IsNull("IsMandatory") ? null : (System.String) row["IsMandatory"]; 
				else
					return row.IsNull(row.Table.Columns["IsMandatory"], DataRowVersion.Original) ? null : (System.String) row["IsMandatory", DataRowVersion.Original]; 

				//System.String 
			} 
			set
			{ 
				row["IsMandatory"] = value; 
 
			} 
		}
		/// <summary>
		/// Gets and Sets the DisassociateChild.
		/// </summary>
		/// <value>
		/// The underlying rows DisassociateChild cell
		/// </value>
		public virtual System.String DisassociateChild 
		{ 
			get
			{ 
				if (row.RowState != DataRowState.Deleted)
					return row.IsNull("DisassociateChild") ? null : (System.String) row["DisassociateChild"]; 
				else
					return row.IsNull(row.Table.Columns["DisassociateChild"], DataRowVersion.Original) ? null : (System.String) row["DisassociateChild", DataRowVersion.Original]; 

				//System.String 
			} 
			set
			{ 
				row["DisassociateChild"] = value; 
 
			} 
		}
		/// <summary>
		/// Gets and Sets the CascadeDelete.
		/// </summary>
		/// <value>
		/// The underlying rows CascadeDelete cell
		/// </value>
		public virtual System.String CascadeDelete 
		{ 
			get
			{ 
				if (row.RowState != DataRowState.Deleted)
					return row.IsNull("CascadeDelete") ? null : (System.String) row["CascadeDelete"]; 
				else
					return row.IsNull(row.Table.Columns["CascadeDelete"], DataRowVersion.Original) ? null : (System.String) row["CascadeDelete", DataRowVersion.Original]; 

				//System.String 
			} 
			set
			{ 
				row["CascadeDelete"] = value; 
 
			} 
		}
		/// <summary>
		/// Gets and Sets the CascadeUpdate.
		/// </summary>
		/// <value>
		/// The underlying rows CascadeUpdate cell
		/// </value>
		public virtual System.String CascadeUpdate 
		{ 
			get
			{ 
				if (row.RowState != DataRowState.Deleted)
					return row.IsNull("CascadeUpdate") ? null : (System.String) row["CascadeUpdate"]; 
				else
					return row.IsNull(row.Table.Columns["CascadeUpdate"], DataRowVersion.Original) ? null : (System.String) row["CascadeUpdate", DataRowVersion.Original]; 

				//System.String 
			} 
			set
			{ 
				row["CascadeUpdate"] = value; 
 
			} 
		}
		/// <summary>
		/// Gets and Sets the EnforceConstraint.
		/// </summary>
		/// <value>
		/// The underlying rows EnforceConstraint cell
		/// </value>
		public virtual System.String EnforceConstraint 
		{ 
			get
			{ 
				if (row.RowState != DataRowState.Deleted)
					return row.IsNull("EnforceConstraint") ? null : (System.String) row["EnforceConstraint"]; 
				else
					return row.IsNull(row.Table.Columns["EnforceConstraint"], DataRowVersion.Original) ? null : (System.String) row["EnforceConstraint", DataRowVersion.Original]; 

				//System.String 
			} 
			set
			{ 
				row["EnforceConstraint"] = value; 
 
			} 
		}
		/// <summary>
		/// Gets and Sets the NullableFKey.
		/// </summary>
		/// <value>
		/// The underlying rows NullableFKey cell
		/// </value>
		public virtual System.String NullableFKey 
		{ 
			get
			{ 
				if (row.RowState != DataRowState.Deleted)
					return row.IsNull("NullableFKey") ? null : (System.String) row["NullableFKey"]; 
				else
					return row.IsNull(row.Table.Columns["NullableFKey"], DataRowVersion.Original) ? null : (System.String) row["NullableFKey", DataRowVersion.Original]; 

				//System.String 
			} 
			set
			{ 
				row["NullableFKey"] = value; 
 
			} 
		}
		
		/// <summary>
		/// Gets and Sets the parent ORMBiz.Table.
		/// </summary>
		[System.ComponentModel.Bindable(false)] 
		public virtual ORMBiz.Table ParentTable
		{
			get
			{
				if (row.GetParentRow(base.DataSet.Relations["FKParentTableIDRelation"]) != null)
					return new ORMBiz.Table( DataContext, row.GetParentRow("FKParentTableIDRelation"));
				else
					return null;
			}
			set
			{
				if ( value == null )
				{
					row.SetParentRow(null, base.DataSet.Relations["FKParentTableIDRelation"] );
				}
				else
					row.SetParentRow( value.row, base.DataSet.Relations["FKParentTableIDRelation"] );			
			}
		}
	
		
		/// <summary>
		/// Gets and Sets the parent ORMBiz.Table.
		/// </summary>
		[System.ComponentModel.Bindable(false)] 
		public virtual ORMBiz.Table ChildTable
		{
			get
			{
				if (row.GetParentRow(base.DataSet.Relations["FKChildTableIDRelation"]) != null)
					return new ORMBiz.Table( DataContext, row.GetParentRow("FKChildTableIDRelation"));
				else
					return null;
			}
			set
			{
				if ( value == null )
				{
					row.SetParentRow(null, base.DataSet.Relations["FKChildTableIDRelation"] );
				}
				else
					row.SetParentRow( value.row, base.DataSet.Relations["FKChildTableIDRelation"] );			
			}
		}
	
		private ORMBiz.RelationColumnCollection _RelationColumns = null;
	
		/// <summary>
		/// Refreshes the collection of RelationColumns from the underlying dataset
		/// </summary>
		internal void refreshRelationColumns()
		{
			if (_RelationColumns == null) _RelationColumns = new ORMBiz.RelationColumnCollection();
			
			((IList)_RelationColumns).Clear();

			DataRow[] cr = row.GetChildRows("FKRelationIDRelationColumn");
			foreach( DataRow chld in cr)
			{
				ORMBiz.RelationColumn obj = new ORMBiz.RelationColumn(base.DataContext, chld);
				_RelationColumns.Add( obj );
			}
			
			// add after, so that events wont be fired
			_RelationColumns.Parent = this;
		}
				
		/// <summary>
		/// Exposes the collection of child ORMBiz.RelationColumns.
		/// </summary>
		public virtual ORMBiz.RelationColumnCollection RelationColumns
		{
			get 
			{ 
				if (_RelationColumns == null) refreshRelationColumns();

				return _RelationColumns;
			}
		}


			/// <summary>
			/// Adds a ORMBiz.RelationColumn to the collection.
			/// </summary>
			public virtual int AddRelationColumn(ORMBiz.RelationColumn newRelationColumn)
			{
				if ( _RelationColumns == null ) refreshRelationColumns();

				if ( newRelationColumn.row.GetParentRow(base.DataSet.Relations["FKRelationIDRelationColumn"]) == row )
					return _RelationColumns.IndexOf( newRelationColumn );

				newRelationColumn.row.SetParentRow(row,base.DataSet.Relations["FKRelationIDRelationColumn"]);

				int index = _RelationColumns.Add( newRelationColumn );

				return index;

			}

			/// <summary>
			/// Creates a new ORMBiz.RelationColumn, adding it to the collection.
			/// </summary>
			/// <remarks>
			/// CommitAll() must be called to persist this to the database.
			/// </remarks>
			/// <returns>A new RelationColumn object</returns>
			public virtual ORMBiz.RelationColumn NewRelationColumn()
			{
				if ( _RelationColumns == null ) refreshRelationColumns();

				ORMBiz.RelationColumn newRelationColumn = new ORMBiz.RelationColumn(base.DataContext, base.DataSet.Tables["RelationColumn"].NewRow());
				base.DataSet.Tables["RelationColumn"].Rows.Add(newRelationColumn.row);
				
				this.AddRelationColumn(newRelationColumn);

				return newRelationColumn;
			}
	

	}



	/// <summary>
	/// Wraps a datarow, exposing it's richest features as properties and methods.
	/// </summary>
	public abstract class RelationColumnOrmTemplate : Business
	{
		/// <summary>
		/// Default Constructor
		/// </summary>
		/// <param name="dataContext">The DataManager this object should perform it's operations with</param>
		/// <param name="ROW">The underlying row that this object will wrap</param>
		internal RelationColumnOrmTemplate( DataManager dataContext, DataRow ROW) : base(dataContext) 
		{ 
			row = ROW; 
		}


		/// <summary>
		/// Gets and sets the property at the underlying row index.
		/// </summary>
		public object this[int index]
		{
			get
			{
				if ( this.row.IsNull(index) )
					return null;
				else
					return this.row[index];
			}
			set
			{
				if ( value == null )
					this.row[index] = DBNull.Value;
				else
					this.row[index] = value;
			}
		}

		/// <summary>
		/// Gets and sets the property by its name.
		/// </summary>
		/// <remarks>
		/// Do not use the underlying column name if it is different.
		/// </remarks>
		public object this[string property]
		{
			get
			{
				System.Reflection.PropertyInfo pi = this.GetType().GetProperty(property);
				
				if ( pi != null && pi.CanRead )
					return pi.GetValue(this, null);

				System.Reflection.MethodInfo mi = this.GetType().GetMethod("Get" + property,new Type[]{});
								
				if ( mi != null )
					return mi.Invoke(this, null);

				return null;
			}
			set
			{
				System.Reflection.PropertyInfo pi = this.GetType().GetProperty(property);
				
				if ( pi != null && pi.CanWrite )
				{
					pi.SetValue(this, value, null);
					return;
				}

				System.Reflection.MethodInfo mi = this.GetType().GetMethod("Set" + property,new Type[]{value.GetType()});
								
				if ( mi != null )
					mi.Invoke(this, new object[]{value});
			}
		}		

		
		/// <summary>
		/// Returns true if the underlying DataRow.RowState is marked as DataRowState.Deleted
		/// </summary>
		/// <returns>true if deleted</returns>
		public virtual bool IsDeleted()
		{
			return row.RowState == DataRowState.Deleted;
		}

		/// <summary>
		/// Gets the ID.
		/// </summary>
		/// <value>
		/// The underlying rows

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -