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


C# IDbConnection.Update方法代码示例

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


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

示例1: DoInsertUpdate

        private static void DoInsertUpdate(IDbConnection db)
        {
            db.CreateTable<ParamPassword>(true);

            var row = new ParamPassword { Id = 2, Password = 6 };
            db.Insert(row);

            row.Password = 335;
            db.Update(row);
        }
开发者ID:JackFong,项目名称:ServiceStack.OrmLite,代码行数:10,代码来源:WrappedCommandTests.cs

示例2: Update_OrgGroup

 /// <summary>
 /// 修改[集团]数据到本地
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="transaction"></param>
 /// <param name="orgGroup"></param>
 /// <returns></returns>
 internal int Update_OrgGroup(IDbConnection connection, IDbTransaction transaction, OrgGroup orgGroup)
 {
     var update = connection.Update("OrgGroup")
         .Set("PK_Group", DbType.AnsiString, orgGroup.PK_Group)
         .Set("InnerCode", DbType.AnsiString, orgGroup.InnerCode)
         .Set("Name", DbType.AnsiString, orgGroup.Name)
         .Set("T_Updater", DbType.AnsiString, orgGroup.T_Updater)
         .Set("T_UpdaterName", DbType.AnsiString, orgGroup.T_UpdaterName)
         .Set("T_UpdateTime", DbType.DateTime, orgGroup.T_UpdateTime)
         .Set("NC_Modifiedtime", DbType.AnsiString, orgGroup.NC_Modifiedtime)
         .Where(WhereMySQL.Equal("NC_PK_Group", DbType.AnsiString, orgGroup.NC_PK_Group))
         .Execute();
     return update;
 }
开发者ID:a526757124,项目名称:OTGFramework,代码行数:21,代码来源:PersistenceDataToLocal.cs

示例3: RunMigrations

        internal static void RunMigrations(IDbConnection p_Connection, String p_DatabaseVersion)
        {
            switch (p_DatabaseVersion)
            {
                case "1.2.0.0":
                    RunMigrations1300(p_Connection);
                    break;

                case "1.1.2.1":
                    RunMigrations1200(p_Connection);
                    RunMigrations1300(p_Connection);
                    break;

                case "1.1.2.0":
                    RunMigrations1121(p_Connection);
                    RunMigrations1200(p_Connection);
                    RunMigrations1300(p_Connection);
                    break;

                case "1.1.0.0":
                    RunMigrations1120(p_Connection);
                    RunMigrations1121(p_Connection);
                    RunMigrations1200(p_Connection);
                    RunMigrations1300(p_Connection);
                    break;

                case "1.0.1.0":
                    RunMigrations1100(p_Connection);
                    RunMigrations1120(p_Connection);
                    RunMigrations1121(p_Connection);
                    RunMigrations1200(p_Connection);
                    RunMigrations1300(p_Connection);
                    break;

                case "1.0.0.0":
                    RunMigrations1010(p_Connection);
                    RunMigrations1100(p_Connection);
                    RunMigrations1120(p_Connection);
                    RunMigrations1121(p_Connection);
                    RunMigrations1200(p_Connection);
                    RunMigrations1300(p_Connection);
                    break;
            }

            var s_Version = p_Connection.SingleById<CoreSetting>("gcver");
            s_Version.Value = Application.GetVersion();

            p_Connection.Update(s_Version);
        }
开发者ID:WildGenie,项目名称:GrooveCaster,代码行数:49,代码来源:Migrations.cs

示例4: CheckPermitions

        public static Token CheckPermitions(string authHeader, IDbConnection db)
        {
            if (authHeader.IsNullOrEmpty())
                return null;

            if (!authHeader.StartsWith("Bearer ", StringComparison.Ordinal))
                return null;

            Guid token;
            if (!Guid.TryParse(authHeader.Substring(7), out token))
                return null;

            var dbToken = db.FirstOrDefaultById<Token>(token);
            if (dbToken == null || dbToken.ExpiresIn < DateTime.Now)
                return null;

            dbToken.ExpiresIn = DateTime.Now + TimeSpan.FromDays(7);
            db.Update(dbToken);
            return dbToken;
        }
