/// <summary> /// 更改通知状态为已经查看 /// </summary> /// <param name="noticeID">通知的ID</param> /// <param name="noticeType">通知的类型0个人,1公司,2系统</param> /// <returns></returns> public string UpdateNoticeLooked(string noticeID, string noticeType) { string returnStr = ""; HF.Cloud.BLL.Common.Logger.Error("UpdateNoticeLooked方法更改通知为已经查看接受的参数noticeID:" + noticeID + "---noticeType:" + noticeType); if (noticeType == "2")//系统通知 { Notice_SystemEL noticeEL = new Notice_SystemEL(); noticeEL.ID = long.Parse(noticeID); noticeEL.IsLook = 1; int ra; long returnValue = noticeEL.ExecNonQuery(3, out ra); HF.Cloud.BLL.Common.Logger.Error("UpdateNoticeLooked方法修改系统通知为已经查看状态结果:" + ra); if (ra > 0) { returnStr = "success"; } else { returnStr = "error"; } } else { NoticeEL noticeEL = new NoticeEL(); noticeEL.ID = long.Parse(noticeID); noticeEL.IsLook = 1; int ra; long returnValue = noticeEL.ExecNonQuery(3, out ra); HF.Cloud.BLL.Common.Logger.Error("UpdateNoticeLooked方法修改普通通知为已经查看状态结果:" + ra); if (ra > 0) { returnStr = "success"; } else { returnStr = "error"; } } return(returnStr); }
/// <summary> /// 通知列表中同意添加好友 /// </summary> /// <param name="session">本人的session</param> /// <param name="noticeID">通知的ID</param> /// <param name="sessionFriend">好友的session</param> /// <param name="noticeType">标志要请求的通知类型,0全部通知,1个人通知,2系统通知,</param> /// <returns></returns> public string AddFriendByNotice(string session, string noticeID, string sessionFriend, string noticeType) { HF.Cloud.BLL.Common.Logger.Error("AddFriendByNotice方法获取到的参数session:" + session + "---sessionFriend:" + sessionFriend + "---noticeType:" + noticeType); NoticeEL noticeEL = new NoticeEL(); //通过noticeID获取NoticeType=3?说明是审核的通知,修改UserUniteGroup表valid=1 noticeEL.ID = long.Parse(noticeID); DataTable dtNotice = noticeEL.ExecDT(2); if (dtNotice != null & dtNotice.Rows.Count > 0) { //如果是加群审核通知 if (dtNotice.Rows[0]["NoticeType"].ToString() == "3") { long groupID = (long)dtNotice.Rows[0]["GroupID"]; //UserUniteGroup表中的valid改为1,则通过审核 UserUniteGroupEL userGroupEL = new UserUniteGroupEL(); userGroupEL.UserID = long.Parse(dtNotice.Rows[0]["UserID_Friend"].ToString()); userGroupEL.GroupID = groupID; int raG; userGroupEL.ExecNonQuery(21, out raG); //通知notice表中的状态NoticeState要给成1通过 NoticeEL notice_EL = new NoticeEL(); notice_EL.ID = long.Parse(noticeID); notice_EL.NoticeState = 1; notice_EL.IsLook = 1; int raNoti; notice_EL.ExecNonQuery(33, out raNoti); HF.Cloud.BLL.Common.Logger.Error("AddFriendByNotice方法更改UserUniteGroupEL的Valid受影响的行数:" + raG + "更改通知表结果:" + raNoti); //审核后给用户发通知(系统通知) GroupEL groupEL = new GroupEL(); groupEL.ID = groupID; DataTable dt_group = groupEL.ExecDT(3); if (dt_group != null && dt_group.Rows.Count > 0) { string groupName = dt_group.Rows[0]["GroupName"].ToString(); Notice_SystemEL noticeSystemEL = new Notice_SystemEL(); noticeSystemEL.UserID = long.Parse(dtNotice.Rows[0]["UserID_Friend"].ToString()); noticeSystemEL.NoticeTitle = "审核通知!"; noticeSystemEL.NoticeContent = "您加入群\"" + groupName + "\"的申请已通过!"; noticeSystemEL.AddressUrl = "groupid=" + groupID; noticeSystemEL.NoticeType = 2; noticeSystemEL.IsLook = 0; noticeSystemEL.CreateTime = DateTime.Now.ToString(); noticeSystemEL.Valid = 1; int raNS; noticeSystemEL.ExecNonQuery(1, out raNS); } } else { //添加好友 FriendsBLL friendsBLL = new FriendsBLL(); string addFriendResult = friendsBLL.AddFriend(session, sessionFriend); //修改通知表中记录的状态改为好友 noticeEL.ID = long.Parse(noticeID); noticeEL.NoticeState = 1; int ra; noticeEL.ExecNonQuery(31, out ra); HF.Cloud.BLL.Common.Logger.Error("AddFriendByNotice方法更改NoticeState受影响的行数:" + ra); } } //返回通知列表 string resultStr = GetNotice(session, noticeType); return(resultStr); }