You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
264 lines
10 KiB
C#
264 lines
10 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Web;
|
|
using System.Web.Security;
|
|
using System.Web.UI;
|
|
using System.Web.UI.HtmlControls;
|
|
using System.Web.UI.WebControls;
|
|
using System.Web.UI.WebControls.WebParts;
|
|
using DSWeb.Models;
|
|
using DSWeb.EntityDA;
|
|
using System.Text;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace DSWeb.Message
|
|
{
|
|
public partial class SysAnnounceClient : System.Web.UI.Page
|
|
{
|
|
public string strHandle;
|
|
public string strMessageGID;//消息GID
|
|
public string strUserID;
|
|
public int iPostType;
|
|
public int iIncludeTop;//包含编号
|
|
public int iNotIncludeTop;//不包含编号
|
|
public int iCheckType;//查看类型 1-查看未读消息 2-查看已读消息 3-查看所有消息
|
|
public string strType;//消息类型
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (Session["USERID"] != null)
|
|
{
|
|
strUserID = Session["USERID"].ToString().Trim();
|
|
}
|
|
else
|
|
{
|
|
if (Request.QueryString["clientgid"] != null)
|
|
{
|
|
strUserID = Request.QueryString["clientgid"].ToString();
|
|
Session["USERID"] = strUserID;
|
|
}
|
|
else
|
|
{
|
|
Server.Transfer("~/Error/FriendError.aspx");
|
|
return;
|
|
}
|
|
}
|
|
//
|
|
if (Request.QueryString["post"] != null)
|
|
{
|
|
iPostType = int.Parse(Request.QueryString["post"].ToString());
|
|
this.h_posttype.Value = iPostType.ToString();
|
|
}
|
|
else
|
|
{
|
|
iPostType = 2;
|
|
this.h_posttype.Value = iPostType.ToString();
|
|
}
|
|
|
|
//--------------------------------------------
|
|
|
|
if (!this.h_messageid.Value.ToString().Trim().Equals(""))
|
|
{
|
|
strMessageGID = this.h_messageid.Value.ToString().Trim();
|
|
}
|
|
if (this.hdISEDIT.Value != null)
|
|
{
|
|
strHandle = this.hdISEDIT.Value.ToString().Trim();
|
|
}
|
|
|
|
if (this.hdiIncludeTop.Value.Trim() != "")
|
|
{
|
|
iIncludeTop = int.Parse(this.hdiIncludeTop.Value.Trim());
|
|
}
|
|
else
|
|
{
|
|
iIncludeTop = 0;
|
|
}
|
|
|
|
if (this.hdiNotIncludeTop.Value.Trim() != "")
|
|
{
|
|
iNotIncludeTop = int.Parse(this.hdiNotIncludeTop.Value.Trim());
|
|
}
|
|
else
|
|
{
|
|
iNotIncludeTop = 0;
|
|
}
|
|
|
|
if (this.sel_read.Value.Trim() != "")
|
|
{
|
|
iCheckType = int.Parse(this.sel_read.Value.Trim());
|
|
}
|
|
else
|
|
{
|
|
iCheckType = 0;
|
|
}
|
|
|
|
//公告
|
|
SysAnnounceDA SysAnnounceDA = new SysAnnounceDA();
|
|
strType = SysAnnounceDA.GetTYPENUM(strUserID, 2);
|
|
if (strType != "0")
|
|
{
|
|
strType = String.Format(" AND TYPE = {0}", int.Parse(strType));
|
|
}
|
|
else
|
|
{
|
|
strType = "";
|
|
}
|
|
//
|
|
if (strHandle != null)
|
|
{
|
|
if (strHandle == "messagelist")
|
|
{
|
|
GetMessageList();
|
|
}
|
|
if (strHandle == "messagepagelist")
|
|
{
|
|
GetMessagePageList();
|
|
}
|
|
this.hdISEDIT.Value = "";
|
|
}
|
|
}
|
|
|
|
#region 根据消息GID获取消息信息
|
|
/// <summary>
|
|
/// 根据消息GID获取消息信息
|
|
/// </summary>
|
|
/// <param name="strMessageGID">消息GID</param>
|
|
/// <returns>返回JSON消息信息</returns>
|
|
protected void GetMessageList()
|
|
{
|
|
if (!this.h_messageid.Value.Trim().Equals(""))
|
|
{
|
|
SysAnnounceDA SysAnnounceDA = new SysAnnounceDA();
|
|
SysAnnounceSetDA SysAnnounceSetDA = new SysAnnounceSetDA();
|
|
SysAnnounceEntity SysAnnounceEntity = new SysAnnounceEntity();
|
|
|
|
tbDESCRIPTION.Text = "";
|
|
tbANNOUNCECONTENT.Text = "";
|
|
|
|
SysAnnounceEntity = SysAnnounceDA.GetID(this.h_messageid.Value.Trim());//strMessageGID
|
|
if (SysAnnounceEntity != null)
|
|
{
|
|
if (SysAnnounceEntity.GID != null)
|
|
{
|
|
tbDESCRIPTION.Text = SysAnnounceEntity.DESCRIPTION.ToString().Trim();
|
|
tbANNOUNCECONTENT.Text = SysAnnounceEntity.ANNOUNCECONTENT.ToString().Trim();
|
|
|
|
sel_read.SelectedIndex = 0;
|
|
if (int.Parse(this.sel_read.Value) != 0)
|
|
{
|
|
sel_read.SelectedIndex = int.Parse(this.sel_read.Value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 获取上一条、下一条消息提醒信息
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public void GetMessagePageList()
|
|
{
|
|
string strSql = "";
|
|
|
|
SysAnnounceSetDA SysAnnounceSetDA = new SysAnnounceSetDA();
|
|
string strCondition = "";
|
|
|
|
switch (iCheckType)
|
|
{
|
|
case 1:
|
|
strCondition = " AND gid not in (select ANNOUNCEGID from sys_announce_set where CLIENTGID='" + strUserID + "' and ISDELETE=1)";// and (ISCLOSE=0 or ISDELETE=1) and ISCLOSE=0
|
|
break;
|
|
case 2:
|
|
strCondition = " AND gid in (select ANNOUNCEGID from sys_announce_set where CLIENTGID='" + strUserID + "' and ISDELETE=0)";// and ISCLOSE=0
|
|
break;
|
|
case 4:
|
|
strCondition = " AND gid in (select ANNOUNCEGID from sys_announce_set where CLIENTGID='" + strUserID + "' and ISDELETE=1)";
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
//
|
|
if (iIncludeTop >= 1 && iNotIncludeTop >= 1)
|
|
{
|
|
|
|
strSql = String.Format(" SELECT TOP {0} GID,NAME,DESCRIPTION,ANNOUNCECONTENT,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,BEGINTIME,ENDTIME,ISDELETE,DELETETIME,DELETEUSER,INTERVAL,TYPE,ISISSUE "
|
|
+ " FROM sys_announce WHERE ISISSUE=1 and ISDELETE=0 AND GID NOT IN ('" + strMessageGID + "') {1} "
|
|
+ strCondition + strType + " ORDER BY CREATETIME DESC ", iIncludeTop, (iNotIncludeTop > 1 ? " AND GID NOT IN(SELECT TOP "
|
|
+ iNotIncludeTop + " GID FROM sys_announce WHERE ISISSUE=1 and ISDELETE=0 AND ISNULL(ISDELETE,0) <> 1 "
|
|
+ strCondition + strType + " AND GID NOT IN ('" + strMessageGID + "') ORDER BY CREATETIME DESC) " : ""));
|
|
|
|
DataTable sourceTable = SysAnnounceSetDA.GetExcuteSql(strSql).Tables[0];
|
|
if (sourceTable != null)
|
|
{
|
|
if (sourceTable.Rows.Count > 0)
|
|
{
|
|
tbDESCRIPTION.Text = sourceTable.Rows[0]["DESCRIPTION"].ToString().Trim();
|
|
tbANNOUNCECONTENT.Text = sourceTable.Rows[0]["ANNOUNCECONTENT"].ToString().Trim();
|
|
sel_read.SelectedIndex = 0;
|
|
if (int.Parse(this.sel_read.Value) != 0)
|
|
{
|
|
sel_read.SelectedIndex = int.Parse(this.sel_read.Value);
|
|
}
|
|
this.h_messageid.Value = sourceTable.Rows[0]["GID"].ToString().Trim();
|
|
|
|
//
|
|
if (sourceTable.Rows[0]["GID"].ToString().Trim() != "")
|
|
{
|
|
SysAnnounceSetDA SysAnnounceSetDA1 = new SysAnnounceSetDA();
|
|
SysAnnounceSetEntity SysAnnounceSetEntity = new SysAnnounceSetEntity();
|
|
int iRt = 0;
|
|
//
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
string strGID = T_ALL_DA.GetStrSQL("GID", "SELECT GID FROM sys_announce_set WHERE CLIENTGID = '" + strUserID + "' and ANNOUNCEGID='" + sourceTable.Rows[0]["GID"].ToString().Trim() + "'");
|
|
//
|
|
if (strGID == "")
|
|
{
|
|
SysAnnounceSetEntity.GID = getBSNO();
|
|
SysAnnounceSetEntity.CLIENTGID = strUserID.Trim();
|
|
SysAnnounceSetEntity.InterVal = 1;
|
|
SysAnnounceSetEntity.ANNOUNCEGID = sourceTable.Rows[0]["GID"].ToString().Trim();
|
|
SysAnnounceSetEntity.DELETEUSER = strUserID.Trim();
|
|
SysAnnounceSetEntity.ISCLOSE = false;
|
|
iRt = SysAnnounceSetDA1.InsertUserMsgSetting(SysAnnounceSetEntity);
|
|
}
|
|
else
|
|
{
|
|
SysAnnounceSetEntity.GID = strGID;
|
|
SysAnnounceSetEntity.CLIENTGID = strUserID.Trim();
|
|
SysAnnounceSetEntity.InterVal = 1;
|
|
SysAnnounceSetEntity.ANNOUNCEGID = sourceTable.Rows[0]["GID"].ToString().Trim();
|
|
SysAnnounceSetEntity.DELETEUSER = strUserID.Trim();
|
|
SysAnnounceSetEntity.ISCLOSE = false;
|
|
iRt = SysAnnounceSetDA1.UpdateUserMsgISCLOSE(SysAnnounceSetEntity);//已经读了
|
|
}
|
|
//
|
|
if (iRt > 0)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
protected String getBSNO()
|
|
{
|
|
string strBSNO = Guid.NewGuid().ToString();
|
|
strBSNO = strBSNO.Replace("-", "");
|
|
strBSNO = "Ann" + strBSNO;
|
|
return strBSNO;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|