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 System.Text;
using DSWeb.Models;
using DSWeb.EntityDA;
using System.Text.RegularExpressions;
using DSWeb.Authority;
namespace DSWeb.Reports
{
public partial class ReportGridSource : System.Web.UI.Page
{
private string strHandle;
private string strUserID;
private string strCompanyID;//公司GID
private string strShowName;//用户显示名
private string strDeptName;//部门名称
private string strSortName;//排序名称
private string strSortIndex;//排序方向 asc desc
private string strSearchCacheName;//综合查询条件缓存
private string strSearch;//委托信息查询条件
private int iCurrentPage;//当前页数
private int iShowPage;//显示最大页数
private string stroplb = "";//业务类别
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString().Trim();
}
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().Trim().ToLower();
}
if (Request.QueryString["oplb"] != null)
{
stroplb = Request.QueryString["oplb"].ToString();
}
if (Request.QueryString["search"] != null)
{
UnicodeEncoding unicode = new UnicodeEncoding();
strSearch = unicode.GetString(unicode.GetBytes(Regex.Unescape(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["sort"] != null)
{
strSortName = Request.QueryString["sort"].ToString().Trim().ToUpper();
}
if (Request.QueryString["sortindex"] != null)
{
strSortIndex = Request.QueryString["sortindex"].ToString().Trim().ToUpper();
if (strSortIndex.Equals("DES"))
{
strSortIndex = "DESC";
}
}
if (Request.QueryString["searchcachename"] != null)
{
strSearchCacheName = Request.QueryString["searchcachename"].ToString();
}
if (strHandle != null)
{
if (strHandle == "multiplebusiness")
{
Response.Write(GetMultipleBusinessReportList());
}
if (strHandle == "multiplebusinesspage")
{
Response.Write(GetMultipleBusinessReportPage());
}
if (strHandle == "opseaemultipletotal")
{
Response.Write(GetMultipleBusinessTotalList());
}
}
}
#region 海运出口业务台账综合利润信息
///
/// 海运出口业务台账综合利润信息
///
/// 返回海运出口业务台账综合利润信息
private string GetMultipleBusinessTotalList()
{
ReportDA reportDA = new ReportDA();
DataTable sourceTable;
string strCondition = "";
string tempCacheSearch = "";
if (strSearchCacheName != null)
{
tempCacheSearch = Session[strSearchCacheName].ToString();
string tempSearch = tempCacheSearch;
tempSearch = tempSearch.Replace("{", "");
tempSearch = tempSearch.Replace("}", "");
tempSearch = tempSearch.Replace("[", "");
tempSearch = tempSearch.Replace("]", "");
string[] searchArg = tempSearch.Split(new char[] { ',' });
ArrayList optionList = new ArrayList();
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 "search1"://search1
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal1"://equal1
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type1"://type1
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value1"://value1
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
case "option2":
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
optionList.Add(strArg[1].Replace("\"", "").Trim());
break;
case "search2"://search2
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal2"://equal2
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type2"://type2
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value2"://value3
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
case "option3":
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
optionList.Add(strArg[1].Replace("\"", "").Trim());
break;
case "search3"://search3
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal3"://equal3
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type3"://type3
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value3"://value4
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
case "option4":
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
optionList.Add(strArg[1].Replace("\"", "").Trim());
break;
case "search4"://search4
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal4"://equal4
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type4"://type4
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value4"://value4
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
case "option5":
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
optionList.Add(strArg[1].Replace("\"", "").Trim());
break;
case "search5"://search5
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal5"://equal5
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type5"://type5
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value5"://value5
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
case "option6":
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
optionList.Add(strArg[1].Replace("\"", "").Trim());
break;
case "search6"://search6
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal6"://equal6
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type6"://type6
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value6"://value6
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
default:
break;
}
//}
}
strCondition = " AND " + strCondition + " ";
}
string strAuthorityCondition = "";
UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modOrderManagement");
if (userAuthorityManage.OperateType != AuthorityType.NULL)
{
strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.OPSEAELIST, strShowName, strCompanyID, strDeptName, strUserID);//ModuleType.OPSEAILIST
}
string strSortCondition = "";
if (strSortName != null && strSortIndex != null)
{
strSortCondition = String.Format(" ORDER BY {0} {1}", strSortName, strSortIndex);
}
else
{
strSortCondition = String.Format(" ORDER BY {0} {1}", "", "");
}
sourceTable = reportDA.GetDataTableSourceByCondtion(ReportType.MULTIPLEBUSINESSTOTAL, (strAuthorityCondition + strCondition), strSortCondition);
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();
}
#endregion
private int GetMultipleBusinessReportPage()
{
SeaExportInfoDA seaExportInfoDA = new SeaExportInfoDA();
string strSql = "SELECT COUNT(*) FROM VW_MultipleBusinessReport WHERE 1 > 0 ";
string strCondition = "";
int itempoplb = 0;
//string strAuthorityCondition = "";
//UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modOrderManagement");
//if (userAuthorityManage.OperateType != AuthorityType.NULL)
//{
// strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.OPSEAELIST, strShowName, strCompanyID, strDeptName, strUserID);
// strSql += strAuthorityCondition;
//}
string tempCacheSearch = "";
if (strSearchCacheName != null)
{
tempCacheSearch = Session[strSearchCacheName].ToString();
string tempSearch = tempCacheSearch;
tempSearch = tempSearch.Replace("{", "");
tempSearch = tempSearch.Replace("}", "");
tempSearch = tempSearch.Replace("[", "");
tempSearch = tempSearch.Replace("]", "");
string[] searchArg = tempSearch.Split(new char[] { ',' });
ArrayList optionList = new ArrayList();
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 "search1"://search1
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal1"://equal1
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type1"://type1
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value1"://value1
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
case "option2":
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
optionList.Add(strArg[1].Replace("\"", "").Trim());
break;
case "search2"://search2
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal2"://equal2
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type2"://type2
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value2"://value3
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
case "option3":
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
optionList.Add(strArg[1].Replace("\"", "").Trim());
break;
case "search3"://search3
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal3"://equal3
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type3"://type3
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value3"://value4
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
case "option4":
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
optionList.Add(strArg[1].Replace("\"", "").Trim());
break;
case "search4"://search4
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal4"://equal4
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type4"://type4
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value4"://value4
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
case "option5":
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
optionList.Add(strArg[1].Replace("\"", "").Trim());
break;
case "search5"://search5
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal5"://equal5
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type5"://type5
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value5"://value5
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
case "option6":
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
optionList.Add(strArg[1].Replace("\"", "").Trim());
break;
case "search6"://search6
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal6"://equal6
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type6"://type6
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value6"://value6
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
default:
break;
}
//}
}
strCondition = " AND " + strCondition + " ";
strSql += strCondition;
}
else 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"://ETD BeginDate
strCondition += String.Format(" AND ETD >= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "etime"://ETD EndDate
strCondition += String.Format(" AND ETD <= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "cus"://CUSTOMER
strCondition += String.Format(" AND CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "no"://NO
strCondition += String.Format(" AND (CUSTNO LIKE '%{0}%' OR MBLNO LIKE '%{0}%' OR HBLNO LIKE '%{0}%' OR ORDERNO like '%{0}%')", strArg[1].Replace("\"", ""));
break;
case "op"://OP
strCondition += String.Format(" AND OP LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "vessel"://VESSEL
strCondition += String.Format(" AND VESSEL LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "voyno"://VOYNO
strCondition += String.Format(" AND VOYNO LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "bty"://业务类型
itempoplb = int.Parse(strArg[1].Replace("\"", ""));
break;
default:
break;
}
}
}
strSql += strCondition;
}
}
int iTotal = int.Parse(seaExportInfoDA.GetExcuteSql(strSql).Tables[0].Rows[0][0].ToString());
return iTotal;
}
private string GetMultipleBusinessReportList()
{
SeaExportInfoDA seaExportInfoDA = new SeaExportInfoDA();
DataTable sourceTable;
string strCondition = "";
string strTopInclude = "";
string strTopNotInclude = "";
string tempCacheSearch = "";
int itempoplb = 0;
if (strSearchCacheName != null)
{
tempCacheSearch = Session[strSearchCacheName].ToString();
string tempSearch = tempCacheSearch;
tempSearch = tempSearch.Replace("{", "");
tempSearch = tempSearch.Replace("}", "");
tempSearch = tempSearch.Replace("[", "");
tempSearch = tempSearch.Replace("]", "");
string[] searchArg = tempSearch.Split(new char[] { ',' });
ArrayList optionList = new ArrayList();
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 "search1"://search1
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal1"://equal1
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type1"://type1
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value1"://value1
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
case "option2":
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
optionList.Add(strArg[1].Replace("\"", "").Trim());
break;
case "search2"://search2
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal2"://equal2
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type2"://type2
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value2"://value3
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
case "option3":
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
optionList.Add(strArg[1].Replace("\"", "").Trim());
break;
case "search3"://search3
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal3"://equal3
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type3"://type3
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value3"://value4
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
case "option4":
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
optionList.Add(strArg[1].Replace("\"", "").Trim());
break;
case "search4"://search4
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal4"://equal4
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type4"://type4
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value4"://value4
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
case "option5":
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
optionList.Add(strArg[1].Replace("\"", "").Trim());
break;
case "search5"://search5
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal5"://equal5
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type5"://type5
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value5"://value5
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
case "option6":
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
optionList.Add(strArg[1].Replace("\"", "").Trim());
break;
case "search6"://search6
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
break;
case "equal6"://equal6
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
break;
case "type6"://type6
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
break;
case "value6"://value6
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
break;
default:
break;
}
//}
}
strCondition = " AND " + strCondition + " ";
}
else 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"://ETD BeginDate
strCondition += String.Format(" AND ETD >= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "etime"://ETD EndDate
strCondition += String.Format(" AND ETD <= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "cus"://CUSTOMER
strCondition += String.Format(" AND CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "no"://NO
strCondition += String.Format(" AND (CUSTNO LIKE '%{0}%' OR MBLNO LIKE '%{0}%' OR HBLNO LIKE '%{0}%' OR ORDERNO like '%{0}%')", strArg[1].Replace("\"", ""));
break;
case "op"://OP
strCondition += String.Format(" AND OP LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "vessel"://VESSEL
strCondition += String.Format(" AND VESSEL LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "voyno"://VOYNO
strCondition += String.Format(" AND VOYNO LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "bty"://业务类型
itempoplb = int.Parse(strArg[1].Replace("\"", ""));
break;
default:
break;
}
}
}
}
}
string strAuthorityCondition = "";
//UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modOrderManagement");
//if (userAuthorityManage.OperateType != AuthorityType.NULL)
//{
// strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.OPSEAELIST, strShowName, strCompanyID, strDeptName, strUserID);
//}
string strSortCondition = "";
if (strSortName != null && strSortIndex != null)
{
strSortCondition = String.Format(" ORDER BY {0} {1}", strSortName, strSortIndex);
}
else
{
strSortCondition = String.Format(" ORDER BY {0} {1}", "ETD", "DESC");
}
string strSql = "";
if (iCurrentPage > 0 && iShowPage > 0)
{
if (iCurrentPage == 1)
{//业务封账 接受委托
strSql = String.Format("SELECT {0}* FROM VW_MultipleBusinessReport where 1>0 " + strAuthorityCondition + strCondition + strSortCondition, "top " + iShowPage.ToString());
}
else
{//业务封账 接受委托
strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
strTopInclude = "top " + iShowPage.ToString();
strSql = String.Format("SELECT {0}* FROM VW_MultipleBusinessReport WHERE BSNO NOT IN "
+ " (SELECT {1} BSNO FROM VW_MultipleBusinessReport WHERE 1>0 " + strAuthorityCondition + strCondition + strSortCondition + ") " + strAuthorityCondition + strCondition
+ strSortCondition, strTopInclude, strTopNotInclude);
}
}
else
{//业务封账 接受委托
strSql = String.Format("SELECT * FROM VW_MultipleBusinessReport where 1>0 " + strAuthorityCondition + strCondition + strSortCondition);
}
//switch (itempoplb)
//{
// case 0-1://所有业务
// SeaExportInfoDA seaExportInfoDA = new SeaExportInfoDA();
// sourceTable = getStatusNameTable(seaExportInfoDA.GetSeaExportListByCondition(strSql).Tables[0]);
// break;
// case 1://海运出口
// SeaExportInfoDA seaExportInfoDA = new SeaExportInfoDA();
// sourceTable = getStatusNameTable(seaExportInfoDA.GetSeaExportListByCondition(strSql).Tables[0]);
// break;
// case 2://海运进口
// SeaImportInfoDA seaImportInfoDA = new SeaImportInfoDA();
// sourceTable = getStatusNameTable(seaImportInfoDA.GetSeaExportListByCondition(strSql).Tables[0]);
// break;
// case 3://空运出口
// break;
// case 4://空运进口
// break;
// default:
// break;
//}
sourceTable = getStatusNameTable(seaExportInfoDA.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();
}
private string GetOption(string tempOption, ArrayList tempList, string tempCondition)
{
string tempResult = "";
switch (tempOption)
{
case "1":
if (tempList.Count > 0)
{
if (tempList[(tempList.Count - 1)].ToString().Trim() != "1")
{
tempResult = " (" + tempCondition + ") AND ";
}
else
{
tempResult = tempCondition + " AND ";
}
}
else
{
tempResult = tempCondition + " AND ";
}
break;
case "2":
if (tempList.Count > 0)
{
if (tempList[(tempList.Count - 1)].ToString().Trim() != "2")
{
tempResult = " (" + tempCondition + ") OR ";
}
else
{
tempResult = tempCondition + " OR ";
}
}
else
{
tempResult = tempCondition + " OR ";
}
break;
}
return tempResult;
}
private string GetEqual(string tempEqual)
{
string tempResult = "";
switch (tempEqual)
{
case "=":
tempResult = " = {0} ";
break;
case "<":
tempResult = " < {0} ";
break;
case ">":
tempResult = " > {0} ";
break;
case "in":
tempResult = " LIKE {0} ";
break;
case "notin":
tempResult = " NOT LIKE {0} ";
break;
case "null":
tempResult = " IS NULL ";
break;
case "notnull":
tempResult = " IS NOT NULL ";
break;
case ">=":
tempResult = " >= {0} ";
break;
case "<=":
tempResult = " <= {0} ";
break;
}
return tempResult;
}
private string GetEqualValueType(string typeName)
{
string tempResult = "";
switch (typeName)
{
case "str":
tempResult = "'{0}'";
break;
case "sdate":
tempResult = "'{0}'";
break;
case "bool":
tempResult = "{0}";
break;
case "int":
tempResult = "{0}";
break;
}
return tempResult;
}
#region 将数据集表中费用状态FeeStatus和业务状态的数字状态位转换成文字
///
/// 将数据集表中费用状态FeeStatus和业务状态的数字状态位转换成文字
///
/// 原数据源DataTable
/// 返回新数据源DataTable
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("BSSTATUS"))
{
DataColumn newColumn = new DataColumn();
newColumn.ColumnName = sourceTable.Columns[j].ColumnName;
newColumn.DataType = System.Type.GetType("System.String");
cloneTable.Columns.Add(newColumn);
}
else if (sourceTable.Columns[j].ColumnName.Equals("FEESTATUS"))
{
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("BSSTATUS"))
{
int iFeeStatus = sourceTable.Rows[i][k].ToString().Trim().ToLower().Equals("true") ? 1 : 0;
string strFeeStatus = "";
switch (iFeeStatus)
{
case 0:
strFeeStatus = "未锁定";
break;
case 1:
strFeeStatus = "锁定";
break;
default:
break;
}
cloneRow[sourceTable.Columns[k].ColumnName] = strFeeStatus;
}
else if (sourceTable.Columns[k].ColumnName.Equals("FEESTATUS"))
{
int iFeeStatus = sourceTable.Rows[i][k].ToString().Trim().ToLower().Equals("true") ? 1 : 0;
string strFeeStatus = "";
switch (iFeeStatus)
{
case 0:
strFeeStatus = "未锁定";
break;
case 1:
strFeeStatus = "锁定";
break;
default:
break;
}
cloneRow[sourceTable.Columns[k].ColumnName] = strFeeStatus;
}
else
{
cloneRow[sourceTable.Columns[k].ColumnName] = sourceTable.Rows[i][k];
}
}
cloneTable.Rows.Add(cloneRow);
}
//cloneTable.Columns.Remove("FEESTATUS");
//cloneTable.Columns.Add(new DataColumn("FEESTATUS", System.Type.GetType("System.String")));
return cloneTable;
}
#endregion
}
}