public static Suser GetSuser(string suser) { string query = string.Format(GET_SUSER_SQL, suser.Trim().ToLower()); Suser suserObject = null; if (!CacheManager.TryGetCachedQueryResult <Suser>(query, out suserObject)) { SqlServerIo sql = SqlServerIo.Create(); if (sql.Execute(false, query)) { if (sql.Read()) { suserObject = new Suser( 0, sql.GetValueOfColumn <string>("Suser"), sql.GetValueOfColumn <string>("Password") ); } } SqlServerIo.Release(sql); } return(suserObject); }
public static bool AddEntry(Entry entry) { bool result; if (string.IsNullOrEmpty(entry.Content)) { return(false); } SqlServerIo sql = SqlServerIo.Create(); if (!sql.Ready) { return(false); } //naa entry.FixForMultipleLineFeeds(); result = sql.Execute(false, NEW_ENTRY_SQL, entry.Baslik, entry.Suser, entry.Date.ToString(), entry.Content); if (result) { if (!sql.Read()) { result = false; } else { entry.SetId(sql.GetValueOfColumn <int>("BaslikId")); CacheManager.InvalidateCacheSet(KeysetId.Baslik(entry.BaslikID)); var indexKeyid = KeysetId.Index(entry.Baslik[0]); CacheManager.InvalidateCacheSet(indexKeyid); if (sql.GetValueOfColumn <int>("IsNewBaslikInsert") == 1) { //invalidate also todays section keyset a.k.a Taze CacheManager.InvalidateCacheSet(KeysetId.Todays()); } } } SqlServerIo.Release(sql); return(result); }