private static void RefreshByType(eDataSyncCacheType type) { using (DataTable dt = DataCopy.GetDataTable(ConnectionManager.GetConnection(), null, "SELECT * FROM UpdateFileEntry WHERE DataSyncCacheType = '{0}' ORDER BY DataSyncCacheID DESC", type)) { CheckTime ct = new CheckTime(); ct.AddEvent("UpdateFileEntry SQL Done (Count = {0})", dt.Rows.Count); if (dt.Rows.Count > 0) { SetLastUpdate(UpdateFileEntrySr.CreateFromDataRow(dt.Rows[0])); } foreach (DataRow dr in dt.Rows) { try { UpdateFileEntrySr ufe = UpdateFileEntrySr.CreateFromDataRow(dr); if (m_diUpdates.ContainsKey(ufe.DataSyncCacheID)) { m_diUpdates.Add(ufe.DataSyncCacheID, ufe); } } catch (Exception excp) { m_logger.ErrorFormat("RefreshByType Row Exception:{0}\r\n{1}", excp, excp.Message, excp.StackTrace); } } ct.AddEvent("RefreshByType({0}) filled up (Count = {1})", type, m_diUpdates.Count); ct.Info(m_logger); } }
public static MultiStringSr GetByMultiStringTag(IDbConnection connection, IDbTransaction transaction, string sMultiStringTag) { using (DataTable dt = DataCopy.GetDataTable(connection, transaction, "SELECT * FROM MultiString WHERE MultiStringTag = '{0}'", sMultiStringTag)) { return(dt != null && dt.Rows != null && dt.Rows.Count > 0 ? CreateFromDataRow(dt.Rows[0]) : null); } }
public static List <TournamentLockSr> GetTournamentLockItemsByTournamentId(long lTournamentId) { List <TournamentLockSr> lItems = new List <TournamentLockSr>(); using (DataTable dt = DataCopy.GetDataTable("SELECT * FROM TournamentLock WHERE TournamentID = {0}", lTournamentId)) { foreach (DataRow dr in dt.Rows) { lItems.Add(CreateFromDataRow(null, dr)); } } return(lItems); }
private int GetNumberOfCheckpoints() { string sQuery = string.Format("SELECT Count(*) FROM StationCash WHERE StationCash.CashCheckpoint=1"); int count = 0; using (DataTable dt = DataCopy.GetDataTable(sQuery)) { foreach (DataRow dr in dt.Rows) { count = DbConvert.ToInt32(dr, "count"); } } return(count); }
private void FillFromDataTable <T>(IDbConnection conn, string sQuery, ILineObjectCollection <T> locObjects) where T : ILineObject <T> { try { using (DataTable dt = DataCopy.GetDataTable(conn, null, sQuery)) { foreach (var dr in dt.AsEnumerable()) { T obj = Activator.CreateInstance <T>(); obj.FillFromDataRow(dr); locObjects.AddStrictly(obj); } } } catch (Exception excp) { m_logger.Error(excp.Message, excp); throw; } }