本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
示例5: Update
public bool Update(GroupSaleVehicle poco, IDbConnection connection)
{
return connection.Update(poco);
}
示例6: Update
public bool Update(AbsBuybackResult poco, IDbConnection connection)
{
return connection.Update(poco);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}