/// <summary> /// Retrieves a CharacterRecord based on a character's entity ID /// </summary> /// <param name="lowUid">the character unique ID</param> /// /// <returns>the corresponding <seealso cref="T:WCell.RealmServer.Database.CharacterRecord" /></returns> public static CharacterRecord LoadRecordByEntityId(uint lowUid) { return(ActiveRecordBase <CharacterRecord> .FindOne(new ICriterion[1] { (ICriterion)Restrictions.Eq("Guid", (object)(long)lowUid) })); }
public static AccountDataRecord GetAccountData(long accountID) { return(ActiveRecordBase <AccountDataRecord> .FindOne(new ICriterion[1] { (ICriterion)Restrictions.Eq("accountId", (object)accountID) })); }
/* this is to choose the option starting from global site options with user consideration */ /// <summary> </summary> public static String get_option(String name) { String result = ""; options sdata = ActiveRecordBase <options> .FindOne( new List <AbstractCriterion>() { Expression.Eq("site", siteService.getCurrentSite()), Expression.Eq("option_key", name) }.ToArray() ); if (sdata != null) { result = sdata.value; } if (sdata != null && sdata.is_overwritable) { user_meta_data udata = ActiveRecordBase <user_meta_data> .FindOne( new List <AbstractCriterion>() { Expression.Eq("_user", userService.getUserFull()), Expression.Eq("meta_key", name) }.ToArray() ); if (udata != null) { result = udata.value; } } return(result); }
public Account this[long id] { get { if (this.IsCached) { using (this.m_lock.EnterReadLock()) { Account account; this.m_cachedAccsById.TryGetValue(id, out account); return(account); } } else { try { return(ActiveRecordBase <Account> .FindOne(new ICriterion[1] { (ICriterion)Restrictions.Eq("AccountId", (object)(int)id) })); } catch (Exception ex) { RealmDBMgr.OnDBError(ex); return(ActiveRecordBase <Account> .FindOne(new ICriterion[1] { (ICriterion)Restrictions.Eq("AccountId", (object)(int)id) })); } } } }
public static Asda2ItemRecord GetRecordByID(long id) { return(ActiveRecordBase <Asda2ItemRecord> .FindOne(new ICriterion[1] { (ICriterion)Restrictions.Eq("Guid", (object)id) })); }
/// <summary> /// Retrieves a CharacterRecord based on a character's entity ID. /// </summary> /// <returns>the corresponding <seealso cref="T:WCell.RealmServer.Database.CharacterRecord" /></returns> public static CharacterRecord LoadRecordByID(long guid) { return(ActiveRecordBase <CharacterRecord> .FindOne(new ICriterion[1] { (ICriterion)Restrictions.Eq("CharacterId", (object)guid) })); }
public static Asda2QuestNpc GetQuestId(int npcid, int questnum) { return(ActiveRecordBase <Asda2QuestNpc> .FindOne(new ICriterion[1] { (ICriterion)((AbstractCriterion)Restrictions.Eq(nameof(npcid), (object)npcid) && (AbstractCriterion)Restrictions.Eq(nameof(questnum), (object)questnum)) })); }
/// <summary> </summary> public static String site_path(string site_alias) { site site = ActiveRecordBase <site> .FindOne(new List <AbstractCriterion>() { Expression.Eq("alias", site_alias) }.ToArray()); return(site.local_path); }
public static Asda2QuestInfo GetQuestInfo(int questid, int questUnk1) { return(ActiveRecordBase <Asda2QuestInfo> .FindOne(new ICriterion[1] { (ICriterion)((AbstractCriterion)Restrictions.Eq(nameof(questid), (object)questid) && (AbstractCriterion)Restrictions.Eq(nameof(questUnk1), (object)questUnk1)) })); }
/// <summary> </summary> public static site getSiteFromURL() { site site = ActiveRecordBase <site> .FindOne(new List <AbstractCriterion>() { Expression.Eq("base_url", httpService.getCurrentBaseURL()) }.ToArray()); return(site); }
public T Get(IList <ICriterion> queryConditions) { object obj = ActiveRecordBase.FindOne(typeof(T), queryConditions.ToArray()); if (obj == null) { return(null); } else { return(obj as T); } }
/// <summary> </summary> public static site getDefaultSite() { site site = new site(); try{ // the reason for using a try here is that we don't care if it can't find a default site. // what is import is if there is one. this is important for reinstallation site = ActiveRecordBase <site> .FindOne(new List <AbstractCriterion>() { Expression.Eq("is_default", true) }.ToArray()); }catch { site = new site(); } return((site == null) ? new site() : site); }
/// <summary> /// Retrieves a CharacterRecord based on the character name /// </summary> /// <param name="name">the character name</param> /// <returns>the corresponding <seealso cref="T:WCell.RealmServer.Database.CharacterRecord" /></returns> public static CharacterRecord GetRecordByName(string name) { try { return(ActiveRecordBase <CharacterRecord> .FindOne(new ICriterion[1] { (ICriterion)Restrictions.Like("Name", (object)name) })); } catch (Exception ex) { RealmDBMgr.OnDBError(ex); return((CharacterRecord)null); } }
/// <summary> </summary> virtual public String get_meta_date_time(String key) { String result = null; meta_data_date data = ActiveRecordBase <meta_data_date> .FindOne( new List <AbstractCriterion>() { Expression.Eq("post", this), Expression.Eq("meta_key", key) }.ToArray() ); if (data != null) { result = data.value.ToShortTimeString().ToString(); } return(result); }
/// <summary> </summary> virtual public String get_meta_geo(String key) { String result = null; meta_data_geo data = ActiveRecordBase <meta_data_geo> .FindOne( new List <AbstractCriterion>() { Expression.Eq("post", this), Expression.Eq("meta_key", key) }.ToArray() ); if (data != null) { result = data.getLat() + "," + data.getLong(); } return(result); }
/* not right i don't think.. */ /// <summary> </summary> virtual public String get_taxonomy(String alias) { String result = ""; taxonomy data = ActiveRecordBase <taxonomy> .FindOne( new List <AbstractCriterion>() { Expression.Eq("alias", alias) }.ToArray() ); if (data != null) { result = data.alias; } return(result); }
/// <summary> </summary> virtual public String get_option(String key) { String result = ""; if (this.id != 0) { options data = ActiveRecordBase <options> .FindOne( new List <AbstractCriterion>() { Expression.Eq("site", this), Expression.Eq("option_key", key) }.ToArray() ); if (data != null) { result = data.value; } } return(result); }
/// <summary> </summary> virtual public String get_meta_data(String key) { String result = ""; if (this.baseid > 0) { user_meta_data data = ActiveRecordBase <user_meta_data> .FindOne( new List <AbstractCriterion>() { Expression.Eq("appuser", this), Expression.Eq("meta_key", key) }.ToArray() ); if (data != null && data.id > 0) { result = data.value; } } return(result); }
public Account this[string accountName] { get { if (this.IsCached) { using (this.m_lock.EnterReadLock()) { Account account; this.m_cachedAccsByName.TryGetValue(accountName, out account); return(account); } } else { return(ActiveRecordBase <Account> .FindOne(new ICriterion[1] { (ICriterion)Restrictions.Eq("Name", (object)accountName) })); } } }
/* not right i don't think.. */ /// <summary> </summary> virtual public IList <_base> get_taxonomy_items(String type, String alias) { log.Info("looking for " + type + " with alias " + alias); IList <_base> data = new List <_base>(); try { data = ActiveRecordBase <_base> .FindAll( new List <AbstractCriterion>() { Expression.Eq("taxonomy_type", ActiveRecordBase <taxonomy_type> .FindOne( new List <AbstractCriterion>() { Expression.Eq("alias", type) }.ToArray() ) ), Expression.Eq("alias", alias) }.ToArray() ); log.Info("found " + data.Count + " item "); } catch { } return(data); }
/// <summary> /// 根据非ID字段查询实体 /// </summary> /// <param name="queryConditions"></param> /// <returns></returns> public T GetEntityByFields(IList <ICriterion> queryConditions) { return(ActiveRecordBase.FindOne(typeof(T), queryConditions.ToArray()) as T); }