get.format

来自「客户关系管理系统ASP.NET+VB.NET编程完整程序!」· FORMAT 代码 · 共 55 行

FORMAT
55
字号

		/// <summary>
		/// Gets a {2} based on the criteria specified by QueryCriteria.And(..).
		/// </summary>
		/// <param name="relations">Specify which related tables should be fetched during this query</param>
		/// <returns>A {0}, or null if not found</returns>
		public {2}  Get{0}(params OrmLib.DataManagerBase.FetchPathRelation[] relations)
		{
			System.Data.DataSet ds = OrmDataSet.NewDataSet();
			FillDataSet( CreateSql("{1}", relations), ds, false);

			System.Data.DataRow {0}Row = GetRow(ds, "{1}");

			if ( {0}Row == null ) return null;
			return new {2} (this,  {0}Row);
		}		
		
		/// <summary>
		/// Gets a {2} from the already loaded records in this DataManager, by primary key.
		/// </summary>
		/// <remarks>
		/// This method is made available for when the dataset has been serialized 
		/// from session state or disk.
		/// </remarks>
		/// <example>
		/// This example shows a reason to use this method.
		/// <code>
		/// /* first web page - save dataset and primary keys */
		/// Session["DataSet"] = dm.DataSet;
		/// Session["{0}{5}"] = _{0}.{5};
		/// 
		/// /* second web page - need to get currend contact */
		/// DataManager dm = new DataManager(Config.Dsn);
		/// dm.DataSet = (DataSet)Session["DataSet"];
		/// _{0} = dm.GetContactFromDataSet(({3})Session["{0}{5}"]);
		/// </code>
		/// </example>
		/// <param name="{5}">Primary key of the data row to retrieve.</param>
		/// <returns>A {0}, or null if not found</returns>
		public {2} Get{0}FromDataSet({3} {5})
		{
			System.Data.DataRow {0}Row = null;
			
			foreach(System.Data.DataRow dr in DataSet.Tables["{1}"].Rows)
			{
				if ( (({3})dr["{4}"]).ToString() == {5}.ToString() ) 
				{
					{0}Row = dr;
					break;
				}
			}
			
			if ( {0}Row == null) return null;
			return new {2} (this, {0}Row);
		}

⌨️ 快捷键说明

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