开发者ID:tarasen,项目名称:RSOI_lab2,代码行数:20,代码来源:AuthService.cs

示例5: Update

 public bool Update(GroupSaleVehicle poco, IDbConnection connection)
 {
     return connection.Update(poco);
 }
开发者ID:coderasm,项目名称:ABSBuybackMVCWebAPI,代码行数:4,代码来源:GSVRepository.cs

示例6: Update

 public bool Update(AbsBuybackResult poco, IDbConnection connection)
 {
     return connection.Update(poco);
 }
开发者ID:coderasm,项目名称:ABSBuybackMVCWebAPI,代码行数:4,代码来源:AbsBuyBackResultRepository.cs

示例7: ResetUpdateDate

 private static void ResetUpdateDate(IDbConnection db)
 {
     var updateTime = new DateTime(2011, 1, 1, 1, 1, 1, DateTimeKind.Utc);
     db.Update<DefaultValues>(new { UpdatedDateUtc = updateTime }, p => p.Id == 1);
 }
开发者ID:BruceCowan-AI,项目名称:ServiceStack.OrmLite,代码行数:5,代码来源:DefaultValueTests.cs

示例8: Update_PersonCore

 /// <summary>
 /// 修改[人员]数据到本地
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="transaction"></param>
 /// <param name="person"></param>
 /// <returns></returns>
 internal int Update_PersonCore(IDbConnection connection, IDbTransaction transaction, PersonCore person)
 {
     var update = connection.Update("PersonCore")
         .Set("PK_User", DbType.AnsiString, person.PK_User)
         .Set("Code", DbType.AnsiString, person.Code)
         .Set("Name", DbType.AnsiString, person.Name)
         .Set("ShortName", DbType.AnsiString, person.ShortName)
         .Set("IDCardNumber", DbType.AnsiString, person.IDCardNumber)
         .Set("Sex", DbType.Int32, person.Sex)
         .Set("Age", DbType.Int32, person.Age)
         .Set("Email", DbType.AnsiString, person.Email)
         .Set("Mobile", DbType.AnsiString, person.Mobile)
         .Set("Birthdate", DbType.AnsiString, person.Birthdate)
         .Set("JoinWorkDate", DbType.AnsiString, person.JoinWorkDate)
         .Set("Censusaddr", DbType.AnsiString, person.Censusaddr)
         .Set("T_Updater", DbType.AnsiString, person.T_Updater)
         .Set("T_UpdaterName", DbType.AnsiString, person.T_UpdaterName)
         .Set("T_UpdateTime", DbType.DateTime, person.T_UpdateTime)
         .Set("NC_Modifiedtime", DbType.AnsiString, person.NC_Modifiedtime)
         .Where(WhereMySQL.Equal("NC_PK_User", DbType.AnsiString, person.NC_PK_User))
         .Execute();
     return update;
 }
开发者ID:a526757124,项目名称:OTGFramework,代码行数:30,代码来源:PersistenceDataToLocal.cs

示例9: EditPost

        public ActionResult EditPost(int? id, string[] selectedCourses)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            _connection = Connect.Open();
            var instructorToUpdate = GetInstructor(id);

            var courseLst = GetInstructorCourse(id);

            courseLst.ForEach(instructorToUpdate.AddCourse);

            if (TryUpdateModel(instructorToUpdate, "",
                new[] { "LastName", "FirstMidName", "HireDate", "OfficeAssignment" }))
            {
                try
                {
                    instructorToUpdate.OfficeAssignment.InstructorId = instructorToUpdate.InstructorId;

                    var checkOffice = _connection.Get<OfficeAssignment>(id);

                    if (checkOffice != null)
                    {
                        //update OfficeAssignment
                        _connection.Update(instructorToUpdate.OfficeAssignment);
                    }
                    else
                    {
                        //insert OfficeAssignment
                        _connection.Insert(instructorToUpdate.OfficeAssignment);

                    }

                    UpdateInstructorCourses(selectedCourses, instructorToUpdate);
                    _connection.Update(instructorToUpdate);
                    return RedirectToAction("Index");
                }
                catch (RetryLimitExceededException)
                {
                    ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists please see the administrator.");
                }

            }
            PopulateAssignedCourseData(instructorToUpdate);
            return View(instructorToUpdate);
        }
