Example #1
0
 public static void Update(InQueue inQueue, DbTransaction transaction)
 {
     inQueue.Update(transaction);
 }
Example #2
0
 public static void Update(InQueue inQueue)
 {
     inQueue.Update();
 }
Example #3
0
        public static InQueue[] MapFrom(DataSet ds)
        {
            List<InQueue> objects;

            // Initialise Collection.
            objects = new List<InQueue>();

            // Validation.
            if (ds == null)
                throw new ApplicationException("Cannot map to dataset null.");
            else if (ds.Tables[TABLE_NAME].Rows.Count == 0)
                return objects.ToArray();

            if (ds.Tables[TABLE_NAME] == null)
                throw new ApplicationException("Cannot find table [dbo].[in_queue] in DataSet.");

            if (ds.Tables[TABLE_NAME].Rows.Count < 1)
                throw new ApplicationException("Table [dbo].[in_queue] is empty.");

            // Map DataSet to Instance.
            foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows)
            {
                InQueue instance = new InQueue();
                instance.MapFrom(dr);
                objects.Add(instance);
            }

            // Return collection.
            return objects.ToArray();
        }
Example #4
0
 public static InQueue[] SearchExact(InQueue searchObject)
 {
     return SearchExact ( searchObject.Id, searchObject.From, searchObject.Message, searchObject.TimeSent, searchObject.ORDERBY_FIELD);
 }
Example #5
0
        public static InQueue Get(System.Int32 id)
        {
            DataSet ds;
            Database db;
            string sqlCommand;
            DbCommand dbCommand;
            InQueue instance;

            instance = new InQueue();

            db = MyDatabase.DB;
            sqlCommand = "[dbo].InQueue_SELECT";
            dbCommand = db.GetStoredProcCommand(sqlCommand, id);

            // Get results.
            ds = db.ExecuteDataSet(dbCommand);
            // Verification.
            if (ds == null || ds.Tables[0].Rows.Count == 0) throw new ApplicationException("Could not get InQueue ID:" + id.ToString()+ " from Database.");
            // Return results.
            ds.Tables[0].TableName = TABLE_NAME;

            instance.MapFrom( ds.Tables[0].Rows[0] );
            return instance;
        }