/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016/5/11 17:46:06</remarks> public bool Update(LadderDayprizeEntity entity, DbTransaction trans = null) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_LadderDayprize_Update"); database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, entity.ManagerId); database.AddInParameter(commandWrapper, "@WinNumber", DbType.Int32, entity.WinNumber); database.AddInParameter(commandWrapper, "@PrizeRecord", DbType.AnsiString, entity.PrizeRecord); 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的当前记录读取到LadderDayprizeEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public LadderDayprizeEntity LoadSingleRow(IDataReader reader) { var obj = new LadderDayprizeEntity(); obj.ManagerId = (System.Guid)reader["ManagerId"]; obj.WinNumber = (System.Int32)reader["WinNumber"]; obj.PrizeRecord = (System.String)reader["PrizeRecord"]; obj.UpdateTime = (System.DateTime)reader["UpdateTime"]; obj.RowTime = (System.DateTime)reader["RowTime"]; return(obj); }
public LadderDayprizeEntity InsertLadderDayPrize(Guid managerId) { LadderDayprizeEntity entity = new LadderDayprizeEntity(); entity.ManagerId = managerId; entity.PrizeRecord = "0,0,0,0"; entity.RowTime = DateTime.Now; entity.UpdateTime = DateTime.Now; entity.WinNumber = 0; LadderDayprizeMgr.Insert(entity); return(entity); }
/// <summary> /// GetById /// </summary> /// <param name="managerId">managerId</param> /// <returns>LadderDayprizeEntity</returns> /// <remarks>2016/5/11 17:46:06</remarks> public LadderDayprizeEntity GetById(System.Guid managerId) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_LadderDayprize_GetById"); database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, managerId); LadderDayprizeEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
public static bool Update(LadderDayprizeEntity ladderDayprizeEntity, DbTransaction trans = null, string zoneId = "") { var provider = new LadderDayprizeProvider(zoneId); return(provider.Update(ladderDayprizeEntity, trans)); }