/// <summary> /// 插入消息表根据[作品ID] /// </summary> /// <param name="xx">消息</param> /// <param name="xiaozucy">编号</param> /// <returns></returns> public int getshoucangxiaoxi_zuop_DLL(xiaoxinfo xx, shoucinfo sc, int yonghuid, string[] xiaozucy) { try { for (int i = 0; i < xiaozucy.Length - 1; i++) { string sqlstr = "select 姓名 from 用户表 where 用户ID=@用户ID";//收藏者姓名 string name = getnamebyid(yonghuid.ToString(), sqlstr); SqlParameter[] parame = new SqlParameter[] { new SqlParameter("@内容", SqlDbType.NVarChar, 300), new SqlParameter("@类型", SqlDbType.NVarChar, 10), new SqlParameter("@已读", SqlDbType.Bit), new SqlParameter("@时间", SqlDbType.DateTime), new SqlParameter("@用户编号", SqlDbType.NVarChar, 20), //将要收到消息的id }; parame[0].Value = string.Format("您的作品<b><a href='zuopin.aspx?wenzhangid={0}'>{1}</a></b>被<b><a href='people.aspx?yonghuid={2}'>{3}</a></b>收藏了", sc.zuopId, sc.tmName, yonghuid, name); parame[1].Value = "系统消息"; parame[2].Value = 0; parame[3].Value = DateTime.Now.ToShortTimeString(); parame[4].Value = xiaozucy[i]; DB.ExecuteNonQuery(cs, "插入_消息表", parame); } return(1); } catch { return(0); } }
/// <summary> /// 让消息变为已读/未读 /// </summary> /// <param name="xiaoxi"></param> /// <returns></returns> public int getupdateyidu_DLL(xiaoxinfo xiaoxi) { SqlParameter[] parme = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int), new SqlParameter("@read", SqlDbType.Bit), }; parme[0].Value = xiaoxi.Id; parme[1].Value = xiaoxi.yidu; int a = DB.ExecuteNonQuery(cs, "updateinfo", parme); return(a); }
/// <summary> /// 筛选未读消息 /// </summary> /// <param name="xiaoxi"></param> public DataTable getselectxiaoxi(xiaoxinfo xiaoxi) { SqlParameter[] parme = new SqlParameter[] { new SqlParameter("@已读", SqlDbType.Bit), new SqlParameter("@用户编号", SqlDbType.NVarChar, 20), }; parme[0].Value = xiaoxi.yidu; parme[1].Value = xiaoxi.yonghubianhao;//用户编号 DataTable dt = DB.getDataTable(cs, "选择_消息表", parme); return(dt); }
/// <summary> /// 插入消息表 /// </summary> /// <param name="xiaoxi"></param> public int getshoucangxiaoxi_DLL(xiaoxinfo xx, string shoucangzheyonghubianhao) //shoucangzheyonghubianhao 用户id { string sqlstr = "select 姓名 from 用户表 where 用户ID=@用户ID"; //收藏者姓名 string name = getnamebyid(shoucangzheyonghubianhao, sqlstr); SqlParameter[] parame = new SqlParameter[] { new SqlParameter("@内容", SqlDbType.NVarChar, 300), new SqlParameter("@类型", SqlDbType.NVarChar, 10), new SqlParameter("@已读", SqlDbType.Bit), new SqlParameter("@时间", SqlDbType.DateTime), new SqlParameter("@用户编号", SqlDbType.NVarChar, 20), }; parame[0].Value = string.Format("您被<b><a href='people.aspx?yonghuid={0}'>{1}</a></b>收藏了", shoucangzheyonghubianhao, name); parame[1].Value = "系统消息"; parame[2].Value = 0; parame[3].Value = DateTime.Now.ToShortTimeString(); parame[4].Value = xx.yonghubianhao; //string sql="insert into 消息表 (内容,类型,已读,时间,用户编号)values(@内容,@类型,@已读,@时间,@用户编号)"; return(DB.ExecuteNonQuery(cs, "插入_消息表", parame)); }
/// <summary> /// 插入消息表[作品ID] /// </summary> /// <param name="xx"></param> /// <param name="shoucangzheyonghubianhao"></param> /// <param name="xiaozucy"></param> /// <returns></returns> public int getshoucangxiaoxi(xiaoxinfo xx, shoucinfo sc, int yonghuid, string[] xiaozucy) { return(xiaoxiDLL.getshoucangxiaoxi_zuop_DLL(xx, sc, yonghuid, xiaozucy)); }
/// <summary> /// 插入消息表[人物ID] /// </summary> /// <param name="xiaoxi"></param> public int getshoucangxiaoxi(xiaoxinfo xx, string shoucangzheyonghubianhao) { return(xiaoxiDLL.getshoucangxiaoxi_DLL(xx, shoucangzheyonghubianhao)); }
/// <summary> /// 让消息变为已读/未读 /// </summary> /// <param name="xiaoxi"></param> /// <returns></returns> public int updateYiDuXiaoXi(xiaoxinfo xiaoxi) { return(xiaoxiDLL.getupdateyidu_DLL(xiaoxi)); }
/// <summary> /// 筛选未读消息 /// </summary> /// <param name="xiaoxi"></param> public DataTable selectxiaoxi(xiaoxinfo xiaoxi) { return(xiaoxiDLL.getselectxiaoxi(xiaoxi)); }