public SubscriptionData(Habbo habbo, string type) { _habbo = habbo; using (ISession db = CoreManager.ServerCore.GetDatabaseSession()) { _subscriptionDatabase = db.CreateCriteria<Subscription>(). Add(Restrictions.Eq("habbo_id", _habbo.GetID())). Add(Restrictions.Eq("subscription_type", type)). UniqueResult<Subscription>(); } if (_subscriptionDatabase != null) return; _subscriptionDatabase = new Subscription {habbo_id = habbo.GetID()}; }
public SubscriptionData(Habbos.Habbo Habbo, string Type) { this.fHabbo = Habbo; try { using (ISession DB = CoreManager.GetCore().GetDatabaseSession()) { this.fSubscriptionDatabase = DB.CreateCriteria<Database.Subscription>(). Add(new NHibernate.Criterion.EqPropertyExpression("habbo_id", this.fHabbo.GetID().ToString())). Add(new NHibernate.Criterion.EqPropertyExpression("subscription_type", Type)). List<Database.Subscription>().First(); } } catch (ArgumentNullException) { this.fSubscriptionDatabase = new Database.Subscription(); this.fSubscriptionDatabase.habbo_id = Habbo.GetID(); } }