/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016/1/26 14:11:48</remarks> public bool Update(InformationPopupEntity entity, DbTransaction trans = null) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_InformationPopup_Update"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx); database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, entity.ManagerId); database.AddInParameter(commandWrapper, "@PopType", DbType.Int32, entity.PopType); database.AddInParameter(commandWrapper, "@ContentString", DbType.String, entity.ContentString); database.AddInParameter(commandWrapper, "@IsRead", DbType.Boolean, entity.IsRead); database.AddInParameter(commandWrapper, "@Status", DbType.Int32, entity.Status); 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.Idx = (System.Int32)database.GetParameterValue(commandWrapper, "@Idx"); return(Convert.ToBoolean(results)); }
public static void SendGamblePrizePoolPop(Guid managerId, string matchName) { InformationPopupEntity entity = new InformationPopupEntity(); entity.ManagerId = managerId; entity.ContentString = string.Format("M,{0}", matchName); entity.PopType = (int)EnumPopType.GamblePrizePool; entity.RowTime = DateTime.Now; entity.Status = 0; SendPopup(entity); }
public static void SendAddFriendPop(Guid managerId, string byName) { InformationPopupEntity entity = new InformationPopupEntity(); entity.ManagerId = managerId; entity.ContentString = string.Format("N,{0}", byName); entity.PopType = (int)EnumPopType.InformationPopAddFriend; entity.RowTime = DateTime.Now; entity.Status = 0; SendPopup(entity); }
static void doSendPopup(InformationPopupEntity entity) { try { InformationPopupMgr.Insert(entity); string content = string.Format("RF,{0}", entity.Idx); //ChatHelper.doSendPop(entity.ManagerId, EnumPopType.AddFriend, content); } catch (Exception ex) { SystemlogMgr.Error("doSendPopup", ex); } }
/// <summary> /// 将IDataReader的当前记录读取到InformationPopupEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public InformationPopupEntity LoadSingleRow(IDataReader reader) { var obj = new InformationPopupEntity(); obj.Idx = (System.Int32)reader["Idx"]; obj.ManagerId = (System.Guid)reader["ManagerId"]; obj.PopType = (System.Int32)reader["PopType"]; obj.ContentString = (System.String)reader["ContentString"]; obj.IsRead = (System.Boolean)reader["IsRead"]; obj.Status = (System.Int32)reader["Status"]; obj.RowTime = (System.DateTime)reader["RowTime"]; return(obj); }
/// <summary> /// GetById /// </summary> /// <param name="idx">idx</param> /// <returns>InformationPopupEntity</returns> /// <remarks>2016/1/26 14:11:47</remarks> public InformationPopupEntity GetById(System.Int32 idx) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_InformationPopup_GetById"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx); InformationPopupEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
static void SendPopup(InformationPopupEntity entity) { _threadPool.Add(() => doSendPopup(entity)); }
public static bool Update(InformationPopupEntity informationPopupEntity, DbTransaction trans = null, string zoneId = "") { var provider = new InformationPopupProvider(zoneId); return(provider.Update(informationPopupEntity, trans)); }