using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.UI;
using YTSoft.BaseCallCenter.MVCWeb.Commons;
namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
{
public class OtherPageController : BaseController
{
///
/// 获取未读聊天消息个数
///
///
//public int GetWebChartCount(int pageType)
// {
// int messageCount = 0;
// #region 调用接口插入用户信息
// try
// {
// StringBuilder returnStr = new StringBuilder();
// string wxAddUrl = "";
// if (pageType == 1)
// {
// wxAddUrl = "http://rexian.zzmetro.com/api/customer/unread/" + F_PId;
// }
// else
// {
// wxAddUrl = "http://rexian.zzmetro.com/api/customer_weibo/unread/" + F_PId;
// }
// //if (pageType == 1)
// //{
// // wxAddUrl = "http://rexian.zzmetro.com/api/customer/unread/" + F_PId;
// // //"http://rexian.zzmetro.com/customer_weibo/" + F_PId
// // //"http://rexian.zzmetro.com/
// //}
// //else
// //{
// // wxAddUrl = "http://rexian.zzmetro.com/api/customer_weibo/unread/" + F_PId;
// //}
// string addWxResult = HttpHelper.HttpGet(wxAddUrl);
// ResponseResult ResultModel = JsonConvert.DeserializeObject(addWxResult);
// messageCount = ResultModel.data;
// }
// catch (Exception ex)
// {
// }
// #endregion
// return messageCount;
// }
public ActionResult WebChart(int pageType)
{
if (pageType == 1)
return (ActionResult)this.Redirect("http://rexian.zzmetro.com/customer/" + (object)this.F_PId);
return (ActionResult)this.Redirect("http://rexian.zzmetro.com/customer_weibo/" + (object)this.F_PId);
}
public int GetWebChartCount(int pageType)
{
int num = 0;
try
{
StringBuilder stringBuilder = new StringBuilder();
num = JsonConvert.DeserializeObject(HttpHelper.HttpGet(pageType != 1 ? "http://rexian.zzmetro.com/api/customer_weibo/unread/" + (object)this.F_PId : "http://rexian.zzmetro.com/api/customer/unread/" + (object)this.F_PId)).data;
}
catch (Exception ex)
{
}
return num;
}
///
///获取待办工单
///
///
public int GetMyOrderCount()
{
//待办工单and F_WORKORDERTYPEID=1 and F_WORKORDERSTATEID=1 and F_WORKORDERID in (select F_INSTANCEID from T_Wo_WorkOrderHistory where F_WORKORDERSTATEID=0 and F_OPTUSERID={0})
//string sql = " and F_WORKORDERTYPEID=1 and F_WORKORDERSTATEID=1 and F_CREATEBY=" + F_UserID;
// string sql = string.Format(" and F_WORKORDERTYPEID=1 and F_WORKORDERSTATEID=1 and F_WORKORDERID in (select F_INSTANCEID from T_Wo_WorkOrderHistory where F_WORKORDERSTATEID=0 and F_OPTUSERID={0} and F_OPTDATE=(select top 1 F_OPTDATE from T_Wo_WorkOrderHistory order by F_HISTORYID desc))", F_UserID);
// string sql = " and F_WORKORDERTYPEID=1 and F_WORKORDERSTATEID=1 and ( F_WORKORDERID in (select F_INSTANCEID from T_Wo_WorkOrderHistory A where F_WORKORDERSTATEID=0 and F_OPTUSERID='" + F_UserID + "' AND F_OPTDATE= (select TOP 1 F_OPTDATE from T_Wo_WorkOrderHistory WHERE F_INSTANCEID = A.F_INSTANCEID ORDER BY F_OPTDATE DESC) OR F_WORKORDERID in (select F_INSTANCEID from T_Wo_WorkOrderHistory A where F_WORKORDERSTATEID = 1 and F_OPTUSERID = '" + F_UserID + "' AND ReplayTime IS NOT NULL )) )";
string sql= " and F_WORKORDERTYPEID=1 and F_WORKORDERSTATEID=1 and ( F_WORKORDERID in (select F_INSTANCEID from T_Wo_WorkOrderHistory A where F_WORKORDERSTATEID=0 and F_StateName='未处理' and F_OPTUSERID='" + F_UserID + "' OR F_WORKORDERID in (select F_INSTANCEID from T_Wo_WorkOrderHistory A where F_WORKORDERSTATEID = 1 and F_OPTUSERID = '" + F_UserID + "' AND ReplayTime IS NOT NULL )) )";
DataTable dt = new DataTable();
int recordCount = 0;
Model.PageData pageModel = new Model.PageData();
dt = BLL.PagerBLL.GetListPager(
"T_Wo_WorkOrderBase",
"F_WORKORDERID",
"*",
sql,
"ORDER BY F_CREATEDATE desc",
10,
1,
true,
out recordCount);
return recordCount;
}
///
///获取微博工单
///
///
public int GetMyOrderCountWb()
{
//微博工单
string sql = " and F_WORKORDERSTATEID=0 and F_REPAIRMANID=4 and F_USERID=" + F_UserID;
DataTable dt = new DataTable();
int recordCount = 0;
Model.PageData pageModel = new Model.PageData();
dt = BLL.PagerBLL.GetListPager(
"T_Wo_WorkOrderBase",
"F_WORKORDERID",
"*",
sql,
"ORDER BY F_CREATEDATE desc",
10,
1,
true,
out recordCount);
return recordCount;
}
///
///获取补录工单
///
///
public int GetMyOrderNeedCount()
{
//工单类型:转单 工单状态:处理中 处理人员:当前用户id
string sql = " and F_WORKORDERSTATEID=0 and F_USERID=" + F_UserID;
DataTable dt = new DataTable();
int recordCount = 0;
Model.PageData pageModel = new Model.PageData();
dt = BLL.PagerBLL.GetListPager(
"T_Wo_WorkOrderBase",
"F_WORKORDERID",
"*",
sql,
"ORDER BY F_CREATEDATE desc",
10,
1,
true,
out recordCount);
return recordCount;
}
public int GetBiaoyangCount()
{
string sql = string.Format(" and F_WORKORDERTYPEID=3 and F_WORKORDERSTATEID in (2,5) and T2.NoticeDeptId={0} AND NoticeType={1} AND NoticeState=1", F_DeptId, 0);
DataTable dt = new DataTable();
int recordCount = 0;
Model.PageData pageModel = new Model.PageData();
dt = BLL.PagerBLL.GetTableList(
" T_Wo_WorkOrderBase T1 Inner join T_Wo_WorkOrderNotice T2 On T1.F_WORKORDERID=T2.OrderId ",
"F_WORKORDERID",
"T1.*,CONVERT(varchar,F_CREATEDATE, 120 ) as F_CREATEDATENew,NoticeDeptId,NoticeDeptName"
+ @" , replace(replace(CASE F_WORKORDERFROM WHEN '留言工单' THEN (SELECT top 1 F_RecFileUrl FROM dbo.T_Call_LeaveRecord WHERE F_CallId=F_KSHADDRESSCODE) WHEN '语音工单' THEN (SELECT top 1 FilePath FROM dbo.T_Call_CallRecords WHERE CallId=F_KSHADDRESSCODE AND FilePath!='') ELSE NULL END,'\','/'),'" + GetSysconfig("newFilePath") + "','" + GetSysconfig("newPlayPath") + "') as FilePath",
//+ " ,(CASE F_WORKORDERFROM WHEN '留言工单' THEN (SELECT F_RecFileUrl FROM dbo.T_Call_LeaveRecord WHERE F_CallId=F_KSHADDRESSCODE) WHEN '语音工单' THEN (SELECT FilePath FROM dbo.T_Call_CallRecords WHERE CallId=F_KSHADDRESSCODE AND FilePath!='') ELSE NULL END ) as FilePath",
sql,
" F_CREATEDATE desc",
10,
1,
out recordCount);
return recordCount;
}
public int GetZerenCount()
{
string sql = string.Format(" and F_WORKORDERTYPEID=3 and F_WORKORDERSTATEID in (2,5) and T2.NoticeDeptId={0} AND NoticeType={1} AND NoticeState=1", F_DeptId, 1);
DataTable dt = new DataTable();
int recordCount = 0;
Model.PageData pageModel = new Model.PageData();
dt = BLL.PagerBLL.GetTableList(
" T_Wo_WorkOrderBase T1 Inner join T_Wo_WorkOrderNotice T2 On T1.F_WORKORDERID=T2.OrderId ",
"F_WORKORDERID",
"T1.*,CONVERT(varchar,F_CREATEDATE, 120 ) as F_CREATEDATENew,NoticeDeptId,NoticeDeptName"
+ @" , replace(replace(CASE F_WORKORDERFROM WHEN '留言工单' THEN (SELECT top 1 F_RecFileUrl FROM dbo.T_Call_LeaveRecord WHERE F_CallId=F_KSHADDRESSCODE) WHEN '语音工单' THEN (SELECT top 1 FilePath FROM dbo.T_Call_CallRecords WHERE CallId=F_KSHADDRESSCODE AND FilePath!='') ELSE NULL END,'\','/'),'" + GetSysconfig("newFilePath") + "','" + GetSysconfig("newPlayPath") + "') as FilePath",
//+ " ,(CASE F_WORKORDERFROM WHEN '留言工单' THEN (SELECT F_RecFileUrl FROM dbo.T_Call_LeaveRecord WHERE F_CallId=F_KSHADDRESSCODE) WHEN '语音工单' THEN (SELECT FilePath FROM dbo.T_Call_CallRecords WHERE CallId=F_KSHADDRESSCODE AND FilePath!='') ELSE NULL END ) as FilePath",
sql,
" F_CREATEDATE desc",
10,
1,
out recordCount);
return recordCount;
}
}
}