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

📄 basedataitem.cs

📁 SharpDevelop2.0.0 c#开发免费工具
💻 CS
字号:
//------------------------------------------------------------------------------
// <autogenerated>
//     This code was generated by a tool.
//     Runtime Version: 1.1.4322.2032
//
//     Changes to this file may cause incorrect behavior and will be lost if 
//     the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------


using System;
using System.Drawing;
using System.ComponentModel;
using System.Xml.Serialization;

using SharpReportCore;
	
	
/// <summary>
/// This Class is used for Databased items
/// </summary>
/// <remarks>
/// 	created by - Forstmeier Peter
/// 	created on - 22.08.2005 00:12:59
/// </remarks>
namespace SharpReportCore {	
	public class BaseDataItem : SharpReportCore.BaseTextItem,IItemRenderer {
		
		private string columnName;
		private string baseTableName;
		private string dbValue;
		private string dataType;
		private string nullValue;
		
		#region Constructor
		
		public BaseDataItem():base() {
		}
		
		public BaseDataItem(string columnName):base(){
			this.columnName = columnName;
		}
		
		#endregion
		
		#region privates
		//TODO Need a much better handling for 'null' values
		
		private string CheckForNullValue() {
			if (String.IsNullOrEmpty(this.dbValue)) {
				if (String.IsNullOrEmpty(this.nullValue)) {
					return GlobalValues.UnboundName;
					
				} else
					return this.nullValue;
			}
			return this.dbValue;
		}
	
		#endregion
		
		
		public override void Render(SharpReportCore.ReportPageEventArgs rpea) {
			
			// this.DbValue is formatted in the BeforePrintEvent catched in AbstractRenderer
			
			string toPrint = CheckForNullValue();
			
			base.Text = base.FireFormatOutput(toPrint,this.FormatString,"");
//			System.Console.WriteLine("\tBaseDataItem <{0}> / <{1}>",this.Name,this.Text);
			base.Render (rpea);
			
		}
		
		public override string ToString() {
			return "BaseDataItem";
		}
		
		#region Properies
		
		[XmlIgnoreAttribute]
		[Browsable(false)]
		public virtual string DbValue {
			get {
				return dbValue;
			}
			set {
				dbValue = value;
			}
		}
		
		[Browsable(true),
		 Category("Databinding"),
		 Description("Datatype of the underlying Column")]
		
		public virtual string ColumnName {
			get {
				if (String.IsNullOrEmpty(columnName)) {
					this.columnName = GlobalValues.UnboundName;
				}
				return columnName;
			}
			set {
				columnName = value;
				this.Text = this.columnName;
			}
		}
		
		
		[Browsable(true),
		 Category("Databinding"),
		 Description("Datatype of the underlying Column")]
		public string DataType {
			get {
				return dataType;
			}
			set {
				dataType = value;
			}
		}
		
		///<summary>
		/// Mappingname to Datasource
		/// </summary>
		/// 
		[Browsable(true),
		 Category("Databinding"),
		 Description("Mapping Name to DataTable")]
		[XmlIgnoreAttribute]
		public string MappingName {
			get {
				return baseTableName + "." + columnName;
			} 
		}
		
		
		[Browsable(true),
		 Category("Databinding"),
		 Description("TableName")]
		public string BaseTableName {
			get {
				return baseTableName;
			}
			set {
				baseTableName = value;
			}
		}
		[Browsable(true),
		 Category("Databinding"),
		 Description("Display Value for empty Field")]
		public string NullValue {
			get {
				return nullValue;
			}
			set {
				nullValue = value;
			}
		}
		
		#endregion
		
	}
}

⌨️ 快捷键说明

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