110,561
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections;
using System.Web.UI.WebControls;
namespace org.ct.gt.bd.Data
{
#region BQSJY
/// <summary>
/// BQSJY object for NHibernate mapped table 'BQSJY'.
/// </summary>
public class BQSJY : System.IComparable
{
#region Member Variables
protected int _id;
protected string _sJYBSM;
protected string _sJYMC;
protected int _lX;
protected string _mS;
protected static String _sortExpression = "Id";
protected static SortDirection _sortDirection = SortDirection.Ascending;
#endregion
#region Constructors
public BQSJY() { }
public BQSJY( string sJYBSM, string sJYMC, int lX, string mS )
{
this._sJYBSM = sJYBSM;
this._sJYMC = sJYMC;
this._lX = lX;
this._mS = mS;
}
#endregion
#region Public Properties
public int Id
{
get {return _id;}
set {_id = value;}
}
public string SJYBSM
{
get { return _sJYBSM; }
set
{
if ( value != null && value.Length > 50)
throw new ArgumentOutOfRangeException("Invalid value for SJYBSM", value, value.ToString());
_sJYBSM = value;
}
}
public string SJYMC
{
get { return _sJYMC; }
set
{
if ( value != null && value.Length > 100)
throw new ArgumentOutOfRangeException("Invalid value for SJYMC", value, value.ToString());
_sJYMC = value;
}
}
public int LX
{
get { return _lX; }
set { _lX = value; }
}
public string MS
{
get { return _mS; }
set
{
if ( value != null && value.Length > 200)
throw new ArgumentOutOfRangeException("Invalid value for MS", value, value.ToString());
_mS = value;
}
}
public static String SortExpression
{
get { return _sortExpression; }
set { _sortExpression = value; }
}
public static SortDirection SortDirection
{
get { return _sortDirection; }
set { _sortDirection = value; }
}
#endregion
#region IComparable Methods
public int CompareTo(object obj)
{
if (!(obj is BQSJY))
throw new InvalidCastException("This object is not of type BQSJY");
int relativeValue;
switch (SortExpression)
{
case "Id":
relativeValue = this.Id.CompareTo(((BQSJY)obj).Id);
break;
case "SJYBSM":
relativeValue = (this.SJYBSM != null) ? this.SJYBSM.CompareTo(((BQSJY)obj).SJYBSM) : -1;
break;
case "SJYMC":
relativeValue = (this.SJYMC != null) ? this.SJYMC.CompareTo(((BQSJY)obj).SJYMC) : -1;
break;
case "LX":
relativeValue = (this.LX != null) ? this.LX.CompareTo(((BQSJY)obj).LX) : -1;
break;
case "MS":
relativeValue = (this.MS != null) ? this.MS.CompareTo(((BQSJY)obj).MS) : -1;
break;
default:
goto case "Id";
}
if (BQSJY.SortDirection == SortDirection.Ascending)
relativeValue *= -1;
return relativeValue;
}
#endregion
}
#endregion
}