/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2017/1/12 18:55:15</remarks> public bool Update(RevelationDrawEntity entity, DbTransaction trans = null) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_RevelationDraw_Update"); database.AddInParameter(commandWrapper, "@DrawId", DbType.Guid, entity.DrawId); database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, entity.ManagerId); database.AddInParameter(commandWrapper, "@MarkId", DbType.Int32, entity.MarkId); database.AddInParameter(commandWrapper, "@Schedule", DbType.Int32, entity.Schedule); database.AddInParameter(commandWrapper, "@AllItemString", DbType.AnsiString, entity.AllItemString); database.AddInParameter(commandWrapper, "@PrizeItemString", DbType.AnsiString, entity.PrizeItemString); database.AddInParameter(commandWrapper, "@OpenNumber", DbType.Int32, entity.OpenNumber); database.AddInParameter(commandWrapper, "@Status", DbType.Int32, entity.Status); 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.DrawId = (System.Guid)database.GetParameterValue(commandWrapper, "@DrawId"); return(Convert.ToBoolean(results)); }
/// <summary> /// 将IDataReader的当前记录读取到RevelationDrawEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public RevelationDrawEntity LoadSingleRow(IDataReader reader) { var obj = new RevelationDrawEntity(); obj.DrawId = (System.Guid)reader["DrawId"]; obj.ManagerId = (System.Guid)reader["ManagerId"]; obj.MarkId = (System.Int32)reader["MarkId"]; obj.Schedule = (System.Int32)reader["Schedule"]; obj.AllItemString = (System.String)reader["AllItemString"]; obj.PrizeItemString = (System.String)reader["PrizeItemString"]; obj.OpenNumber = (System.Int32)reader["OpenNumber"]; obj.Status = (System.Int32)reader["Status"]; obj.UpdateTime = (System.DateTime)reader["UpdateTime"]; obj.RowTime = (System.DateTime)reader["RowTime"]; return(obj); }
/// <summary> /// GetById /// </summary> /// <param name="drawId">drawId</param> /// <returns>RevelationDrawEntity</returns> /// <remarks>2017/1/12 18:55:15</remarks> public RevelationDrawEntity GetById(System.Guid drawId) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_RevelationDraw_GetById"); database.AddInParameter(commandWrapper, "@DrawId", DbType.Guid, drawId); RevelationDrawEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
public static bool Update(RevelationDrawEntity revelationDrawEntity, DbTransaction trans = null, string zoneId = "") { var provider = new RevelationDrawProvider(zoneId); return(provider.Update(revelationDrawEntity, trans)); }