예제 #1
0
        public virtual void SetDiplomacy(Group tribe, TribeDiplomate diplomacy, ISession session)
        {
            if ((this.TribePermission & TribePermission.DiplomateOfficer) != TribePermission.DiplomateOfficer)
                return;
            if (this.Group == tribe)
                return;

            if (diplomacy == TribeDiplomate.NoRelation)
            {
                object[] objects = { this.Group, tribe };
                NHibernate.Type.IType[] types = { NHibernate.NHibernateUtil.GuessType(typeof(Group)), NHibernate.NHibernateUtil.GuessType(typeof(Group)) };
                session.Delete(" from TribeRelation r where r.CurrentTribe=:current and r.DiplomaticTribe=:tribe", objects, types);
                return;
            }

            TribeRelation oldRelation = (from tribeRelation in session.Linq<TribeRelation>()
                                         where tribeRelation.CurrentTribe == this.Group
                                         && tribeRelation.DiplomaticTribe == tribe
                                         select tribeRelation).SingleOrDefault<TribeRelation>();

            if (oldRelation != null)
                return;

            TribeRelation relation = new TribeRelation();
            relation.CurrentTribe = this.Group;
            relation.DiplomaticTribe = tribe;
            relation.Diplomacy = diplomacy;
            session.Save(relation);
        }
예제 #2
0
 public virtual void CreateTribe(string tag, string name, ISession session)
 {
     beans.Group group = new Group();
     group.Tag = tag;
     group.Name = name;
     group.Description = "";
     group.Introduction = "";
     this.Group = group;
     this.TribePermission = TribePermission.Duke;
     session.Save(group);
     session.Update(this);
 }
예제 #3
0
 public static IList<ShoutboxData> GetShoutbox(Group group, int size, bool ascending, ISession session)
 {
     if (group == null)
     {
         IQuery query = session.CreateQuery("from ShoutboxData sd where sd.Group is null order by ID " + ((ascending) ? "asc" : "desc"));
         query.SetMaxResults(size);
         query.SetFirstResult(0);
         return query.List<ShoutboxData>();
     }
     else
     {
         ICriteria criteria = session.CreateCriteria(typeof(ShoutboxData));
         criteria.Add(Expression.Eq("Group", group));
         criteria.AddOrder(new Order("ID", ascending));
         criteria.SetFirstResult(0);
         criteria.SetMaxResults(size);
         return criteria.List<ShoutboxData>();
     }
 }
예제 #4
0
 public void ChangeGroupInfo(Group g, NHibernate.ISession session)
 {
     throw new System.NotImplementedException();
 }