当前位置: 首页>>代码示例>>C#>>正文


C# ISession.Update方法代码示例

本文整理汇总了C#中ISession.Update方法的典型用法代码示例。如果您正苦于以下问题:C# ISession.Update方法的具体用法?C# ISession.Update怎么用?C# ISession.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISession的用法示例。


在下文中一共展示了ISession.Update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ChangeDescription

 public virtual void ChangeDescription(string description, ISession session)
 {
     if ((this.TribePermission & TribePermission.DiplomateOfficer) == 0)
         return;
     this.Group.Description = description;
     session.Update(this.Group);
 }
开发者ID:DF-thangld,项目名称:web_game,代码行数:7,代码来源:Player.Methods.Tribe.cs

示例2: ChangeCommitted

        internal static bool ChangeCommitted(this ISessionPersistentObject al,CRUD Operation, IImportContext iic,  ISession session)
        {
            if (al == null)
                throw new Exception("Algo Error");

            bool needtoregister = false;

            IObjectStateCycle oa = al;

            switch (Operation)
            {
                case CRUD.Created:
                    needtoregister = true;
                    session.Save(al);
                    break;

                case CRUD.Update:
                    session.Update(al);         
                    oa.HasBeenUpdated();
                    break;

                case CRUD.Delete:
                    session.Delete(al);
                    oa.SetInternalState(ObjectState.Removed,iic);
                    break;
            }

            al.Context = null;

            return needtoregister;
        }
开发者ID:David-Desmaisons,项目名称:MusicCollection,代码行数:31,代码来源:ISessionObjectExtension.cs

示例3: Populate

        private void Populate(ISession session)
        {
            Assert.IsNotNull(session);
            session.BeginTransaction();
            try
            {
                var person = new Person
                                 {
                                     FirstName = "brady",
                                     LastName = "gaster"
                                 };

                session.Save(person);
                Assert.Greater(person.Id, 0);

                int newPersonId = person.Id;

                person.FirstName = "Gina";
                session.Update(person);

                Assert.Greater(person.Id, 0);
                Assert.IsTrue(person.Id == newPersonId);
                session.Transaction.Commit();
            }
            catch
            {
                session.Transaction.Rollback();
            }
        }
开发者ID:beefarino,项目名称:NHibernate-QuickStart,代码行数:29,代码来源:SessionFactoryTests.cs

示例4: DismissPlayer

        public virtual void DismissPlayer(Player player, ISession session)
        {
            if (player.Group == this.Group || ((this.TribePermission & TribePermission.DismissPlayer) == TribePermission.DismissPlayer))
                return;

            player.Group = null;
            session.Update(player);
        }
开发者ID:DF-thangld,项目名称:web_game,代码行数:8,代码来源:Player.Methods.Tribe.cs

示例5: AddMemberToStaffGroup

        public void AddMemberToStaffGroup(Player currentStaff, Player member, StaffGroup group, ISession session)
        {
            ServicesList.SecurityService.CheckPermission(currentStaff, JobEnum.MemberManagement.ToString(), "write");

            if (member.StaffGroups.Contains(group))
                return;
            member.StaffGroups.Add(group);
            session.Update(member);
        }
开发者ID:DF-thangld,项目名称:web_game,代码行数:9,代码来源:StaffManagementService.cs

示例6: UserService_SaveUser_UpdatesAUser

        public void UserService_SaveUser_UpdatesAUser()
        {
            _session = A.Fake<ISession>();
            _userService = new UserService(_session, _siteSettings);
            var user = new User();

            _userService.SaveUser(user);

            A.CallTo(() => _session.Update(user)).MustHaveHappened();
        }
开发者ID:neozhu,项目名称:MrCMS,代码行数:10,代码来源:UserServiceTests.cs

示例7: RemoveUrls

 private static void RemoveUrls(Webpage webpage, List<UrlHistory> urlsToRemove, ISession session)
 {
     foreach (UrlHistory history in urlsToRemove)
     {
         webpage.Urls.Remove(history);
         history.Webpage = null;
         UrlHistory closureHistory = history;
         session.Update(closureHistory);
     }
 }
开发者ID:neozhu,项目名称:MrCMS,代码行数:10,代码来源:UpdateUrlHistoryService.cs

示例8: CreateTribe

 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);
 }
开发者ID:DF-thangld,项目名称:web_game,代码行数:12,代码来源:Player.Methods.Tribe.cs

示例9: DisbandTribe

 public virtual void DisbandTribe(ISession session)
 {
     if (this.Group == null && this.TribePermission != beans.TribePermission.Duke)
         return;
     foreach (TribeInvite invite in this.Group.Invites)
         session.Delete(invite);
     foreach (Player member in this.Group.Members)
     {
         member.Group = null;
         session.Update(member);
     }
     session.Delete(this.Group);
 }
开发者ID:DF-thangld,项目名称:web_game,代码行数:13,代码来源:Player.Methods.Tribe.cs

示例10: Expire

        public virtual void Expire(DateTime time, ISession session)
        {
            if (time < this.FinishTime)
                return;

            this.Hero.Owner = this.Owner;
            this.Hero.InVillage = this.Owner.MainVillage;
            if (this.Owner.MainVillage.MainHero == null)
            {
                this.Owner.MainVillage.MainHero = this.Hero;
                
            }
            Price p = Recruit.GetPrice(TroopType.Nobleman);
            this.Owner.MainVillage.Population += p.Population;
            this.Owner.MainVillage.Heroes.Add(this.Hero);
            session.Update(this.Owner.MainVillage);
            this.Hero.IsRecruiting = false;
            this.Hero.IsDead = false;
            session.Update(this.Hero);
            session.Delete(this);
            
        }
