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.
275 lines
12 KiB
C#
275 lines
12 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text.RegularExpressions;
|
|
using System.Web;
|
|
using DSWeb.MvcShipping.Controllers;
|
|
using Newtonsoft.Json;
|
|
using DSWebMobileService;
|
|
using DSWebMobileService.Common;
|
|
|
|
namespace DSWebMobile.Handler
|
|
{
|
|
/// <summary>
|
|
/// Client 的摘要说明
|
|
/// </summary>
|
|
public class Client : IHttpHandler, System.Web.SessionState.IRequiresSessionState
|
|
{
|
|
|
|
public void ProcessRequest(HttpContext context)
|
|
{
|
|
string action = context.Request.QueryString["action"].ToString();
|
|
switch (action)
|
|
{
|
|
case "0":
|
|
GetDataList(context);
|
|
break;
|
|
case "1":
|
|
GetDataDetail(context);
|
|
break;
|
|
case "2":
|
|
GetDataListByCondition(context);
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void GetDataDetail(HttpContext context)
|
|
{
|
|
string relCodeName = "";
|
|
string relBSFromDate = "";
|
|
string relBSToDate = "";
|
|
string relACCFromDate = "";
|
|
string relACCToDate = "";
|
|
|
|
string codeName = Encrypt.DesDecrypt("#7c&e@63", context.Request.QueryString["u"].ToString());
|
|
string bsFromDate = Encrypt.DesDecrypt("#7c&e@63", context.Request.QueryString["bf"].ToString());
|
|
string bsToDate = Encrypt.DesDecrypt("#7c&e@63", context.Request.QueryString["bt"].ToString());
|
|
string accFromDate = Encrypt.DesDecrypt("#7c&e@63", context.Request.QueryString["af"].ToString());
|
|
string accToDate = Encrypt.DesDecrypt("#7c&e@63", context.Request.QueryString["at"].ToString());
|
|
|
|
string pattern = "\0";
|
|
string replacement = "";
|
|
|
|
string returnValue = "";
|
|
|
|
Regex rgx = new Regex(pattern);
|
|
relCodeName = rgx.Replace(codeName, replacement);
|
|
relBSFromDate = rgx.Replace(bsFromDate, replacement);
|
|
relBSToDate = rgx.Replace(bsToDate, replacement);
|
|
relACCFromDate = rgx.Replace(accFromDate, replacement);
|
|
relACCToDate = rgx.Replace(accToDate, replacement);
|
|
pattern = "\t";
|
|
Regex rgx2 = new Regex(pattern);
|
|
relCodeName = rgx2.Replace(relCodeName, replacement);
|
|
relBSFromDate = rgx2.Replace(relBSFromDate, replacement);
|
|
relBSToDate = rgx2.Replace(relBSToDate, replacement);
|
|
relACCFromDate = rgx2.Replace(relACCFromDate, replacement);
|
|
relACCToDate = rgx2.Replace(relACCToDate, replacement);
|
|
|
|
/*if (Common.HsTable.HasItem("Client|" + relCodeName))
|
|
{
|
|
returnValue = Common.HsTable.GetHsTableItem("Client|" + relCodeName);
|
|
}
|
|
string[] valueArray = returnValue.Split(',');
|
|
string relGID = valueArray[0].ToString();
|
|
string relCompanyID = valueArray[1].ToString();
|
|
string relPassword = valueArray[3].ToString();
|
|
string relCacheKey = valueArray[4].ToString();
|
|
string relStrCondition = valueArray[5].ToString();
|
|
string relSale = valueArray[6].ToString();
|
|
|
|
Module.UserInfomationModule _user = new UserInfomationModule();
|
|
_user.GID = relGID;
|
|
_user.CompanyID = relCompanyID;
|
|
_user.CodeName = relCodeName;
|
|
_user.Password = relPassword;
|
|
|
|
DataTable dt = BaseInfo.CustomerAnalysisListDBServer.CustomerAnalysisListInfo(relCacheKey, _user, relSale, relStrCondition, relBSFromDate, relBSToDate, relACCFromDate, relACCToDate);
|
|
*/
|
|
StringBuilder sb = new StringBuilder();
|
|
/*if (dt == null || dt.Rows.Count == 0) { sb.Append("[{\"CLIENT\":\"\"}]"); }
|
|
else { sb.Append(JsonClass.DataTable2JsonNoneTotalCount(dt)); }*/
|
|
context.Response.ContentType = "text/plain";
|
|
context.Response.Write(sb.ToString());
|
|
context.Response.End();
|
|
}
|
|
|
|
private void GetDataListByCondition(HttpContext context)
|
|
{
|
|
string relStartMonth = "";
|
|
string relEndMonth = "";
|
|
string relStrCondition = "";
|
|
string relBeginFrom = "";
|
|
string relBeginTo = "";
|
|
string relAccFrom = "";
|
|
string relAccTo = "";
|
|
|
|
string strCondition = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["s"].ToString());
|
|
string startMonth = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["sm"].ToString());
|
|
string endMonth = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["em"].ToString());
|
|
string bfd = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["bfd"].ToString());
|
|
string btd = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["btd"].ToString());
|
|
string afd = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["afd"].ToString());
|
|
string atd = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["atd"].ToString());
|
|
|
|
string pattern = "\0";
|
|
string replacement = "";
|
|
|
|
int start = int.Parse(context.Request.QueryString["t"].ToString());
|
|
int limit = int.Parse(context.Request.QueryString["l"].ToString());
|
|
|
|
Regex rgx = new Regex(pattern);
|
|
relStrCondition = rgx.Replace(strCondition, replacement);
|
|
relStartMonth = rgx.Replace(startMonth, replacement);
|
|
relEndMonth = rgx.Replace(endMonth, replacement);
|
|
relBeginFrom = rgx.Replace(bfd, replacement);
|
|
relBeginTo = rgx.Replace(btd, replacement);
|
|
relAccFrom = rgx.Replace(afd, replacement);
|
|
relAccTo = rgx.Replace(atd, replacement);
|
|
pattern = "\t";
|
|
Regex rgx2 = new Regex(pattern);
|
|
relStrCondition = rgx2.Replace(relStrCondition, replacement);
|
|
relStartMonth = rgx.Replace(relStartMonth, replacement);
|
|
relEndMonth = rgx.Replace(relEndMonth, replacement);
|
|
relBeginFrom = rgx2.Replace(relBeginFrom, replacement);
|
|
relBeginTo = rgx2.Replace(relBeginTo, replacement);
|
|
relAccFrom = rgx2.Replace(relAccFrom, replacement);
|
|
relAccTo = rgx2.Replace(relAccTo, replacement);
|
|
|
|
if (strCondition != "")
|
|
{
|
|
if (relStrCondition[0] == ',') { relStrCondition = relStrCondition.Substring(1, relStrCondition.Length - 1); }
|
|
}
|
|
if (relBeginFrom != "")
|
|
{
|
|
if (relStrCondition != "")
|
|
{
|
|
relStrCondition += " and B.OPDATE>='" + relBeginFrom + " 00:00:00' ";
|
|
}
|
|
else
|
|
{
|
|
relStrCondition = " B.OPDATE>='" + relBeginFrom + " 00:00:00' ";
|
|
}
|
|
}
|
|
if (relBeginTo != "")
|
|
{
|
|
relStrCondition += " and B.OPDATE<='" + relBeginTo + " 23:59:59' ";
|
|
}
|
|
if (relStrCondition != "" && relAccFrom != "")
|
|
{
|
|
relStrCondition += " and B.ACCDATE>='" + relAccFrom.Substring(0, 7) + "' ";
|
|
}
|
|
else if (relStrCondition == "" && relAccFrom != "") { relStrCondition += " B.ACCDATE>'" + relAccFrom.Substring(0, 7) + "' "; }
|
|
if (relAccTo != "")
|
|
{
|
|
relStrCondition += " and B.ACCDATE<='" + relAccTo.Substring(0, 7) + "' ";
|
|
}
|
|
|
|
var listData = DSWebMobileService.MsRptOpProfitMonth.CustListDataByCondition(relStrCondition, null, null, null, relStartMonth, relEndMonth);
|
|
string result = listData.Content.ToString();
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
if (listData == null) { sb.Append("[{\"CUSTNAME\":\"\"}]"); }
|
|
else { sb.AppendLine(result); }
|
|
context.Response.ContentType = "text/plain";
|
|
context.Response.Write(sb.ToString());
|
|
context.Response.End();
|
|
}
|
|
|
|
private void GetDataList(HttpContext context)
|
|
{
|
|
string relStartMonth = "";
|
|
string relEndMonth = "";
|
|
string relStrCondition = "";
|
|
string relBeginFrom = "";
|
|
string relBeginTo = "";
|
|
string relAccFrom = "";
|
|
string relAccTo = "";
|
|
|
|
string strCondition = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["s"].ToString());
|
|
string startMonth = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["sm"].ToString());
|
|
string endMonth = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["em"].ToString());
|
|
string bfd = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["bfd"].ToString());
|
|
string btd = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["btd"].ToString());
|
|
string afd = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["afd"].ToString());
|
|
string atd = Encrypt.DesDecrypt("#7c&e@63", context.Request.Form["atd"].ToString());
|
|
|
|
string pattern = "\0";
|
|
string replacement = "";
|
|
|
|
int start = int.Parse(context.Request.QueryString["t"].ToString());
|
|
int limit = int.Parse(context.Request.QueryString["l"].ToString());
|
|
|
|
Regex rgx = new Regex(pattern);
|
|
relStrCondition = rgx.Replace(strCondition, replacement);
|
|
relStartMonth = rgx.Replace(startMonth, replacement);
|
|
relEndMonth = rgx.Replace(endMonth, replacement);
|
|
relBeginFrom = rgx.Replace(bfd, replacement);
|
|
relBeginTo = rgx.Replace(btd, replacement);
|
|
relAccFrom = rgx.Replace(afd, replacement);
|
|
relAccTo = rgx.Replace(atd, replacement);
|
|
pattern = "\t";
|
|
Regex rgx2 = new Regex(pattern);
|
|
relStrCondition = rgx2.Replace(relStrCondition, replacement);
|
|
relStartMonth = rgx.Replace(relStartMonth, replacement);
|
|
relEndMonth = rgx.Replace(relEndMonth, replacement);
|
|
relBeginFrom = rgx2.Replace(relBeginFrom, replacement);
|
|
relBeginTo = rgx2.Replace(relBeginTo, replacement);
|
|
relAccFrom = rgx2.Replace(relAccFrom, replacement);
|
|
relAccTo = rgx2.Replace(relAccTo, replacement);
|
|
|
|
if (strCondition != "")
|
|
{
|
|
if (relStrCondition[0] == ',') { relStrCondition = relStrCondition.Substring(1, relStrCondition.Length - 1); }
|
|
}
|
|
if (relBeginFrom != "")
|
|
{
|
|
if (relStrCondition != "")
|
|
{
|
|
relStrCondition += " and B.OPDATE>='" + relBeginFrom + " 00:00:00' ";
|
|
}
|
|
else
|
|
{
|
|
relStrCondition = " B.OPDATE>='" + relBeginFrom + " 00:00:00' ";
|
|
}
|
|
}
|
|
if (relBeginTo != "")
|
|
{
|
|
relStrCondition += " and B.OPDATE<='" + relBeginTo + " 23:59:59' ";
|
|
}
|
|
if (relStrCondition != "" && relAccFrom != "")
|
|
{
|
|
relStrCondition += " and B.ACCDATE>='" + relAccFrom.Substring(0, 7) + "' ";
|
|
}
|
|
else if (relStrCondition == "" && relAccFrom != "") { relStrCondition += " B.ACCDATE>'" + relAccFrom.Substring(0, 7) + "' "; }
|
|
if (relAccTo != "")
|
|
{
|
|
relStrCondition += " and B.ACCDATE<='" + relAccTo.Substring(0, 7) + "' ";
|
|
}
|
|
|
|
//MsRptOpProfitMonthController _custList = new MsRptOpProfitMonthController();
|
|
//var listData = _custList.CustListData(start, limit, relStrCondition, null, null, null, relStartMonth, relEndMonth);
|
|
var listData = DSWebMobileService.MsRptOpProfitMonth.CustListData(start, limit, relStrCondition, null, null, null, relStartMonth, relEndMonth);
|
|
string result = listData.Content.ToString();
|
|
result = result.Replace("\r\n", "");
|
|
result = "[" + result.Substring(1, result.Length - 2) + "]";
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
if (listData == null) { sb.Append("[{\"GID\":\"\"}]"); }
|
|
else { sb.AppendLine(result); }
|
|
context.Response.ContentType = "text/plain";
|
|
context.Response.Write(sb.ToString());
|
|
context.Response.End();
|
|
}
|
|
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
} |