public virtual bool AddSysMessage(SysMessageInfo entity) { string SqlAdd = null; DataTable DtAdd = null; DataRow DrAdd = null; SqlAdd = "SELECT TOP 0 * FROM Sys_Message"; DtAdd = DBHelper.Query(SqlAdd); DrAdd = DtAdd.NewRow(); DrAdd["Message_ID"] = entity.Message_ID; DrAdd["Message_Type"] = entity.Message_Type; DrAdd["Message_UserType"] = entity.Message_UserType; DrAdd["Message_ReceiveID"] = entity.Message_ReceiveID; DrAdd["Message_SendID"] = entity.Message_SendID; DrAdd["Message_Content"] = entity.Message_Content; DrAdd["Message_Addtime"] = entity.Message_Addtime; DrAdd["Message_Status"] = entity.Message_Status; DrAdd["Message_Site"] = entity.Message_Site; DrAdd["Message_IsHidden"] = entity.Message_IsHidden; DtAdd.Rows.Add(DrAdd); try { DBHelper.SaveChanges(SqlAdd, DtAdd); return(true); } catch (Exception ex) { throw ex; } finally { DtAdd.Dispose(); } }
public virtual IList <SysMessageInfo> GetSysMessages(QueryInfo Query) { int PageSize; int CurrentPage; IList <SysMessageInfo> entitys = null; SysMessageInfo entity = null; string SqlList, SqlField, SqlOrder, SqlParam, SqlTable; SqlDataReader RdrList = null; try { CurrentPage = Query.CurrentPage; PageSize = Query.PageSize; SqlTable = "Sys_Message"; SqlField = "*"; SqlParam = DBHelper.GetSqlParam(Query.ParamInfos); SqlOrder = DBHelper.GetSqlOrder(Query.OrderInfos); SqlList = DBHelper.GetSqlPage(SqlTable, SqlField, SqlParam, SqlOrder, CurrentPage, PageSize); RdrList = DBHelper.ExecuteReader(SqlList); if (RdrList.HasRows) { entitys = new List <SysMessageInfo>(); while (RdrList.Read()) { entity = new SysMessageInfo(); entity.Message_ID = Tools.NullInt(RdrList["Message_ID"]); entity.Message_Type = Tools.NullInt(RdrList["Message_Type"]); entity.Message_UserType = Tools.NullInt(RdrList["Message_UserType"]); entity.Message_ReceiveID = Tools.NullInt(RdrList["Message_ReceiveID"]); entity.Message_SendID = Tools.NullInt(RdrList["Message_SendID"]); entity.Message_Content = Tools.NullStr(RdrList["Message_Content"]); entity.Message_Addtime = Tools.NullDate(RdrList["Message_Addtime"]); entity.Message_Status = Tools.NullInt(RdrList["Message_Status"]); entity.Message_Site = Tools.NullStr(RdrList["Message_Site"]); entity.Message_IsHidden = Tools.NullInt(RdrList["Message_IsHidden"]); entitys.Add(entity); entity = null; } } return(entitys); } catch (Exception ex) { throw ex; } finally { if (RdrList != null) { RdrList.Close(); RdrList = null; } } }
public virtual IList <SysMessageInfo> GetSysMessages(int Message_Type, int Message_UserType, int Message_ReceiveID) { IList <SysMessageInfo> entitys = null; SysMessageInfo entity = null; string SqlList = "select * from Sys_Message where Message_UserType=" + Message_UserType + " and Message_ReceiveID=" + Message_ReceiveID; if (Message_Type > 0) { SqlList += " and Message_Type=" + Message_Type; } SqlDataReader RdrList = null; try { RdrList = DBHelper.ExecuteReader(SqlList); if (RdrList.HasRows) { entitys = new List <SysMessageInfo>(); while (RdrList.Read()) { entity = new SysMessageInfo(); entity.Message_ID = Tools.NullInt(RdrList["Message_ID"]); entity.Message_Type = Tools.NullInt(RdrList["Message_Type"]); entity.Message_UserType = Tools.NullInt(RdrList["Message_UserType"]); entity.Message_ReceiveID = Tools.NullInt(RdrList["Message_ReceiveID"]); entity.Message_SendID = Tools.NullInt(RdrList["Message_SendID"]); entity.Message_Content = Tools.NullStr(RdrList["Message_Content"]); entity.Message_Addtime = Tools.NullDate(RdrList["Message_Addtime"]); entity.Message_Status = Tools.NullInt(RdrList["Message_Status"]); entity.Message_Site = Tools.NullStr(RdrList["Message_Site"]); entity.Message_IsHidden = Tools.NullInt(RdrList["Message_IsHidden"]); entitys.Add(entity); entity = null; } } return(entitys); } catch (Exception ex) { throw ex; } finally { if (RdrList != null) { RdrList.Close(); RdrList = null; } } }
/// <summary> /// 推送消息通知 /// </summary> /// <param name="Message_Type">消息类型</param> /// <param name="Message_UserType">用户类型</param> /// <param name="Message_ReceiveID">消息接收人ID</param> /// <param name="Message_SendID">消息发送人ID</param> /// <param name="Message_Content">消息内容</param> public void SendMessage(int Message_Type, int Message_UserType, int Message_ReceiveID, int Message_SendID, string Message_Content) { SysMessageInfo entity = new SysMessageInfo(); entity.Message_ID = 0; entity.Message_Type = Message_Type; entity.Message_UserType = Message_UserType; entity.Message_ReceiveID = Message_ReceiveID; entity.Message_SendID = Message_SendID; entity.Message_Content = Message_Content; entity.Message_Addtime = DateTime.Now; entity.Message_Status = 0; entity.Message_Site = pub.GetCurrentSite(); MyBLL.AddSysMessage(entity); }
public virtual bool EditSysMessage(SysMessageInfo entity) { string SqlAdd = null; DataTable DtAdd = null; DataRow DrAdd = null; SqlAdd = "SELECT * FROM Sys_Message WHERE Message_ID = " + entity.Message_ID; DtAdd = DBHelper.Query(SqlAdd); try { if (DtAdd.Rows.Count > 0) { DrAdd = DtAdd.Rows[0]; DrAdd["Message_ID"] = entity.Message_ID; DrAdd["Message_Type"] = entity.Message_Type; DrAdd["Message_UserType"] = entity.Message_UserType; DrAdd["Message_ReceiveID"] = entity.Message_ReceiveID; DrAdd["Message_SendID"] = entity.Message_SendID; DrAdd["Message_Content"] = entity.Message_Content; DrAdd["Message_Addtime"] = entity.Message_Addtime; DrAdd["Message_Status"] = entity.Message_Status; DrAdd["Message_Site"] = entity.Message_Site; DrAdd["Message_IsHidden"] = entity.Message_IsHidden; DBHelper.SaveChanges(SqlAdd, DtAdd); } else { return(false); } } catch (Exception ex) { throw ex; } finally { DtAdd.Dispose(); } return(true); }
public virtual SysMessageInfo GetSysMessageByID(int ID) { SysMessageInfo entity = null; SqlDataReader RdrList = null; try { string SqlList; SqlList = "SELECT * FROM Sys_Message WHERE Message_ID = " + ID; RdrList = DBHelper.ExecuteReader(SqlList); if (RdrList.Read()) { entity = new SysMessageInfo(); entity.Message_ID = Tools.NullInt(RdrList["Message_ID"]); entity.Message_Type = Tools.NullInt(RdrList["Message_Type"]); entity.Message_UserType = Tools.NullInt(RdrList["Message_UserType"]); entity.Message_ReceiveID = Tools.NullInt(RdrList["Message_ReceiveID"]); entity.Message_SendID = Tools.NullInt(RdrList["Message_SendID"]); entity.Message_Content = Tools.NullStr(RdrList["Message_Content"]); entity.Message_Addtime = Tools.NullDate(RdrList["Message_Addtime"]); entity.Message_Status = Tools.NullInt(RdrList["Message_Status"]); entity.Message_Site = Tools.NullStr(RdrList["Message_Site"]); entity.Message_IsHidden = Tools.NullInt(RdrList["Message_IsHidden"]); } return(entity); } catch (Exception ex) { throw ex; } finally { if (RdrList != null) { RdrList.Close(); RdrList = null; } } }
public virtual bool EditSysMessage(SysMessageInfo entity) { return(MyDAL.EditSysMessage(entity)); }
public virtual bool AddSysMessage(SysMessageInfo entity) { return(MyDAL.AddSysMessage(entity)); }