/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016/8/22 13:37:09</remarks> public bool Update(ArenaShopEntity entity, DbTransaction trans = null) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ArenaShop_Update"); database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, entity.ManagerId); database.AddInParameter(commandWrapper, "@ItemString", DbType.AnsiString, entity.ItemString); database.AddInParameter(commandWrapper, "@ExChangeRecord", DbType.AnsiString, entity.ExChangeRecord); database.AddInParameter(commandWrapper, "@RefreshTime", DbType.DateTime, entity.RefreshTime); database.AddInParameter(commandWrapper, "@RefreshNumber", DbType.Int32, entity.RefreshNumber); database.AddInParameter(commandWrapper, "@UpdateTime", DbType.DateTime, entity.UpdateTime); database.AddInParameter(commandWrapper, "@RowTime", DbType.DateTime, entity.RowTime); int results = 0; if (trans != null) { results = database.ExecuteNonQuery(commandWrapper, trans); } else { results = database.ExecuteNonQuery(commandWrapper); } entity.ManagerId = (System.Guid)database.GetParameterValue(commandWrapper, "@ManagerId"); return(Convert.ToBoolean(results)); }
/// <summary> /// 将IDataReader的当前记录读取到ArenaShopEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public ArenaShopEntity LoadSingleRow(IDataReader reader) { var obj = new ArenaShopEntity(); obj.ManagerId = (System.Guid)reader["ManagerId"]; obj.ItemString = (System.String)reader["ItemString"]; obj.ExChangeRecord = (System.String)reader["ExChangeRecord"]; obj.RefreshTime = (System.DateTime)reader["RefreshTime"]; obj.RefreshNumber = (System.Int32)reader["RefreshNumber"]; obj.UpdateTime = (System.DateTime)reader["UpdateTime"]; obj.RowTime = (System.DateTime)reader["RowTime"]; return(obj); }
/// <summary> /// GetById /// </summary> /// <param name="managerId">managerId</param> /// <returns>ArenaShopEntity</returns> /// <remarks>2016/8/22 13:37:09</remarks> public ArenaShopEntity GetById(System.Guid managerId) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_ArenaShop_GetById"); database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, managerId); ArenaShopEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
public static bool Update(ArenaShopEntity arenaShopEntity, DbTransaction trans = null, string zoneId = "") { var provider = new ArenaShopProvider(zoneId); return(provider.Update(arenaShopEntity, trans)); }