Part of code: Data entity object: using system; using vuser.ecommerce.dataproxy;
Namespace vuser.ecommerce.core {
[Serializable] public class BaseObject: IComparable {#region domain member private int m_ID; private string m_Title; private string m_Remark; private IDataProxy m_DataProxy; private bool m_IsModify = false; private bool m_IsDirty = false; private string m_SortFieldName;
#ndregion
#REGION attribute public virtual int id {set {m_id = value;} Get {return m_id;}} ///
///
#REGION constructor
/// #ndregion #Region Reserved Method /// #ndregion #Region operator Public Static Bool Operator == (BaseObject X, BaseObject Y) {Return X.ID == Y.Id;} public static bool operator! = (BaseObject X, baseObject Y) {return! (x == y);} # EndRegion public override string toString () {return this.title;}}} Data entity object NEWS Using system; use system.data; using vuser.ecommerce.dataProxy; Namespace vuser.ecommerce.core {/// /// summary> public class News: BaseObject {private DateTime m_AddTime = DateTime.Now; private int m_ClassID; private string m_ClassName; private NewClass m_NewClassObj; private bool m_IsPublish; public DateTime AddTime {get {return m_AddTime;} set {m_AddTime = Value;}} public int classid {get {return m_classid;} set {// if (! new newscollection (). ISEXIST (Value)) // {// throw new exception ("The classid isn't exist") ; //} m_ClassID = value;}} public string ClassName {get {return this.m_ClassName;} set {this.m_ClassName = value;}} public NewClass NewClassObj {get {if (m_NewClassObj == null) {if (this. ! m_ClassID = 0) {m_NewClassObj = (NewClass) (new NewClass () Load (ClassID));.}} return m_NewClassObj;}} public bool IsPublish {get {return m_IsPublish;} set {m_IsPublish = value;}} public News () {// // Todo: Add a structure here Public override int compareto (object obj) {if (this.SortfieldName.toupper (). Equals ("addtime")) {return addtime.compareto ((news) obj) .addtime);} (this.SortfieldName.toupper (). Equals ("classid")) {Return classid.compareto ((news) obj) .classid;} if (this.sortfieldname.toupper (). Equals ("classname")) {RETURN ClassName.Compareto ((NEWS) OBJ) .ClassName);} if (this.SortfieldName.toupper (). Equals ("ispublish")) {Return ISPublish.comPareto ((news) obj) .Ispublish; } Return Base.compareto (OBJ);}}} Data Collection Object Using System; Using System.collections; Using System.Data; Using Vuser.ECommerce.DataProxy; Namespace vuser.ecommerce.core {[serializable] public class basecollection: ienumerator, iCollection {#Region domain #REGON data synchronization identification bit /// #ndregion /// #ndregion #REGON attribute /// Public Basecollection () {} private basecollection (arraylist items) {m_items = items; # endregion # region Use the Database Agent Object (DataProxy) #Region loading data from the database Public Virtual Basecollection Load () {Return DataProxy.Load (); #ndregion Public void deletebyid (int id) {dataproxy.deletebyid (id); public virtual int Add (BaseObject objData) {return DataProxy.Add (objData);} public virtual bool IsExist (int id) {return this.DataProxy.IsExist (id);} public virtual BaseCollection GetItems () {return this.DataProxy. PUBLIC Virtual DataSet Todataset () {return this.dataProxy.todataset (); #ndregion #Region Icollection member Public Bool Issynchronized {Get {// Todo: Add eocollection.issynchronized getter Implement Return False;}} Public void CopyTo (Array Array, Int Index) {// Todo: Add Eocollection.copy Tool} Public Object syncroot {get {// Todo: Add eocollection.syncroot getter Implement Return null;}} #ndregion #Region Ienumerable member public virtual IEnumerator GetEnumerator () {// TODO: Add EOCollection.GetEnumerator implemented // return (IEnumerator) new EOCollection (this.Items); return this.Items.GetEnumerator ();} public object Current {get {return Items [m_Index ];}} Public Bool MoveNext () {m_index ; return m_index #Region Memory Data Operation /// public int IndexOf (object obj) {return Items.IndexOf (obj);} #endregion #region memory database interaction public virtual void Refresh () {} public virtual void Submit () {if (IsModify) {foreach (BaseObject obj in THISTEMS) {if (obj.ismodify) {this.dataProxy.Update (obj);}}}} #endregion}}} #endregion}}}}}}}}}}}}}}}}}}}}}}} Core {/// Public Virtual Int Compare (Object X, Object Y) {// Todo: Add BaseSort.Compare Realization Return Comparefield (x, y);