开发者ID:armory09,项目名称:ConstosoUniversityMVCwithDapper,代码行数:47,代码来源:InstructorController.cs

示例10: Update_Organization

 /// <summary>
 /// 修改[组织]数据到本地
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="transaction"></param>
 /// <param name="org"></param>
 /// <returns></returns>
 internal int Update_Organization(IDbConnection connection, IDbTransaction transaction, Organization org)
 {
     var update = connection.Update("Organization")
         .Set("PK_Org", DbType.AnsiString, org.PK_Org)
         .Set("InnerCode", DbType.AnsiString, org.InnerCode)
         .Set("Name", DbType.AnsiString, org.Name)
         .Set("ShortName", DbType.AnsiString, org.ShortName)
         .Set("PK_FOrg", DbType.AnsiString, org.PK_FOrg)
         .Set("PK_Group", DbType.AnsiString, org.PK_Group)
         .Set("T_Updater", DbType.AnsiString, org.T_Updater)
         .Set("T_UpdaterName", DbType.AnsiString, org.T_UpdaterName)
         .Set("T_UpdateTime", DbType.DateTime, org.T_UpdateTime)
         .Set("NC_Modifiedtime", DbType.AnsiString, org.NC_Modifiedtime)
         .Where(WhereMySQL.Equal("NC_PK_Org", DbType.AnsiString, org.NC_PK_Org))
         .Execute();
     return update;
 }
开发者ID:a526757124,项目名称:OTGFramework,代码行数:24,代码来源:PersistenceDataToLocal.cs

示例11: Update_DataSyncRecord

 /// <summary>
 /// 修改[数据同步记录]数据
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="transaction"></param>
 /// <param name="dataSyncRecord"></param>
 /// <returns></returns>
 internal int Update_DataSyncRecord(IDbConnection connection, IDbTransaction transaction, DataSyncRecord dataSyncRecord)
 {
     var insert = connection.Update("SysAccount")
         .Set("PK_ID", DbType.AnsiString, dataSyncRecord.PK_ID)
         .Set("WeChatSynced", DbType.Int32, dataSyncRecord.WeChatSynced)
         .Set("EmailSynced", DbType.Int32, dataSyncRecord.EmailSynced)
         .Set("DataType", DbType.Int32, dataSyncRecord.DataType)
         .Set("WeChatSyncDate", DbType.DateTime, dataSyncRecord.WeChatSyncDate)
         .Set("EmailSyncDate", DbType.DateTime, dataSyncRecord.EmailSyncDate)
         .Where(WhereMySQL.Equal("PK_ID", DbType.AnsiString, dataSyncRecord.PK_ID))
         .Execute();
     return insert;
 }
开发者ID:a526757124,项目名称:OTGFramework,代码行数:20,代码来源:PersistenceDataToLocal.cs

示例12: Update_SysAccount

 /// <summary>
 /// 修改[系统账号]数据
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="transaction"></param>
 /// <param name="sysAccount"></param>
 /// <returns></returns>
 internal int Update_SysAccount(IDbConnection connection, IDbTransaction transaction, SysAccount sysAccount)
 {
     var update = connection.Update("SysAccount")
         .Set("PK_Account", DbType.AnsiString, sysAccount.PK_Account)
         .Set("UserName", DbType.AnsiString, sysAccount.UserName)
         .Set("Password", DbType.AnsiString, sysAccount.Password)
         .Set("WeChatNumber", DbType.AnsiString, sysAccount.WeChatNumber)
         .Set("NCIdCard", DbType.AnsiString, sysAccount.NCIdCard)
         .Set("T_Updater", DbType.AnsiString, sysAccount.T_Updater)
         .Set("T_UpdaterName", DbType.AnsiString, sysAccount.T_UpdaterName)
         .Set("T_UpdateTime", DbType.DateTime, sysAccount.T_UpdateTime)
         .Where(WhereMySQL.Equal("NCIdCard", DbType.AnsiString, sysAccount.NCIdCard))
         .Execute();
     return update;
 }