开发者ID:DF-thangld,项目名称:web_game,代码行数:22,代码来源:RecruitHero.cs

示例11: OnSaving

 public virtual void OnSaving(ISession session)
 {
     if (Selected && FormProperty.OnlyOneOptionSelectable)
     {
         foreach (var option in FormProperty.Options.Except(this))
         {
             option.Selected = false;
             session.Update(option);
         }
     }
     else if (FormProperty.OnlyOneOptionSelectable && !FormProperty.Options.Except(this).Any())
     {
         Selected = true;
     }
 }
开发者ID:neozhu,项目名称:MrCMS,代码行数:15,代码来源:FormListOption.cs

示例12: ResetScheduledTasks

 private void ResetScheduledTasks(ISession session, DateTime now)
 {
     var hungScheduledTasks = session.QueryOver<ScheduledTask>()
         .Where(
             task => task.Site.Id == _site.Id &&
                     (task.Status == TaskExecutionStatus.AwaitingExecution ||
                      task.Status == TaskExecutionStatus.Executing) &&
                     (task.LastQueuedAt < now.AddMinutes(-15) || task.LastQueuedAt == null)
         )
         .List();
     foreach (var task in hungScheduledTasks)
     {
         task.Status = TaskExecutionStatus.Pending;
         session.Update(task);
     }
 }
开发者ID:neozhu,项目名称:MrCMS,代码行数:16,代码来源:TaskResetter.cs

示例13: Save

        public virtual void Save(ISession session)
        {
            int quantity = this.OfferQuantity * this.OfferNumber;
            if (this.AtVillage[this.OfferType] < quantity)
                throw new TribalWarsException("Không đủ tài nguyên");
            int merchant = (int)Math.Ceiling((double)(this.OfferQuantity / 1000)) * this.OfferNumber;
            if (merchant > this.AtVillage.VillageBuildingData.Merchant)
                throw new TribalWarsException("Không đủ thương nhân");

            this.AtVillage[this.OfferType] -= quantity;
            this.AtVillage.VillageBuildingData.Merchant -= merchant;
            this.CreateTime = DateTime.Now;

            this.AtVillage.Offers.Add(this);
            session.Save(this);
            session.Update(this.AtVillage);
        }
开发者ID:DF-thangld,项目名称:web_game,代码行数:17,代码来源:Offer.cs

示例14: Effect

        public override MovingCommand Effect(ISession session)
        {
            this.ToVillage.VillageResourceData.Clay += this.Clay;
            this.ToVillage.VillageResourceData.Wood += this.Wood;
            this.ToVillage.VillageResourceData.Iron += this.Iron;

            Return r = new Return();
            r.Merchant = this.Merchant;
            r.FromVillage = this.ToVillage;
            r.ToVillage = this.FromVillage;
            r.StartingTime = this.LandingTime;
            r.LandingTime = Map.LandingTime(TroopType.Merchant, r.FromVillage, r.ToVillage, r.StartingTime);

            SendResourceReport report = new SendResourceReport();
            report.Time = this.LandingTime;
            report.Title = String.Format("{0} gửi tài nguyên đến {1} ({2}|{3})", this.FromVillage.Player.Username, this.ToVillage.Name, this.ToVillage.X.ToString("000"), this.ToVillage.Y.ToString("000"));
            report.Unread = true;
            report.Owner = this.ToVillage.Player;
            report.Clay = this.Clay;
            report.Wood = this.Wood;
            report.Iron = this.Iron;
            report.FromVillage = this.FromVillage;
            report.FromPlayer = this.FromVillage.Player;
            report.ToVillage = this.ToVillage;
            report.ToPlayer = this.ToVillage.Player;


            this.ToVillage.MovingCommandsToMe.Remove(this);
            this.ToVillage.MovingCommandsFromMe.Add(r);

            this.FromVillage.MovingCommandsFromMe.Remove(this);
            this.FromVillage.MovingCommandsToMe.Add(r);

            session.Save(r);
            session.Delete(this);

            session.Update(this.ToVillage);
            session.Update(this.FromVillage);

            session.Save(report);

            return r;
            
        }
开发者ID:DF-thangld,项目名称:web_game,代码行数:44,代码来源:SendResource.cs

示例15: AddUrls

 private void AddUrls(Webpage webpage, List<string> urlsToAdd, ISession session)
 {
     foreach (string item in urlsToAdd)
     {
         UrlHistory history =
             _session.Query<UrlHistory>().FirstOrDefault(urlHistory => urlHistory.UrlSegment == item);
         bool isNew = history == null;
         if (isNew)
         {
             history = new UrlHistory {UrlSegment = item, Webpage = webpage};
             session.Save(history);
         }
         else
             history.Webpage = webpage;
         if (!webpage.Urls.Contains(history))
             webpage.Urls.Add(history);
         session.Update(history);
     }
 }
开发者ID:neozhu,项目名称:MrCMS,代码行数:19,代码来源:UpdateUrlHistoryService.cs


注:本文中的ISession.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。