예제 #1
0
        public static GenericTable GetFromHistoryOrCurrent(string TableName, TDatabase db, long id)
        {
            GenericTable gt = new GenericTable(TableName, db);
            if (gt.ReadRecord(id) > 0)
                return gt;

            gt = new GenericTable("History" + TableName, db);
            if (gt.ReadRecord(id) > 0)
                return gt;

            return null;
        }
예제 #2
0
 /// <summary>
 /// Sets the data values of the current object to be identical to the object supplied.
 /// </summary>
 /// <param name="gt">The generic table to be cloned</param>
 /// <remarks>
 /// Use with caution!  This changes the current object!  It is intended for subclasses to allow downcasting from items that were created
 /// as superclasses.
 /// </remarks>
 protected void MakeMeClone(GenericTable gt)
 {
     this.ID = gt.ID;
     this.mData = gt.mData;
     this.mNewRecord = gt.mNewRecord;
     this.mChangeList = new Dictionary<string, object>(gt.mChangeList);
 }
예제 #3
0
        //get any record from a any database and returns ToString on it
        public static string AnyTableToString(string tablename, TDatabase db, long uid)
        {
            string DispString;
            if ((tablename == null)) {
                DispString = "unknown data type";
            } else {
                try {
                    GenericTable gt = new GenericTable(tablename, db);
                    gt.ReadRecord(uid);
                    DispString = gt.ToString();
                } catch (Exception x) {
                    DispString = "Error getting record " + x.Message;
                }
            }

            return DispString;
        }