开发者ID:a526757124,项目名称:OTGFramework,代码行数:22,代码来源:PersistenceDataToLocal.cs

示例13: Update_PersonJob

 /// <summary>
 /// 修改[人员工作关系]数据到本地
 /// </summary>
 /// <param name="personJob"></param>
 /// <returns></returns>
 internal int Update_PersonJob(IDbConnection connection, IDbTransaction transaction, PersonJob personJob)
 {
     var update = connection.Update("PersonJob")
         .Set("PK_Job", DbType.AnsiString, personJob.PK_Job)
         .Set("PK_User", DbType.AnsiString, personJob.PK_User)
         .Set("PK_Dept", DbType.AnsiString, personJob.PK_Dept)
         .Set("PK_Org", DbType.AnsiString, personJob.PK_Org)
         .Set("PK_Group", DbType.AnsiString, personJob.PK_Group)
         .Where(WhereMySQL.Equal("NC_PK_Job", DbType.AnsiString, personJob.NC_PK_Job))
         .Execute();
     return update;
 }
开发者ID:a526757124,项目名称:OTGFramework,代码行数:17,代码来源:PersistenceDataToLocal.cs

示例14: UpdateCharacter

        public static Character UpdateCharacter(this Character character, IDbConnection ctx, int playerId, Terraria.Player player)
        {
            character.PlayerId = playerId;
            character.UUID = player.ClientUUId;
            character.Health = player.statLife;
            character.MaxHealth = player.statLifeMax;
            character.Mana = player.statMana;
            character.MaxMana = player.statManaMax;
            character.SpawnX = player.SpawnX;
            character.SpawnY = player.SpawnY;
            character.Hair = player.hair;
            character.HairDye = player.hairDye;
            character.HideVisual = DataEncoding.EncodeInteger(player.hideVisual);
            character.Difficulty = player.difficulty;
            character.HairColor = DataEncoding.EncodeColorAsInt32(player.hairColor);
            character.SkinColor = DataEncoding.EncodeColorAsInt32(player.skinColor);
            character.EyeColor = DataEncoding.EncodeColorAsInt32(player.eyeColor);
            character.ShirtColor = DataEncoding.EncodeColorAsInt32(player.shirtColor);
            character.UnderShirtColor = DataEncoding.EncodeColorAsInt32(player.underShirtColor);
            character.PantsColor = DataEncoding.EncodeColorAsInt32(player.pantsColor);
            character.ShoeColor = DataEncoding.EncodeColorAsInt32(player.shoeColor);
            character.AnglerQuests = player.anglerQuestsFinished;

            ctx.Update(character);

            return character;
        }
开发者ID:DeathCradle,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:27,代码来源:CharacterExtensions.cs

示例15: EditPost

        public ActionResult EditPost(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            _connection = Connect.Open();
            var studentToUpdate = _connection.Get<Student>(id);
            if (TryUpdateModel(studentToUpdate, "", new[]
            {
                    "LastName", "FirstMidName", "EnrollmentDate"
                }))
            {
                try
                {
                    _connection.Update(studentToUpdate);
                    return RedirectToAction("Index");
                }
                catch (DataException)
                {
                    ModelState.AddModelError("","Unable to save changes. Try again, and if the problem persist please see your system administrator");
                }
            }

            return View(studentToUpdate);
        }
开发者ID:armory09,项目名称:ConstosoUniversityMVCwithDapper,代码行数:26,代码来源:StudentController.cs


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