/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2017/1/10 17:36:20</remarks> public bool Update(RevelationMyhistoryEntity entity, DbTransaction trans = null) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_RevelationMyhistory_Update"); database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, entity.ManagerId); database.AddInParameter(commandWrapper, "@GoalsString", DbType.Binary, entity.GoalsString); 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的当前记录读取到RevelationMyhistoryEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public RevelationMyhistoryEntity LoadSingleRow(IDataReader reader) { var obj = new RevelationMyhistoryEntity(); obj.ManagerId = (System.Guid)reader["ManagerId"]; obj.GoalsString = (System.Byte[])reader["GoalsString"]; obj.UpdateTime = (System.DateTime)reader["UpdateTime"]; obj.RowTime = (System.DateTime)reader["RowTime"]; return(obj); }
public RevelationHistoryFrame(Guid managerId) { var history = RevelationMyhistoryMgr.GetById(managerId); if (history == null) { history = new RevelationMyhistoryEntity(managerId, new byte[0], DateTime.Now, DateTime.Now); RevelationMyhistoryMgr.Insert(history); } _historyEntity = history; AnalyseFightMap(); }
/// <summary> /// GetById /// </summary> /// <param name="managerId">managerId</param> /// <returns>RevelationMyhistoryEntity</returns> /// <remarks>2017/1/10 17:36:20</remarks> public RevelationMyhistoryEntity GetById(System.Guid managerId) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_RevelationMyhistory_GetById"); database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, managerId); RevelationMyhistoryEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
public static bool Update(RevelationMyhistoryEntity revelationMyhistoryEntity, DbTransaction trans = null, string zoneId = "") { var provider = new RevelationMyhistoryProvider(zoneId); return(provider.Update(revelationMyhistoryEntity, trans)); }