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

📄 groupseperator.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.Text;
using System.ComponentModel;
using SharpReportCore;
	
	
/// <summary>
/// TODO - Add class summary
/// </summary>
/// <remarks>
/// 	created by - Forstmeier Peter
/// 	created on - 28.11.2005 13:43:22
/// </remarks>

namespace SharpReportCore {
	public class GroupSeperator : SharpReportCore.BaseComparer,IHierarchyData {
		private string typeName = "GroupSeperator";
		
		int groupLevel;
		SharpIndexCollection childs ;
		
		public GroupSeperator(ColumnCollection owner, int listIndex, object[] values,int groupLevel):
			base(owner,listIndex,values) {
			this.groupLevel = groupLevel;
		}
		
		
		public int GroupLevel {
			get {
				return groupLevel;
			}
		}
		
		public SharpIndexCollection GetChildren {
			get {
				if (this.childs == null) {
					this.childs = new SharpIndexCollection("ChildList");
				}
				return childs;
				
			}
		}
		
		#region Comparer
		internal int CompareTo(BaseComparer value)
		{
			// we shouldn't get to this point
			if (value == null)
				throw new ArgumentNullException("value");
			
			if (value.ObjectArray.Length != base.ObjectArray.Length)
				throw new InvalidOperationException("Differnet size of compare data");
			
			int compare = 0;
			
			for (int index = 0; index < base.ObjectArray.Length; index++)
			{
				object leftValue = base.ObjectArray[index];
				object rightValue = value.ObjectArray[index];
				// Indizes sind hier deckungsgleich
				
				GroupColumn groupColumn = (GroupColumn)base.ColumnCollection[index];

				bool descending = (groupColumn.SortDirection == ListSortDirection.Descending);
				
				// null means equl
				if (leftValue == null || leftValue == System.DBNull.Value)
				{
					if (rightValue != null && rightValue != System.DBNull.Value)
					{
						return (descending) ? 1 : -1;
					}
					
					// Beide Null
					continue;
				}
				
				if (rightValue == null || rightValue == System.DBNull.Value)
				{
					return (descending) ? -1 : 1;
				}
				
				
				if (leftValue.GetType() != rightValue.GetType())
					throw new InvalidOperationException("Compare of different types is not supported");
				
				if (leftValue.GetType() == typeof(string))
				{
					compare = String.Compare((string)leftValue, (string)rightValue,
					                         !groupColumn.CaseSensitive, base.ColumnCollection.Culture);
				}
				else
				{
					compare = ((IComparable)leftValue).CompareTo(rightValue);
				}
				
				// Sind ungleich, tauschen je nach Richtung
				if (compare != 0)
				{
					return (descending) ? -compare : compare;
				}
			}
			
			// Gleich Werte, dann Index bercksichtigen
			return this.ListIndex.CompareTo(value.ListIndex);
		}
		
		
		
		public override int CompareTo(object obj) {
			 base.CompareTo(obj);
			return this.CompareTo((BaseComparer)obj);
		}
		
		
		#endregion
		
		
		#region SharpReportCore.IHierarchyData interface implementation
		
		public virtual bool HasChildren {
			get {
				return (this.childs.Count > 0);
			}
			
			
		}
		
		public object Item {
			get {
				return this;
			}
		}
		
		public string Path {
			get {
				StringBuilder sb = new StringBuilder();
				foreach (object o in base.ObjectArray) {
					sb.Append(o.ToString() + ";");
				}
				sb.Remove(sb.Length -1,1);
				return sb.ToString();
			}
		}
		
		public string Type {
			get {
				return this.typeName;
			}
		}
		
//		public IHierarchicalEnumerable GetChildren() {
//			return this.childs;
//		}
//		
//		public IHierarchyData GetParent() {
//			return null;
//		}
	
		#endregion
		
		public override string ToString (){
			return this.typeName;
		}
	}
}

⌨️ 快捷键说明

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