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.
1355 lines
68 KiB
C#
1355 lines
68 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
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;
|
|
using DSWeb.WorkFlow;
|
|
|
|
namespace DSWeb.Message
|
|
{
|
|
public partial class MessageService : PageBase
|
|
{
|
|
private string strHandle;
|
|
private string strUserID;//用户GID
|
|
private string strCompanyID;//公司GID
|
|
private string strShowName;//用户显示名
|
|
private string strDeptName;//部门名称
|
|
private string strSearch;//查询条件
|
|
private int iCurrentPage;//当前页数
|
|
private int iShowPage;//显示页数
|
|
private string strMessageGID;//消息GID
|
|
private int iType;//消息类型
|
|
private string strBillNO;//业务编号
|
|
private int iIncludeTop;//包含编号
|
|
private int iNotIncludeTop;//不包含编号
|
|
private int iCheckType;//查看类型 1-查看未读消息 2-查看已读消息 3-查看所有消息
|
|
private int iMsgInterval;//消息提醒设置间隔时间
|
|
private bool bIsReadSystem;//弹出系统消息
|
|
private bool bIsReadApply;//弹出申请审核消息
|
|
private bool bIsReadAudit;//弹出审核完成消息
|
|
private string stroplb;//业务类别
|
|
private string strMblno;//主提单号/运单号
|
|
private string strBSNO;//业务编号
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (Session["USERID"] != null)
|
|
{
|
|
strUserID = Session["USERID"].ToString();
|
|
}
|
|
if (Session["SHOWNAME"] != null)
|
|
{
|
|
strShowName = Session["SHOWNAME"].ToString();
|
|
}
|
|
if (Session["COMPANYID"] != null)
|
|
{
|
|
strCompanyID = Session["COMPANYID"].ToString();
|
|
}
|
|
if (Session["DEPTNAME"] != null)
|
|
{
|
|
strDeptName = Session["DEPTNAME"].ToString();
|
|
}
|
|
|
|
if (Request.QueryString["handle"] != null)
|
|
{
|
|
strHandle = Request.QueryString["handle"].ToString();
|
|
}
|
|
if (Request.QueryString["oplb"] != null)
|
|
{
|
|
stroplb = Request.QueryString["oplb"].ToString();
|
|
}
|
|
//if (Request.QueryString["search"] != null)
|
|
//{
|
|
// strSearch = Request.QueryString["search"].ToString();
|
|
//}
|
|
|
|
if (Request.QueryString["cur_page"] != null)
|
|
{
|
|
iCurrentPage = int.Parse(Request.QueryString["cur_page"].ToString().Trim());
|
|
}
|
|
else
|
|
{
|
|
iCurrentPage = 0;
|
|
}
|
|
if (Request.QueryString["show_page"] != null)
|
|
{
|
|
iShowPage = int.Parse(Request.QueryString["show_page"].ToString().Trim());
|
|
}
|
|
else
|
|
{
|
|
iShowPage = 0;
|
|
}
|
|
|
|
if (Request.QueryString["id"] != null)
|
|
{
|
|
strMessageGID = Request.QueryString["id"].ToString();
|
|
}
|
|
if (Request.QueryString["search"] != null)
|
|
{
|
|
UnicodeEncoding unicode = new UnicodeEncoding();
|
|
strSearch = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["search"].ToString())));
|
|
}
|
|
|
|
if (Request.QueryString["type"] != null)
|
|
{
|
|
iType = int.Parse(Request.QueryString["type"].ToString());
|
|
}
|
|
else
|
|
{
|
|
iType = 0;
|
|
}
|
|
|
|
if (Request.QueryString["billno"] != null)
|
|
{
|
|
strBillNO = Request.QueryString["billno"].ToString();
|
|
}
|
|
|
|
if (Request.QueryString["include"] != null)
|
|
{
|
|
iIncludeTop = int.Parse(Request.QueryString["include"].ToString());
|
|
}
|
|
else
|
|
{
|
|
iIncludeTop = 0;
|
|
}
|
|
|
|
if (Request.QueryString["uninclude"] != null)
|
|
{
|
|
iNotIncludeTop = int.Parse(Request.QueryString["uninclude"].ToString());
|
|
}
|
|
else
|
|
{
|
|
iNotIncludeTop = 0;
|
|
}
|
|
|
|
if (Request.QueryString["checktype"] != null)
|
|
{
|
|
iCheckType = int.Parse(Request.QueryString["checktype"].ToString());
|
|
}
|
|
else
|
|
{
|
|
iCheckType = 0;
|
|
}
|
|
|
|
if (Request.QueryString["times"] != null)
|
|
{
|
|
iMsgInterval = int.Parse(Request.QueryString["times"].ToString());
|
|
}
|
|
else
|
|
{
|
|
iMsgInterval = 0;
|
|
}
|
|
|
|
if (Request.QueryString["issys"] != null)
|
|
{
|
|
bIsReadSystem = (int.Parse(Request.QueryString["issys"].ToString())) == 1 ? true : false;
|
|
}
|
|
|
|
if (Request.QueryString["isapp"] != null)
|
|
{
|
|
bIsReadApply = (int.Parse(Request.QueryString["isapp"].ToString())) == 1 ? true : false;
|
|
}
|
|
|
|
if (Request.QueryString["isaudit"] != null)
|
|
{
|
|
bIsReadAudit = (int.Parse(Request.QueryString["isaudit"].ToString())) == 1 ? true : false;
|
|
}
|
|
if (Request.QueryString["mblno"] != null)
|
|
{
|
|
strMblno = Request.QueryString["mblno"].ToString();
|
|
}
|
|
if (Request.QueryString["bsno"] != null)
|
|
{
|
|
strBSNO = Request.QueryString["bsno"].ToString();
|
|
}
|
|
if (strHandle != null)
|
|
{
|
|
if (strHandle == "messagelist")
|
|
{
|
|
Response.Write(GetMessageList());
|
|
}
|
|
if (strHandle == "messagelistpage")
|
|
{
|
|
Response.Write(GetMakeOutListPage());
|
|
}
|
|
if (strHandle == "messagetotal")
|
|
{
|
|
Response.Write(GetMessageTotal(strUserID));
|
|
}
|
|
if (strHandle == "getmessageinfo" && strMessageGID != null)
|
|
{
|
|
Response.Write(GetMessageInfo(strMessageGID));
|
|
}
|
|
if (strHandle == "setread" && strMessageGID != null)
|
|
{
|
|
Response.Write(SetMessageRead(strMessageGID));
|
|
}
|
|
if (strHandle == "deletemessage" && strMessageGID != null)
|
|
{
|
|
Response.Write(DeleteMessage(strMessageGID,strUserID));
|
|
}
|
|
if (strHandle == "postmessage" && iType != 0)
|
|
{ //发送提示信息,返回结果
|
|
Response.Write(PostMessage(iType,strShowName,strBillNO));
|
|
}
|
|
if (strHandle == "getmessagecount" && strMessageGID != null)
|
|
{
|
|
Response.Write(GetMessageTopCount(strMessageGID));
|
|
}
|
|
if (strHandle == "messagepagelist")
|
|
{
|
|
Response.Write(GetMessagePageList());
|
|
}
|
|
if (strHandle == "saveuserset" && iMsgInterval > 0)
|
|
{
|
|
Response.Write(SaveUserMessageSetting(iMsgInterval,strUserID));
|
|
}
|
|
if (strHandle == "deleteuserset")
|
|
{
|
|
Response.Write(DeleteUserMessageSetting(strUserID));
|
|
}
|
|
if (strHandle == "markread" && strMessageGID != null)
|
|
{
|
|
Response.Write(MarkMessageRead(strMessageGID));
|
|
}
|
|
}
|
|
}
|
|
|
|
#region 删除用户消息设置
|
|
/// <summary>
|
|
/// 删除用户消息设置
|
|
/// </summary>
|
|
/// <param name="tempUserID">用户GID</param>
|
|
/// <returns>值1表示删除成功 值不等于1表示删除失败</returns>
|
|
private int DeleteUserMessageSetting(string tempUserID)
|
|
{
|
|
int iResult = 0;
|
|
|
|
UserMessageSettingDA userMessageSettingDA = new UserMessageSettingDA();
|
|
UserMessageSettingEntity userMessageSettingEntity = userMessageSettingDA.GetUserMsgSettingByUserID(tempUserID);
|
|
|
|
if (userMessageSettingEntity != null)
|
|
{
|
|
if (userMessageSettingEntity.GID != null)
|
|
{
|
|
iResult = userMessageSettingDA.DeleteUserMsgSetting(tempUserID);
|
|
}
|
|
}
|
|
return iResult;
|
|
}
|
|
#endregion
|
|
|
|
#region 标记消息为已读
|
|
/// <summary>
|
|
/// 标记消息为已读
|
|
/// </summary>
|
|
/// <param name="tempMessageGID">消息GID</param>
|
|
/// <returns>值1表示消息标记已读成功 值不等于1表示消息标记失败</returns>
|
|
private int MarkMessageRead(string tempMessageGID)
|
|
{
|
|
int iResult = 0;
|
|
|
|
MessageDA messageDA = new MessageDA();
|
|
iResult = messageDA.DoMessageRead(tempMessageGID);
|
|
|
|
return iResult;
|
|
}
|
|
#endregion
|
|
|
|
#region 保存用户消息提醒设置
|
|
/// <summary>
|
|
/// 保存用户消息提醒设置
|
|
/// </summary>
|
|
/// <param name="tempMsgInterval">消息提醒间隔时间</param>
|
|
/// <returns>值1表示保存成功 值不等于1表示保存失败</returns>
|
|
private int SaveUserMessageSetting(int tempMsgInterval,string tempUserID)
|
|
{
|
|
int iResult = 0;
|
|
|
|
UserMessageSettingDA userMessageSettingDA = new UserMessageSettingDA();
|
|
UserMessageSettingEntity userMessageSettingEntity = userMessageSettingDA.GetUserMsgSettingByUserID(tempUserID);
|
|
|
|
if (userMessageSettingEntity != null)
|
|
{
|
|
if (userMessageSettingEntity.GID != null)
|
|
{
|
|
userMessageSettingEntity.MessageInterVal = tempMsgInterval;
|
|
userMessageSettingEntity.IsReadSystem = bIsReadSystem;
|
|
userMessageSettingEntity.IsReadApply = bIsReadApply;
|
|
userMessageSettingEntity.IsReadAudit = bIsReadAudit;
|
|
|
|
iResult = userMessageSettingDA.UpdateUserMsgSetting(userMessageSettingEntity);
|
|
}
|
|
else
|
|
{
|
|
userMessageSettingEntity.GID = Guid.NewGuid().ToString();
|
|
userMessageSettingEntity.UserID = tempUserID;
|
|
userMessageSettingEntity.MessageInterVal = tempMsgInterval;
|
|
userMessageSettingEntity.IsReadSystem = bIsReadSystem;
|
|
userMessageSettingEntity.IsReadApply = bIsReadApply;
|
|
userMessageSettingEntity.IsReadAudit = bIsReadAudit;
|
|
|
|
iResult = userMessageSettingDA.InsertUserMsgSetting(userMessageSettingEntity);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
userMessageSettingEntity = new UserMessageSettingEntity();
|
|
|
|
userMessageSettingEntity.GID = Guid.NewGuid().ToString();
|
|
userMessageSettingEntity.UserID = tempUserID;
|
|
userMessageSettingEntity.MessageInterVal = tempMsgInterval;
|
|
userMessageSettingEntity.IsReadSystem = bIsReadSystem;
|
|
userMessageSettingEntity.IsReadApply = bIsReadApply;
|
|
userMessageSettingEntity.IsReadAudit = bIsReadAudit;
|
|
|
|
iResult = userMessageSettingDA.InsertUserMsgSetting(userMessageSettingEntity);
|
|
}
|
|
|
|
|
|
return iResult;
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 获取上一条、下一条消息提醒信息
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public string GetMessagePageList()
|
|
{
|
|
string strSql = "";
|
|
|
|
MessageDA messageDA = new MessageDA();
|
|
|
|
|
|
string strCondition = "";
|
|
|
|
switch (iCheckType)
|
|
{
|
|
case 1:
|
|
strCondition = " AND ISNULL(ISREAD,0) <> 1";
|
|
break;
|
|
case 2:
|
|
strCondition = " AND ISNULL(ISREAD,0) = 1";
|
|
break;
|
|
case 3:
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
StringBuilder messageBuilder = new StringBuilder();
|
|
if (iIncludeTop >= 1 && iNotIncludeTop >= 1)
|
|
{
|
|
|
|
strSql = String.Format(" SELECT TOP {0} GID,NAME,DESCRIPTION,CREATETIME,ISREAD,READCOUNT,MESSAGECONTENT,LASTREADTIME,RECEIVER,TYPE,TASKURL,TASKID "
|
|
+ " FROM sys_message WHERE 1 > 0 {1} "
|
|
+ strCondition + " ORDER BY CREATETIME DESC ", iIncludeTop,
|
|
(iNotIncludeTop > 1 ? " AND GID NOT IN(SELECT TOP " + iNotIncludeTop + " GID FROM sys_message WHERE ISNULL(ISDELETE,0) <> 1 " + strCondition + " ORDER BY CREATETIME DESC) " : ""));
|
|
|
|
DataTable sourceTable = messageDA.GetExcuteSql(strSql).Tables[0];
|
|
if (sourceTable != null)
|
|
{
|
|
if (sourceTable.Rows.Count > 0)
|
|
{
|
|
messageBuilder.Append("{");
|
|
messageBuilder.Append("\"message\":");
|
|
messageBuilder.Append("[");
|
|
messageBuilder.Append("{");
|
|
|
|
messageBuilder.Append("\"id\":\"" + sourceTable.Rows[0]["GID"].ToString() + "\",");
|
|
messageBuilder.Append("\"name\":\"" + sourceTable.Rows[0]["NAME"].ToString() + "\",");
|
|
messageBuilder.Append("\"desc\":\"" + sourceTable.Rows[0]["DESCRIPTION"].ToString() + "\",");
|
|
messageBuilder.Append("\"isread\":" + (sourceTable.Rows[0]["ISREAD"].ToString().ToLower().Equals("true") ? 1 : 0) + ",");
|
|
messageBuilder.Append("\"time\":\"" + sourceTable.Rows[0]["CREATETIME"].ToString() + "\",");
|
|
messageBuilder.Append("\"count\":" + sourceTable.Rows[0]["READCOUNT"].ToString() + ",");
|
|
messageBuilder.Append("\"content\":\"" + sourceTable.Rows[0]["MESSAGECONTENT"].ToString() + "\",");
|
|
messageBuilder.Append("\"type\":" + sourceTable.Rows[0]["TYPE"].ToString() + ",");
|
|
messageBuilder.Append("\"url\":\"" + sourceTable.Rows[0]["TASKURL"].ToString() + "\"");
|
|
|
|
messageBuilder.Append("}");
|
|
messageBuilder.Append("]");
|
|
messageBuilder.Append("}");
|
|
}
|
|
else
|
|
{
|
|
messageBuilder.Append("{");
|
|
messageBuilder.Append("\"message\":");
|
|
messageBuilder.Append("[");
|
|
messageBuilder.Append("{");
|
|
|
|
messageBuilder.Append("\"id\":\"\",");
|
|
messageBuilder.Append("\"name\":\"\",");
|
|
messageBuilder.Append("\"desc\":\"\",");
|
|
messageBuilder.Append("\"isread\":0,");
|
|
messageBuilder.Append("\"time\":\"\",");
|
|
messageBuilder.Append("\"count\":0,");
|
|
messageBuilder.Append("\"content\":\"\",");
|
|
messageBuilder.Append("\"type\":0,");
|
|
messageBuilder.Append("\"url\":\"\"");
|
|
|
|
messageBuilder.Append("}");
|
|
messageBuilder.Append("]");
|
|
messageBuilder.Append("}");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
messageBuilder.Append("{");
|
|
messageBuilder.Append("\"message\":");
|
|
messageBuilder.Append("[");
|
|
messageBuilder.Append("{");
|
|
|
|
messageBuilder.Append("\"id\":\"\",");
|
|
messageBuilder.Append("\"name\":\"\",");
|
|
messageBuilder.Append("\"desc\":\"\",");
|
|
messageBuilder.Append("\"isread\":0,");
|
|
messageBuilder.Append("\"time\":\"\",");
|
|
messageBuilder.Append("\"count\":0,");
|
|
messageBuilder.Append("\"content\":\"\",");
|
|
messageBuilder.Append("\"type\":0,");
|
|
messageBuilder.Append("\"url\":\"\"");
|
|
|
|
messageBuilder.Append("}");
|
|
messageBuilder.Append("]");
|
|
messageBuilder.Append("}");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
messageBuilder.Append("{");
|
|
messageBuilder.Append("\"message\":");
|
|
messageBuilder.Append("[");
|
|
messageBuilder.Append("{");
|
|
|
|
messageBuilder.Append("\"id\":\"\",");
|
|
messageBuilder.Append("\"name\":\"\",");
|
|
messageBuilder.Append("\"desc\":\"\",");
|
|
messageBuilder.Append("\"isread\":0,");
|
|
messageBuilder.Append("\"time\":\"\",");
|
|
messageBuilder.Append("\"count\":0,");
|
|
messageBuilder.Append("\"content\":\"\",");
|
|
messageBuilder.Append("\"type\":0,");
|
|
messageBuilder.Append("\"url\":\"\"");
|
|
|
|
messageBuilder.Append("}");
|
|
messageBuilder.Append("]");
|
|
messageBuilder.Append("}");
|
|
}
|
|
|
|
return messageBuilder.ToString();
|
|
}
|
|
|
|
#region 获取消息上端总数
|
|
/// <summary>
|
|
/// 获取消息上端总数
|
|
/// </summary>
|
|
/// <param name="tempMessageGID">消息GID</param>
|
|
/// <returns>返回消息上端总数</returns>
|
|
private int GetMessageTopCount(string tempMessageGID)
|
|
{
|
|
int iResult = 0;
|
|
|
|
MessageDA messageDA = new MessageDA();
|
|
string strCondition = "";
|
|
|
|
switch (iCheckType)
|
|
{
|
|
case 1:
|
|
strCondition = " AND ISNULL(ISREAD,0) <> 1";
|
|
break;
|
|
case 2:
|
|
strCondition = " AND ISNULL(ISREAD,0) = 1";
|
|
break;
|
|
case 3:
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
string strSql = String.Format(" SELECT COUNT(*) FROM (SELECT * FROM sys_message WHERE CREATETIME >= (SELECT CREATETIME FROM sys_message WHERE GID = '{0}') "
|
|
+ " AND GID NOT IN ('{0}') " + strCondition + ") as A ", tempMessageGID);
|
|
|
|
DataTable sourceTable = messageDA.GetExcuteSql(strSql).Tables[0];
|
|
|
|
if (sourceTable != null)
|
|
{
|
|
iResult = int.Parse(sourceTable.Rows[0][0].ToString());
|
|
}
|
|
|
|
return iResult;
|
|
}
|
|
#endregion
|
|
#region 发送提示信息,返回结果
|
|
/// <summary>
|
|
/// 发送提示信息
|
|
/// </summary>
|
|
/// <param name="tempType"></param>
|
|
/// <param name="tempShowName"></param>
|
|
/// <param name="tempBillNO"></param>
|
|
/// <returns>返回结果</returns>
|
|
private int PostMessage(int tempType,string tempShowName,string tempBillNO)
|
|
{
|
|
int iResult = 0;
|
|
|
|
MessageDA messageDA = new MessageDA();
|
|
MessageType messageType = messageDA.GetMessageTypeNum(iType);
|
|
IList<MessageEntity> messageEntities = new List<MessageEntity>();
|
|
|
|
WorkFlowDoDA workFlowDoDA = new WorkFlowDoDA();
|
|
IList<WorkFlowDoEntity> workFlowDoEntities = new List<WorkFlowDoEntity>();
|
|
//工作流
|
|
WorkFlowHelper workFlowHelper = new WorkFlowHelper();
|
|
//查找付费工作流信息
|
|
//WorkFlowEntity workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FEEAUDIT,strCompanyID);
|
|
WorkFlowEntity workFlowEntity = new WorkFlowEntity();
|
|
T_ALL_DA t_all_da = new T_ALL_DA();
|
|
if (stroplb == "op_Seae")
|
|
{
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FEEAUDIT, strCompanyID);
|
|
}
|
|
else if (stroplb == "op_Seai")
|
|
{
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.SeaiFEEAUDIT , strCompanyID);
|
|
}
|
|
else if (stroplb == "op_Sean")
|
|
{
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.FeeOpSeanRecvPayAudit,strCompanyID);
|
|
}
|
|
else if (stroplb == "op_Apply")
|
|
{
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.APPLYFEEAUDIT, strCompanyID);
|
|
}
|
|
else if (stroplb == "op_Bulk")
|
|
{
|
|
workFlowEntity = workFlowHelper.FindWorkFlow(WorkFlowType.BULKFEEAUDIT, strCompanyID);
|
|
}
|
|
switch (messageType)
|
|
{
|
|
case MessageType.FEEAUDIT:
|
|
//如果工作流信息存在
|
|
if (workFlowEntity != null)
|
|
{ //通过工作流GID和申请编号BILLNO获取工作流运行表WorkFlowDo信息
|
|
workFlowDoEntities = workFlowDoDA.GetWorkFlowDoForMessage(workFlowEntity.GID, tempBillNO);
|
|
if (strMblno == null)
|
|
{
|
|
strMblno = "";
|
|
if (strBSNO != null)
|
|
{
|
|
if (strBSNO.Trim() == "")
|
|
{
|
|
strMblno = t_all_da.GetStrSQL("MBLNO", "select top 1 MBLNO from VW_Settlement where bsno = '" + strBSNO.Trim() + "'");
|
|
}
|
|
else
|
|
{
|
|
strMblno = t_all_da.GetStrSQL("MBLNO", "select top 1 MBLNO from VW_Settlement where bsno in (SELECT BSNO FROM ch_fee WHERE GID = '" + tempBillNO.Trim() + "')");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strMblno = t_all_da.GetStrSQL("MBLNO", "select top 1 MBLNO from VW_Settlement where bsno in (SELECT BSNO FROM ch_fee WHERE GID = '" + tempBillNO.Trim() + "')");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (strMblno.Trim() == "")
|
|
{
|
|
if (strBSNO != null)
|
|
{
|
|
if (strBSNO.Trim() == "")
|
|
{
|
|
strMblno = t_all_da.GetStrSQL("MBLNO", "select top 1 MBLNO from VW_Settlement where bsno = '" + strBSNO.Trim() + "'");
|
|
}
|
|
else
|
|
{
|
|
strMblno = t_all_da.GetStrSQL("MBLNO", "select top 1 MBLNO from VW_Settlement where bsno in (SELECT BSNO FROM ch_fee WHERE GID = '" + tempBillNO.Trim() + "')");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strMblno = t_all_da.GetStrSQL("MBLNO", "select top 1 MBLNO from VW_Settlement where bsno in (SELECT BSNO FROM ch_fee WHERE GID = '" + tempBillNO.Trim() + "')");
|
|
}
|
|
}
|
|
}
|
|
|
|
if (workFlowDoEntities.Count > 0)
|
|
{
|
|
foreach (WorkFlowDoEntity workFlowDo in workFlowDoEntities)
|
|
{
|
|
if (!workFlowDo.IsFinish)
|
|
{
|
|
MessageEntity messageEntity = new MessageEntity();
|
|
messageEntity.GID = Guid.NewGuid().ToString();
|
|
messageEntity.Name = "FeeAudit";
|
|
//messageEntity.Description = "应收应付待审核通知";
|
|
messageEntity.IsRead = false;
|
|
messageEntity.ReadCount = 0;
|
|
//messageEntity.MessageContent = tempShowName + " 提交 [应收应付费用审核] 申请 ";
|
|
messageEntity.TaskID = "";
|
|
messageEntity.Receiver = workFlowDo.Auditor;
|
|
messageEntity.TaskUrl = "auditprocess/feeaudit.aspx";
|
|
messageEntity.Type = messageDA.GetMessageType(MessageType.FEEAUDIT);
|
|
messageEntity.RecvType = 2;//申请审核类型
|
|
if (stroplb == "op_Seae")
|
|
{
|
|
messageEntity.Description = "海运出口应收应付待审核通知";
|
|
messageEntity.MessageContent = tempShowName + " 提交了主提单号为:"+strMblno+" 的[海运出口应收应付费用审核] 申请 ";
|
|
}
|
|
else if (stroplb == "op_Seai")
|
|
{
|
|
messageEntity.Description = "海运进口应收应付待审核通知";
|
|
messageEntity.MessageContent = tempShowName + " 提交了主提单号为:" + strMblno + " 的[海运进口应收应付费用审核] 申请 ";
|
|
}
|
|
else if (stroplb == "op_Sean")
|
|
{
|
|
messageEntity.Description = "内贸海运应收应付待审核通知";
|
|
messageEntity.MessageContent =tempShowName+ " 提交运单号为:"+strMblno+"的[内贸海运应收应付费用审核] 申请 ";
|
|
}
|
|
else if (stroplb == "op_Apply")
|
|
{
|
|
messageEntity.Description = "报关业务应收应付待审核通知";
|
|
messageEntity.MessageContent = tempShowName + " 提交运单号为:" + strMblno + "的[报关业务应收应付费用审核] 申请 ";
|
|
}
|
|
else if (stroplb == "op_Bulk")
|
|
{
|
|
messageEntity.Description = "大宗散货应收应付待审核通知";
|
|
messageEntity.MessageContent = tempShowName + " 提交运单号为:" + strMblno + "的[大宗散货应收应付费用审核] 申请 ";
|
|
}
|
|
|
|
messageEntities.Add(messageEntity);
|
|
}
|
|
}
|
|
|
|
if (messageEntities.Count > 0)
|
|
{
|
|
messageDA.CreateMessage(MessageType.FEEAUDIT, messageEntities);
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
case MessageType.FEEPAY:
|
|
break;
|
|
case MessageType.FEEPAYAPP:
|
|
break;
|
|
case MessageType.INVOICE:
|
|
break;
|
|
case MessageType.INVOICEAPP:
|
|
break;
|
|
case MessageType.FEEAUDITPASS:
|
|
int iApplicantState = 0;
|
|
//如果工作流信息存在
|
|
if (workFlowEntity != null)
|
|
{
|
|
workFlowDoEntities = workFlowDoDA.GetWorkFlowDoAuditPassForMessage(workFlowEntity.GID, tempBillNO);
|
|
|
|
IList<WorkFlowDoEntity> otherWorkFlowDoEntities = new List<WorkFlowDoEntity>();
|
|
if (workFlowDoEntities.Count > 0)
|
|
{
|
|
foreach (WorkFlowDoEntity workFlowDo in workFlowDoEntities)
|
|
{
|
|
foreach (WorkFlowStepEntity workFlowStepEntity in workFlowEntity.WorkFlowSteps)
|
|
{
|
|
if (workFlowStepEntity.StepNO == workFlowDo.StepNO)
|
|
{
|
|
if (workFlowStepEntity.IsLast)
|
|
{
|
|
if (!workFlowDo.IsFinish)
|
|
{
|
|
MessageEntity messageEntity = new MessageEntity();
|
|
messageEntity.GID = Guid.NewGuid().ToString();
|
|
messageEntity.Name = "FeeAudit";
|
|
//messageEntity.Description = "应收应付待审核通知";
|
|
messageEntity.IsRead = false;
|
|
messageEntity.ReadCount = 0;
|
|
//messageEntity.MessageContent = tempShowName + " 已批准 [应收应付费用审核] 审核,当前等待您的审核 ";
|
|
messageEntity.TaskID = "";
|
|
messageEntity.Receiver = workFlowDo.Auditor;
|
|
messageEntity.TaskUrl = "auditprocess/feeaudit.aspx";
|
|
messageEntity.Type = messageDA.GetMessageType(MessageType.FEEAUDIT);
|
|
messageEntity.RecvType = 2;//申请审核类型
|
|
if (stroplb == "op_Seae")
|
|
{
|
|
messageEntity.Description = "海运出口应收应付待审核通知";
|
|
messageEntity.MessageContent = tempShowName + " 已批准 [海运出口应收应付费用审核] 审核,当前等待您的审核 ";
|
|
}
|
|
else if (stroplb == "op_Seai")
|
|
{
|
|
messageEntity.Description = "海运进口应收应付待审核通知";
|
|
messageEntity.MessageContent = tempShowName + " 已批准 [海运进口应收应付费用审核] 审核,当前等待您的审核 ";
|
|
}
|
|
else if (stroplb == "op_Sean")
|
|
{
|
|
messageEntity.Description = "内贸海运应收应付待审核通知";
|
|
messageEntity.MessageContent = tempShowName + " 已批准 [内贸海运应收应付费用审核] 审核,当前等待您的审核 ";
|
|
}
|
|
else if (stroplb == "op_Apply")
|
|
{
|
|
messageEntity.Description = "报关业务应收应付待审核通知";
|
|
messageEntity.MessageContent = tempShowName + " 已批准 [报关业务应收应付费用审核] 审核,当前等待您的审核 ";
|
|
}
|
|
else if (stroplb == "op_Bulk")
|
|
{
|
|
messageEntity.Description = "大宗散货应收应付待审核通知";
|
|
messageEntity.MessageContent = tempShowName + " 已批准 [大宗散货应收应付费用审核] 审核,当前等待您的审核 ";
|
|
}
|
|
messageEntities.Add(messageEntity);
|
|
|
|
if (iApplicantState == 0)
|
|
{
|
|
MessageEntity applicantMessageEntity = new MessageEntity();
|
|
applicantMessageEntity.GID = Guid.NewGuid().ToString();
|
|
applicantMessageEntity.Name = "FeeAudit";
|
|
//applicantMessageEntity.Description = "应收应付待审核通知";
|
|
applicantMessageEntity.IsRead = false;
|
|
applicantMessageEntity.ReadCount = 0;
|
|
//applicantMessageEntity.MessageContent = tempShowName + " 已经批准通过 [应收应付费用审核] 申请,现等待下一步审核 ";
|
|
applicantMessageEntity.TaskID = "";
|
|
applicantMessageEntity.Receiver = workFlowDo.Applicant;
|
|
|
|
applicantMessageEntity.Type = messageDA.GetMessageType(MessageType.FEEAUDIT);
|
|
applicantMessageEntity.RecvType = 2;//审核完成类型
|
|
if (stroplb == "op_Seae")
|
|
{
|
|
applicantMessageEntity.TaskUrl = "shipping/orderlist.aspx?oplb=" + stroplb;
|
|
applicantMessageEntity.Description = "海运出口应收应付待审核通知";
|
|
applicantMessageEntity.MessageContent = tempShowName + " 已经批准通过 [海运出口应收应付费用审核] 申请,现等待下一步审核 ";
|
|
}
|
|
else if (stroplb == "op_Seai")
|
|
{
|
|
applicantMessageEntity.TaskUrl = "SeaiInfo/SeaImportList.aspx?oplb=" + stroplb;
|
|
applicantMessageEntity.Description = "海运进口应收应付待审核通知";
|
|
applicantMessageEntity.MessageContent = tempShowName + " 已经批准通过 [海运进口应收应付费用审核] 申请,现等待下一步审核 ";
|
|
}
|
|
else if (stroplb == " op_Sean")
|
|
{
|
|
applicantMessageEntity.TaskUrl = "SeanInfo/SeanInTradeList.aspx?oplb=" + stroplb;
|
|
applicantMessageEntity.Description = " 内贸海运应收应付待审核通知";
|
|
applicantMessageEntity.MessageContent = tempShowName + " 已经批准通过 [内贸海运应收应付费用审核] 申请,现等待一下步审核 ";
|
|
}
|
|
else if (stroplb == " op_Apply")
|
|
{
|
|
applicantMessageEntity.TaskUrl = "MvcShipping/MsOpApply?oplb=" + stroplb;
|
|
applicantMessageEntity.Description = " 报关业务应收应付待审核通知";
|
|
applicantMessageEntity.MessageContent = tempShowName + " 已经批准通过 [报关业务应收应付费用审核] 申请,现等待一下步审核 ";
|
|
}
|
|
else if (stroplb == " op_Bulk")
|
|
{
|
|
applicantMessageEntity.TaskUrl = "MvcShipping/MsOpBulk?oplb=" + stroplb;
|
|
applicantMessageEntity.Description = " 大宗散货应收应付待审核通知";
|
|
applicantMessageEntity.MessageContent = tempShowName + " 已经批准通过 [大宗散货应收应付费用审核] 申请,现等待一下步审核 ";
|
|
}
|
|
messageEntities.Add(applicantMessageEntity);
|
|
iApplicantState++;
|
|
}
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
if (iApplicantState == 0)
|
|
{
|
|
MessageEntity applicantMessageEntity = new MessageEntity();
|
|
applicantMessageEntity.GID = Guid.NewGuid().ToString();
|
|
applicantMessageEntity.Name = "FeeAudit";
|
|
//applicantMessageEntity.Description = "应收应付待审核通知";
|
|
applicantMessageEntity.IsRead = false;
|
|
applicantMessageEntity.ReadCount = 0;
|
|
//applicantMessageEntity.MessageContent = tempShowName + " 已经批准通过 [应收应付费用审核] 申请,全部审核已完成 ";
|
|
applicantMessageEntity.TaskID = "";
|
|
applicantMessageEntity.Receiver = workFlowDo.Applicant;
|
|
|
|
applicantMessageEntity.Type = messageDA.GetMessageType(MessageType.FEEAUDIT);
|
|
applicantMessageEntity.RecvType = 2;//审核完成类型
|
|
if (stroplb == "op_Seae")
|
|
{
|
|
applicantMessageEntity.TaskUrl = "shipping/orderlist.aspx?oplb=" + stroplb;
|
|
applicantMessageEntity.Description = "海运出口应收应付待审核通知";
|
|
applicantMessageEntity.MessageContent = tempShowName + " 已经批准通过 [海运出口应收应付费用审核] 申请,全部审核已完成 ";
|
|
}
|
|
else if (stroplb == "op_Seai")
|
|
{
|
|
applicantMessageEntity.TaskUrl = "SeaiInfo/SeaImportList.aspx?oplb=" + stroplb;
|
|
applicantMessageEntity.Description = "海运进口应收应付待审核通知";
|
|
applicantMessageEntity.MessageContent = tempShowName + " 已经批准通过 [海运进口应收应付费用审核] 申请,全部审核已完成 ";
|
|
}
|
|
else if (stroplb == "op_Sean")
|
|
{
|
|
applicantMessageEntity.TaskUrl = "SeanInfo/SeanInTradeList.aspx?oplb=" + stroplb;
|
|
applicantMessageEntity.Description = " 内贸海运应收应付待审核通知";
|
|
applicantMessageEntity.MessageContent = tempShowName + " 已批准通过 [内贸海运应收应付费用审核] 申请,全部审核已完成";
|
|
}
|
|
else if (stroplb == "op_Apply")
|
|
{
|
|
applicantMessageEntity.TaskUrl = "MvcShipping/MsOpApply?oplb=" + stroplb;
|
|
applicantMessageEntity.Description = " 报关业务应收应付待审核通知";
|
|
applicantMessageEntity.MessageContent = tempShowName + " 已批准通过 [报关业务应收应付费用审核] 申请,全部审核已完成";
|
|
}
|
|
else if (stroplb == "op_Bulk")
|
|
{
|
|
applicantMessageEntity.TaskUrl = "MvcShipping/MsOpBulk?oplb=" + stroplb;
|
|
applicantMessageEntity.Description = " 大宗散货应收应付待审核通知";
|
|
applicantMessageEntity.MessageContent = tempShowName + " 已批准通过 [大宗散货应收应付费用审核] 申请,全部审核已完成";
|
|
}
|
|
messageEntities.Add(applicantMessageEntity);
|
|
iApplicantState++;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
#region 注释
|
|
//else
|
|
//{
|
|
// MessageEntity messageEntity = new MessageEntity();
|
|
// messageEntity.GID = Guid.NewGuid().ToString();
|
|
// messageEntity.Name = "FeeAudit";
|
|
// messageEntity.Description = "应收应付待审核通知";
|
|
// messageEntity.IsRead = false;
|
|
// messageEntity.ReadCount = 0;
|
|
// messageEntity.MessageContent = tempShowName + " 已批准 [应收应付费用审核] 审核,当前等待您的审核 ";
|
|
// messageEntity.TaskID = "";
|
|
// messageEntity.Receiver = workFlowDo.Auditor;
|
|
// messageEntity.TaskUrl = "auditprocess/feeaudit.aspx";
|
|
// messageEntity.Type = messageDA.GetMessageType(MessageType.FEEAUDIT);
|
|
|
|
// messageEntities.Add(messageEntity);
|
|
//}
|
|
#endregion
|
|
}
|
|
}
|
|
}
|
|
|
|
if (messageEntities.Count > 0)
|
|
{
|
|
messageDA.CreateMessage(MessageType.FEEAUDIT, messageEntities);
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
case MessageType.FEEAUDITREJECT:
|
|
//如果工作流信息存在
|
|
if (workFlowEntity != null)
|
|
{
|
|
workFlowDoEntities = workFlowDoDA.GetWorkFlowDoAuditRejectForMessage(workFlowEntity.GID, tempBillNO);
|
|
|
|
if (workFlowDoEntities.Count > 0)
|
|
{
|
|
foreach (WorkFlowDoEntity workFlowDo in workFlowDoEntities)
|
|
{
|
|
MessageEntity applicantMessageEntity = new MessageEntity();
|
|
applicantMessageEntity.GID = Guid.NewGuid().ToString();
|
|
applicantMessageEntity.Name = "FeeAudit";
|
|
//applicantMessageEntity.Description = "应收应付待审核通知";
|
|
applicantMessageEntity.IsRead = false;
|
|
applicantMessageEntity.ReadCount = 0;
|
|
//applicantMessageEntity.MessageContent = tempShowName + " 驳回 [应收应付费用审核] 申请 ";
|
|
applicantMessageEntity.TaskID = "";
|
|
applicantMessageEntity.Receiver = workFlowDo.Applicant;
|
|
|
|
applicantMessageEntity.Type = messageDA.GetMessageType(MessageType.FEEAUDITREJECT);
|
|
applicantMessageEntity.RecvType = 2;//审核完成类型
|
|
if (stroplb == "op_Seae")
|
|
{
|
|
applicantMessageEntity.TaskUrl = "shipping/orderlist.aspx?oplb=" + stroplb;
|
|
applicantMessageEntity.Description = "海运出口应收应付待审核通知";
|
|
applicantMessageEntity.MessageContent = tempShowName + " 驳回 [海运出口应收应付费用审核] 申请 ";
|
|
}
|
|
else if (stroplb == "op_Seai")
|
|
{
|
|
applicantMessageEntity.TaskUrl = "SeaiInfo/SeaImportList.aspx?oplb=" + stroplb;
|
|
applicantMessageEntity.Description = "海运进口应收应付待审核通知";
|
|
applicantMessageEntity.MessageContent = tempShowName + " 驳回 [海运进口应收应付费用审核] 申请 ";
|
|
|
|
}
|
|
else if (stroplb == "op_Sean")
|
|
{
|
|
applicantMessageEntity.TaskUrl = "SeanInfo/SeanInTradeList.aspx?oplb=" + stroplb;
|
|
applicantMessageEntity.Description = "内贸海运应收应付待审核通知";
|
|
applicantMessageEntity.MessageContent = tempShowName + " 驳回[内贸海运应收应付费用审核] 申请";
|
|
}
|
|
else if (stroplb == "op_Apply")
|
|
{
|
|
applicantMessageEntity.TaskUrl = "MvcShipping/MsOpApply?oplb=" + stroplb;
|
|
applicantMessageEntity.Description = "报关业务应收应付待审核通知";
|
|
applicantMessageEntity.MessageContent = tempShowName + " 驳回[报关业务应收应付费用审核] 申请";
|
|
}
|
|
else if (stroplb == "op_Bulk")
|
|
{
|
|
applicantMessageEntity.TaskUrl = "MvcShipping/MsOpBulk?oplb=" + stroplb;
|
|
applicantMessageEntity.Description = "大宗散货应收应付待审核通知";
|
|
applicantMessageEntity.MessageContent = tempShowName + " 驳回[大宗散货应收应付费用审核] 申请";
|
|
}
|
|
messageEntities.Add(applicantMessageEntity);
|
|
}
|
|
|
|
if (messageEntities.Count > 0)
|
|
{
|
|
messageDA.CreateMessage(MessageType.FEEAUDITREJECT, messageEntities);
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return iResult;
|
|
}
|
|
#endregion
|
|
#region 删除消息
|
|
/// <summary>
|
|
/// 删除消息
|
|
/// </summary>
|
|
/// <param name="tempMessageGID">消息GID</param>
|
|
/// <param name="tempUserID">操作人GID</param>
|
|
/// <returns>值1表示删除成功 值不等1表示删除失败</returns>
|
|
public int DeleteMessage(string tempMessageGID,string tempUserID)
|
|
{
|
|
int iResult = 0;
|
|
|
|
MessageDA messageDA = new MessageDA();
|
|
iResult = messageDA.DeleteMessage(tempMessageGID, tempUserID);
|
|
|
|
return iResult;
|
|
}
|
|
#endregion
|
|
|
|
#region 置消息状态为已读
|
|
/// <summary>
|
|
/// 置消息状态为已读
|
|
/// </summary>
|
|
/// <param name="tempMessageGID">消息GID</param>
|
|
/// <returns>值1表示置消息已读状态成功 值不等于1表示置消息已读状态失败</returns>
|
|
public int SetMessageRead(string tempMessageGID)
|
|
{
|
|
int iResult = 0;
|
|
|
|
MessageDA messageDA = new MessageDA();
|
|
iResult = messageDA.DoMessageRead(tempMessageGID);
|
|
|
|
return iResult;
|
|
}
|
|
#endregion
|
|
#region 根据消息GID获取消息信息
|
|
/// <summary>
|
|
/// 根据消息GID获取消息信息
|
|
/// </summary>
|
|
/// <param name="strMessageGID">消息GID</param>
|
|
/// <returns>返回JSON消息信息</returns>
|
|
private string GetMessageInfo(string strMessageGID)
|
|
{
|
|
bool isNull = true;
|
|
StringBuilder messageBuilder = new StringBuilder();
|
|
|
|
MessageDA messageDA = new MessageDA();
|
|
MessageEntity messageEntity = new MessageEntity();
|
|
|
|
messageEntity = messageDA.GetMessageByGID(strMessageGID);
|
|
|
|
if (messageEntity != null)
|
|
{
|
|
if (messageEntity.GID != null)
|
|
{
|
|
messageBuilder.Append("{");
|
|
messageBuilder.Append("\"message\":");
|
|
messageBuilder.Append("[");
|
|
messageBuilder.Append("{");
|
|
|
|
messageBuilder.Append("\"id\":\"" + messageEntity.GID + "\",");
|
|
messageBuilder.Append("\"name\":\"" + messageEntity.Name + "\",");
|
|
messageBuilder.Append("\"desc\":\"" + messageEntity.Description + "\",");
|
|
messageBuilder.Append("\"isread\":" + (messageEntity.IsRead ? 1 : 0) + ",");
|
|
messageBuilder.Append("\"time\":\"" + messageEntity.CreateTime.ToString() + "\",");
|
|
messageBuilder.Append("\"count\":" + messageEntity.ReadCount + ",");
|
|
messageBuilder.Append("\"content\":\"" + messageEntity.MessageContent + "\",");
|
|
messageBuilder.Append("\"type\":" + messageEntity.Type + ",");
|
|
messageBuilder.Append("\"url\":\"" + messageEntity.TaskUrl + "\"");
|
|
|
|
messageBuilder.Append("}");
|
|
messageBuilder.Append("]");
|
|
messageBuilder.Append("}");
|
|
isNull = false;
|
|
}
|
|
|
|
}
|
|
//如果未取到相关消息信息,则创建空JSON数据
|
|
if (isNull)
|
|
{
|
|
messageBuilder.Append("{");
|
|
messageBuilder.Append("\"message\":");
|
|
messageBuilder.Append("[");
|
|
messageBuilder.Append("{");
|
|
|
|
messageBuilder.Append("\"id\":\"\",");
|
|
messageBuilder.Append("\"name\":\"\",");
|
|
messageBuilder.Append("\"desc\":\"\",");
|
|
messageBuilder.Append("\"isread\":0,");
|
|
messageBuilder.Append("\"time\":\"\",");
|
|
messageBuilder.Append("\"count\":0,");
|
|
messageBuilder.Append("\"content\":\"\",");
|
|
messageBuilder.Append("\"type\":0,");
|
|
messageBuilder.Append("\"url\":\"\"");
|
|
|
|
messageBuilder.Append("}");
|
|
messageBuilder.Append("]");
|
|
messageBuilder.Append("}");
|
|
isNull = false;
|
|
}
|
|
return messageBuilder.ToString();
|
|
}
|
|
#endregion
|
|
|
|
#region 获取消息统计总数
|
|
/// <summary>
|
|
/// 获取消息统计总数
|
|
/// </summary>
|
|
/// <param name="tempUserID">接收人GID</param>
|
|
/// <returns>返回接收人的消息统计信息</returns>
|
|
private string GetMessageTotal(string tempUserID)
|
|
{
|
|
MessageDA messageDA = new MessageDA();
|
|
MessageTotalEntity messageTotal = messageDA.GetMessageTotalByReceiver(tempUserID);
|
|
|
|
UserMessageSettingDA userMessageSettingDA = new UserMessageSettingDA();
|
|
UserMessageSettingEntity userMessageSettingEntity = userMessageSettingDA.GetUserMsgSettingByUserID(tempUserID);
|
|
|
|
int iMsgInterVal = 0;
|
|
|
|
if (userMessageSettingEntity != null)
|
|
{
|
|
if (userMessageSettingEntity.GID != null)
|
|
{
|
|
iMsgInterVal = userMessageSettingEntity.MessageInterVal;
|
|
}
|
|
}
|
|
|
|
StringBuilder totalBuilder = new StringBuilder();
|
|
|
|
if (messageTotal != null)
|
|
{
|
|
totalBuilder.Append("{");
|
|
totalBuilder.Append("\"totals\":");
|
|
totalBuilder.Append("[");
|
|
totalBuilder.Append("{");
|
|
|
|
totalBuilder.Append("\"read\":" + messageTotal.ReadTotal + ",");
|
|
totalBuilder.Append("\"unread\":" + messageTotal.UnreadTotal + ",");
|
|
totalBuilder.Append("\"receiver\":\"" + messageTotal.Receiver + "\",");
|
|
totalBuilder.Append("\"total\":" + messageTotal.Total+",");
|
|
totalBuilder.Append("\"interval\":" + iMsgInterVal);
|
|
|
|
totalBuilder.Append("}");
|
|
totalBuilder.Append("]");
|
|
totalBuilder.Append("}");
|
|
|
|
}
|
|
else
|
|
{
|
|
totalBuilder.Append("{");
|
|
totalBuilder.Append("\"totals\":");
|
|
totalBuilder.Append("[");
|
|
totalBuilder.Append("{");
|
|
|
|
totalBuilder.Append("\"read\":0,");
|
|
totalBuilder.Append("\"unread\":0,");
|
|
totalBuilder.Append("\"receiver\":\"\"");
|
|
totalBuilder.Append("\"total\":0,");
|
|
totalBuilder.Append("\"interval\":0");
|
|
|
|
totalBuilder.Append("}");
|
|
totalBuilder.Append("]");
|
|
totalBuilder.Append("}");
|
|
}
|
|
|
|
return totalBuilder.ToString();
|
|
}
|
|
#endregion
|
|
|
|
#region 获取已开出发票页总数
|
|
/// <summary>
|
|
/// 获取已开出发票页总数
|
|
/// </summary>
|
|
/// <returns>返回总页数</returns>
|
|
private int GetMakeOutListPage()
|
|
{
|
|
MessageDA messageDA = new MessageDA();
|
|
string strSql = "SELECT COUNT(*) FROM sys_message as A WHERE 1 > 0 AND A.RECEIVER = '" + strUserID + "' AND ISNULL(ISDELETE,0) <> 1 ";
|
|
|
|
string strCondition = "";
|
|
|
|
|
|
if (strSearch != null)
|
|
{
|
|
if (!strSearch.Trim().Equals(""))
|
|
{
|
|
string tempSearch = strSearch;
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
{
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
{
|
|
switch (strArg[0].Replace("\"", ""))
|
|
{
|
|
case "btime"://begin time
|
|
strCondition += String.Format(" AND convert(char(10),A.CREATETIME,120) >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "etime"://end time
|
|
strCondition += String.Format(" AND convert(char(10),A.CREATETIME,120) <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "content"://message content
|
|
strCondition += String.Format(" AND A.MESSAGECONTENT LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "type"://message type
|
|
strCondition += String.Format(" AND A.TYPE = {0}", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "read"://message isread
|
|
int checkRead = int.Parse(strArg[1].Replace("\"", "").Trim());
|
|
|
|
if (checkRead == 1 || checkRead == 2)
|
|
{
|
|
strCondition += String.Format(" AND A.ISREAD = {0}", (checkRead == 1 ? 0 : 1));
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
strSql += strCondition;
|
|
}
|
|
}
|
|
|
|
int iTotal = int.Parse(messageDA.GetExcuteSql(strSql).Tables[0].Rows[0][0].ToString());
|
|
|
|
return iTotal;
|
|
}
|
|
#endregion
|
|
|
|
private string GetMessageList()
|
|
{
|
|
MessageDA messageDA = new MessageDA();
|
|
DataTable sourceTable;
|
|
|
|
string strCondition = "";
|
|
string strTopInclude = "";
|
|
string strTopNotInclude = "";
|
|
if (strSearch != null)
|
|
{
|
|
if (!strSearch.Trim().Equals(""))
|
|
{
|
|
string tempSearch = strSearch;
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
{
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
{
|
|
switch (strArg[0].Replace("\"", ""))
|
|
{
|
|
case "btime"://begin time
|
|
strCondition += String.Format(" AND convert(char(10),A.CREATETIME,120) >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "etime"://end time
|
|
strCondition += String.Format(" AND convert(char(10),A.CREATETIME,120) <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "content"://message content
|
|
strCondition += String.Format(" AND A.MESSAGECONTENT LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "type"://message type
|
|
strCondition += String.Format(" AND A.TYPE = {0}", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "read"://message isread
|
|
int checkRead = int.Parse(strArg[1].Replace("\"", "").Trim());
|
|
|
|
if (checkRead == 1 || checkRead == 2)
|
|
{
|
|
strCondition += String.Format(" AND A.ISREAD = {0}", (checkRead == 1 ? 0 : 1));
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
string strSql = "";
|
|
if (iCurrentPage > 0 && iShowPage > 0)
|
|
{
|
|
if (iCurrentPage == 1)
|
|
{
|
|
strSql = String.Format(" SELECT {0} A.GID,A.DESCRIPTION,A.TYPE,CASE WHEN A.ISREAD = 1 THEN 1 ELSE 0 END as ISREAD,A.READCOUNT,B.SHOWNAME,A.MESSAGECONTENT,A.CREATETIME "
|
|
+ " FROM sys_message as A INNER JOIN [user] as B ON A.RECEIVER = B.GID WHERE 1>0 AND A.RECEIVER = '" + strUserID + "' AND ISNULL(ISDELETE,0) <> 1 " + strCondition + " ORDER BY A.CREATETIME DESC ", "top " + iShowPage.ToString());
|
|
}
|
|
else
|
|
{
|
|
strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
|
|
strTopInclude = "top " + iShowPage.ToString();
|
|
|
|
|
|
strSql = String.Format(" SELECT {0} A.GID,A.DESCRIPTION,A.TYPE,CASE WHEN A.ISREAD = 1 THEN 1 ELSE 0 END as ISREAD,A.READCOUNT,B.SHOWNAME,A.MESSAGECONTENT,A.CREATETIME "
|
|
+ " FROM sys_message as A INNER JOIN [user] as B ON A.RECEIVER = B.GID WHERE A.GID NOT IN "
|
|
+ " (SELECT {1} GID FROM sys_message WHERE 1>0 AND A.RECEIVER = '" + strUserID + "' AND ISNULL(ISDELETE,0) <> 1 " + strCondition + " ORDER BY CREATETIME DESC ) AND A.RECEIVER = '" + strUserID + "' AND ISNULL(ISDELETE,0) <> 1 " + strCondition
|
|
+ " ORDER BY A.CREATETIME DESC ", strTopInclude, strTopNotInclude);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strSql = " SELECT {0} A.GID,A.DESCRIPTION,A.TYPE,CASE WHEN A.ISREAD = 1 THEN 1 ELSE 0 END as ISREAD,A.READCOUNT,B.SHOWNAME,A.MESSAGECONTENT,A.CREATETIME "
|
|
+ " FROM sys_message as A INNER JOIN [user] as B ON A.RECEIVER = B.GID WHERE 1>0 AND A.RECEIVER = '" + strUserID + "' AND ISNULL(ISDELETE,0) <> 1 " + strCondition + " ORDER BY A.CREATETIME DESC ";
|
|
}
|
|
sourceTable = getStatusNameTable(messageDA.GetExcuteSql(strSql).Tables[0]);
|
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
sourceBuilder.Append("{");
|
|
sourceBuilder.Append("rows:[");
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
{
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
sourceBuilder.Append("data:[");
|
|
sourceBuilder.Append("\"0\",");
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
{
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
{
|
|
sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\"");
|
|
}
|
|
else
|
|
{
|
|
sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\",");
|
|
}
|
|
}
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
{
|
|
sourceBuilder.Append("]}");
|
|
}
|
|
else
|
|
{
|
|
sourceBuilder.Append("]},");
|
|
}
|
|
|
|
}
|
|
sourceBuilder.Append("]");
|
|
sourceBuilder.Append("}");
|
|
|
|
return sourceBuilder.ToString();
|
|
}
|
|
|
|
#region 将数据集表中费用状态type的数字状态位转换成文字
|
|
/// <summary>
|
|
/// 将数据集表中费用状态type的数字状态位转换成文字
|
|
/// </summary>
|
|
/// <param name="tempTable">原数据源DataTable</param>
|
|
/// <returns>返回新数据源DataTable</returns>
|
|
private DataTable getStatusNameTable(DataTable tempTable)
|
|
{
|
|
DataTable sourceTable = tempTable;
|
|
DataTable cloneTable = new DataTable();
|
|
int iSwitch = 0;
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
{
|
|
if (iSwitch == 0)
|
|
{
|
|
for (int j = 0; j < sourceTable.Columns.Count; j++)
|
|
{
|
|
if (sourceTable.Columns[j].ColumnName.Equals("TYPE"))
|
|
{
|
|
DataColumn newColumn = new DataColumn();
|
|
newColumn.ColumnName = sourceTable.Columns[j].ColumnName;
|
|
newColumn.DataType = System.Type.GetType("System.String");
|
|
cloneTable.Columns.Add(newColumn);
|
|
}
|
|
else
|
|
{
|
|
DataColumn newColumn = new DataColumn();
|
|
newColumn.ColumnName = sourceTable.Columns[j].ColumnName;
|
|
newColumn.DataType = sourceTable.Columns[j].DataType;
|
|
cloneTable.Columns.Add(newColumn);
|
|
}
|
|
}
|
|
iSwitch = 1;
|
|
}
|
|
DataRow cloneRow = cloneTable.NewRow();
|
|
|
|
for (int k = 0; k < sourceTable.Columns.Count; k++)
|
|
{
|
|
if (sourceTable.Columns[k].ColumnName.Equals("TYPE"))
|
|
{
|
|
int iFeeStatus = int.Parse(sourceTable.Rows[i][k].ToString());
|
|
string strFeeStatus = "";
|
|
switch (iFeeStatus)
|
|
{
|
|
case 1:
|
|
strFeeStatus = "应收应付费用审核";
|
|
break;
|
|
case 2:
|
|
strFeeStatus = "付费结算";
|
|
break;
|
|
case 3:
|
|
strFeeStatus = "付费申请审核";
|
|
break;
|
|
case 4:
|
|
strFeeStatus = "发票开出";
|
|
break;
|
|
case 5:
|
|
strFeeStatus = "发票申请";
|
|
break;
|
|
case 6:
|
|
strFeeStatus = "申请电放审核";
|
|
break;
|
|
case 7:
|
|
strFeeStatus = "费用审核通过";
|
|
break;
|
|
case 8:
|
|
strFeeStatus = "费用审核驳回";
|
|
break;
|
|
case 9:
|
|
strFeeStatus = "费用更改申请";
|
|
break;
|
|
case 10:
|
|
strFeeStatus = "销售订舱审核申请";
|
|
break;
|
|
case 21:
|
|
strFeeStatus = "询价报价";
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
cloneRow[sourceTable.Columns[k].ColumnName] = strFeeStatus;
|
|
}
|
|
else
|
|
{
|
|
cloneRow[sourceTable.Columns[k].ColumnName] = sourceTable.Rows[i][k];
|
|
}
|
|
}
|
|
cloneTable.Rows.Add(cloneRow);
|
|
}
|
|
|
|
return cloneTable;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|