/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016/6/22 14:33:54</remarks> public bool Update(TxYellowvipEntity entity, DbTransaction trans = null) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_TxYellowvip_Update"); database.AddInParameter(commandWrapper, "@Account", DbType.AnsiString, entity.Account); database.AddInParameter(commandWrapper, "@IsYellowVip", DbType.Boolean, entity.IsYellowVip); database.AddInParameter(commandWrapper, "@IsYellowYearVip", DbType.Boolean, entity.IsYellowYearVip); database.AddInParameter(commandWrapper, "@IsYellowHighVip", DbType.Boolean, entity.IsYellowHighVip); database.AddInParameter(commandWrapper, "@YellowVipLevel", DbType.Int32, entity.YellowVipLevel); database.AddInParameter(commandWrapper, "@OpeningTimes", DbType.Int32, entity.OpeningTimes); database.AddInParameter(commandWrapper, "@Status", DbType.Int32, entity.Status); database.AddInParameter(commandWrapper, "@RowTime", DbType.DateTime, entity.RowTime); database.AddInParameter(commandWrapper, "@UpdateTime", DbType.DateTime, entity.UpdateTime); database.AddInParameter(commandWrapper, "@ExtraData", DbType.AnsiString, entity.ExtraData); int results = 0; if (trans != null) { results = database.ExecuteNonQuery(commandWrapper, trans); } else { results = database.ExecuteNonQuery(commandWrapper); } return(Convert.ToBoolean(results)); }
/// <summary> /// 将IDataReader的当前记录读取到TxYellowvipEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public TxYellowvipEntity LoadSingleRow(IDataReader reader) { var obj = new TxYellowvipEntity(); obj.Account = (System.String)reader["Account"]; obj.IsYellowVip = (System.Boolean)reader["IsYellowVip"]; obj.IsYellowYearVip = (System.Boolean)reader["IsYellowYearVip"]; obj.IsYellowHighVip = (System.Boolean)reader["IsYellowHighVip"]; obj.YellowVipLevel = (System.Int32)reader["YellowVipLevel"]; obj.OpeningTimes = (System.Int32)reader["OpeningTimes"]; obj.Status = (System.Int32)reader["Status"]; obj.RowTime = (System.DateTime)reader["RowTime"]; obj.UpdateTime = (System.DateTime)reader["UpdateTime"]; obj.ExtraData = (System.String)reader["ExtraData"]; return(obj); }
/// <summary> /// GetById /// </summary> /// <param name="account">account</param> /// <returns>TxYellowvipEntity</returns> /// <remarks>2016/6/22 14:33:54</remarks> public TxYellowvipEntity GetById(System.String account) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_TxYellowvip_GetById"); database.AddInParameter(commandWrapper, "@Account", DbType.AnsiString, account); TxYellowvipEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
public static bool Update(TxYellowvipEntity txYellowvipEntity, DbTransaction trans = null, string zoneId = "") { var provider = new TxYellowvipProvider(zoneId); return(provider.Update(txYellowvipEntity, trans)); }