/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2015/2/12 14:30:06</remarks> public bool Update(RevelationCheckpointEntity entity, DbTransaction trans = null) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_RevelationCheckpoint_Update"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx); database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, entity.ManagerId); database.AddInParameter(commandWrapper, "@ToDayGeneralNums", DbType.Int32, entity.ToDayGeneralNums); database.AddInParameter(commandWrapper, "@CustomsPass", DbType.Int32, entity.CustomsPass); database.AddInParameter(commandWrapper, "@Schedule", DbType.Int32, entity.Schedule); database.AddInParameter(commandWrapper, "@IsGeneral", DbType.Boolean, entity.IsGeneral); database.AddInParameter(commandWrapper, "@GeneralTime", DbType.DateTime, entity.GeneralTime); database.AddInParameter(commandWrapper, "@IsGeneralAwary", DbType.Boolean, entity.IsGeneralAwary); database.AddInParameter(commandWrapper, "@GeneralAwaryTime", DbType.DateTime, entity.GeneralAwaryTime); database.AddInParameter(commandWrapper, "@AwaryItem", DbType.AnsiString, entity.AwaryItem); database.AddInParameter(commandWrapper, "@States", DbType.Int32, entity.States); database.AddInParameter(commandWrapper, "@RowVersion", DbType.Binary, entity.RowVersion); int results = 0; if (trans != null) { results = database.ExecuteNonQuery(commandWrapper, trans); } else { results = database.ExecuteNonQuery(commandWrapper); } entity.Idx = (System.Int32)database.GetParameterValue(commandWrapper, "@Idx"); return(Convert.ToBoolean(results)); }
/// <summary> /// 将IDataReader的当前记录读取到RevelationCheckpointEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public RevelationCheckpointEntity LoadSingleRow(IDataReader reader) { var obj = new RevelationCheckpointEntity(); obj.Idx = (System.Int32)reader["Idx"]; obj.ManagerId = (System.Guid)reader["ManagerId"]; obj.ToDayGeneralNums = (System.Int32)reader["ToDayGeneralNums"]; obj.CustomsPass = (System.Int32)reader["CustomsPass"]; obj.Schedule = (System.Int32)reader["Schedule"]; obj.IsGeneral = (System.Boolean)reader["IsGeneral"]; obj.GeneralTime = (System.DateTime)reader["GeneralTime"]; obj.IsGeneralAwary = (System.Boolean)reader["IsGeneralAwary"]; obj.GeneralAwaryTime = (System.DateTime)reader["GeneralAwaryTime"]; obj.AwaryItem = (System.String)reader["AwaryItem"]; obj.States = (System.Int32)reader["States"]; obj.RowVersion = (System.Byte[])reader["RowVersion"]; return(obj); }
/// <summary> /// GetById /// </summary> /// <param name="idx">idx</param> /// <returns>RevelationCheckpointEntity</returns> /// <remarks>2015/2/12 14:30:06</remarks> public RevelationCheckpointEntity GetById(System.Int32 idx) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_RevelationCheckpoint_GetById"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx); RevelationCheckpointEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
/// <summary> /// C_RevelationGetCheckoint /// </summary> /// <param name="managerid">managerid</param> /// <param name="mark">mark</param> /// <returns>RevelationCheckpointEntity</returns> /// <remarks>2015/2/12 14:30:06</remarks> public RevelationCheckpointEntity C_RevelationGetCheckoint(System.Guid managerid, System.Int32 mark) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("C_RevelationGetCheckoint"); database.AddInParameter(commandWrapper, "@managerid", DbType.Guid, managerid); database.AddInParameter(commandWrapper, "@mark", DbType.Int32, mark); RevelationCheckpointEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
/// <summary> /// 根据经理id和关卡插入数据 /// </summary> /// <param name="managerId"></param> /// <param name="mark"></param> /// <returns></returns> public bool InsertInTo(Guid managerId, int mark) { try { RevelationCheckpointEntity entity = new RevelationCheckpointEntity(); DateTime date = Convert.ToDateTime("1970-01-01"); entity.AwaryItem = ""; entity.CustomsPass = mark; entity.GeneralAwaryTime = date; entity.GeneralTime = date; entity.IsGeneral = false; entity.IsGeneralAwary = false; entity.ManagerId = managerId; entity.Schedule = 0; entity.States = 0; entity.ToDayGeneralNums = 0; return(RevelationCheckpointMgr.Insert(entity)); } catch (Exception ex) { SystemlogMgr.Error("新增球星启示录关卡进度", ex); return(false); } }
public static bool Insert(RevelationCheckpointEntity revelationCheckpointEntity, DbTransaction trans = null, string zoneId = "") { var provider = new RevelationCheckpointProvider(zoneId); return(provider.Insert(revelationCheckpointEntity, trans)); }