Skip Navigation Links.

Northwind\Data\NorthwindComparerBase.cs

D:\Temp3\TestProjects\CSADO.Net\Northwind\Data\NorthwindComparerBase.cs
/*
 * This file was generated by ProCG version 2.0
 *
 * File name:	Northwind\Data\NorthwindComparerBase.cs
 * Language:	C# - ADO.Net 
 * Database:	My Sql
 *
 * Copyright (c) 2002-2019 iGenXSoft.
 * For more information visit http://www.igenxsoft.com
 */


using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace Northwind.Data
{
	/// <summary>
	/// Summary description for NorthwindComparerBase.
	/// </summary>
	public class NorthwindComparerBase<T> : IComparer<T> where T : CStructData, new() 
	{
		
		protected List<int> m_OrderByFields;

		public NorthwindComparerBase() 
		{
			m_OrderByFields = new List<int>();
		}


		public void AddField(int field)
		{
			m_OrderByFields.Add(field);
		}

		public void ClearFields()
		{
			m_OrderByFields.Clear();
		}

		#region IComparer<T> Members

		public virtual int Compare(T x, T y)
		{
			throw new NotImplementedException();
		}

		#endregion

		public virtual string GetOrderByText()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("Order By ");

			int fieldNum, i;
			T t = new T();

			for (i = 0; i < m_OrderByFields.Count; i++)
			{
				fieldNum = (int)m_OrderByFields[i];

				if (i > 0)
					stringBuilder.Append(", ");
				stringBuilder.Append(t.GetFieldName(fieldNum));
			}
			return (stringBuilder.ToString());
		}


	}
}



  //      1502 ProCG uses this line - don't edit it