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.
DS7/DSWeb/Shipping/FeePayGridSource.aspx.cs

278 lines
10 KiB
C#

2 years ago
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
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;
namespace DSWeb.Shipping
{
public partial class FeePayGridSource : System.Web.UI.Page
{
private int iType;//费用类型 应收类型值1 应付类型值 2
private string strReadXmlType = "";//读取xml串方式 "init"-初始化获取所有费用信息;"add"-添加新的费用信息;"delete"-删除费用信息
private int iShowCount;//每页显示数据量
protected void Page_Load(object sender, EventArgs e)
{
#region 判断参数是否正确
if (Request.QueryString["type"] != null)
{
iType = int.Parse(Request.QueryString["type"].ToString().Trim());
}
if (Request.QueryString["read"] != null)
{
strReadXmlType = Request.QueryString["read"].ToString().Trim();
}
if (Request.QueryString["showcount"] != null)
{
iShowCount = int.Parse(Request.QueryString["showcount"].ToString());
}
#endregion
if (iType > 0 && !strReadXmlType.Equals("") && iShowCount > 0)
{
string strOutputXml = "";
strOutputXml = GetCells(iShowCount, iType, strReadXmlType);
//输出XML字符串
Response.ContentType = "text/xml";
strOutputXml.Replace("&", "&");
Response.Write(strOutputXml);
}
else
{
//访问参数不正确
return;
}
}
/// <summary>
/// 获取费用信息
/// </summary>
/// <returns></returns>
private string GetCells(int iShowCount, int Type, string readXmlType)
{
//GID, FEETYPE, FEENAME, CUSTOMERNAME, UNIT, UNITPRICE, COMMISSIONRATE, QUANTITY, AMOUNT, CURRENCY, EXCHANGERATE, REMARK "
FeeEntity feeEntity = new FeeEntity();
FeeDA feeDA = new FeeDA();
//获取所有费用信息,用做Grid显示
DataTable feeTable = new DataTable();
//初始化
string strInitSql = " SELECT {0} GID, FEESTATUS, FEENAME, CUSTOMERNAME, UNIT, UNITPRICE, COMMISSIONRATE, QUANTITY, AMOUNT, CURRENCY, "
+ " EXCHANGERATE,REMARK FROM ch_fee WHERE 1> 0 {1}";
string strSql = "";
if (iType == 1)
{
if (iShowCount > 0)
{
strSql = string.Format(strInitSql, "top " + iShowCount, " AND FEETYPE like '%收%' ");
}
else
{
strSql = string.Format(strInitSql, "", " AND FEETYPE like '%收%' ");
}
}
else
{
if (iShowCount > 0)
{
strSql = string.Format(strInitSql, "top " + iShowCount, " AND FEETYPE like '%付%' ");
}
else
{
strSql = string.Format(strInitSql, "", " AND FEETYPE like '%付%' ");
}
}
feeTable = feeDA.GetExcuteSql(strSql).Tables[0];
//feeTable = feeDA.GetFeeList().Tables[0];
//编排字符串 xml串
StringBuilder dataBuilder = new StringBuilder();
dataBuilder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
dataBuilder.Append("<rows>");
//int iCount = 13;
int iCount = feeTable.Rows.Count;
for (int i = 0; i < iCount; i++)
{
int jCount = feeTable.Columns.Count;
dataBuilder.Append("<row id=\"" + feeTable.Rows[i]["GID"].ToString() + "\">");
for (int j = 1; j < jCount; j++)
{
switch (j)
{
case 2://FEENAME
dataBuilder.Append(GetFeeCodeCells(feeTable.Rows[i][j].ToString().Trim()));
break;
case 3://CUSTOMERNAME
dataBuilder.Append(GetCRMClientCells(feeTable.Rows[i][j].ToString().Trim()));
break;
case 4:
dataBuilder.Append(GetUnitCells(feeTable.Rows[i][j].ToString().Trim()));
break;
case 9:
dataBuilder.Append(GetCurrencyCells(feeTable.Rows[i][j].ToString().Trim()));
break;
case 10:
dataBuilder.Append("<cell>" + feeTable.Rows[i][j].ToString() + "</cell>");
dataBuilder.Append(GetFRTCells(""));
break;
default:
dataBuilder.Append("<cell>" + feeTable.Rows[i][j].ToString() + "</cell>");
break;
}
}
//dataBuilder.Append("<cell xmlcontent=\"1\">1");
//dataBuilder.Append("<option value=\"1\">one</option>");
//dataBuilder.Append("<option value=\"2\">two</option>");
//dataBuilder.Append("<option value=\"3\">three</option>");
//dataBuilder.Append("</cell>");
//dataBuilder.Append(GetCRMClientCells());
dataBuilder.Append("<cell type=\"ch\"></cell>");
dataBuilder.Append("</row>");
}
dataBuilder.Append("</rows>");
return dataBuilder.ToString();
}
/// <summary>
/// 获取CRM系统客户信息下拉列表
/// </summary>
/// <param name="strClientValue">当前列表客户信息值</param>
/// <returns></returns>
public string GetCRMClientCells(string strClientValue)
{
CRMClientDA crmClientDA = new CRMClientDA();
DataTable clientTable = crmClientDA.GetCRMClientList().Tables[0];
StringBuilder clientBuilder = new StringBuilder();
clientBuilder.Append("<cell xmlcontent=\"1\">" + strClientValue);
for (int i = 0; i < clientTable.Rows.Count; i++)
{
if (!clientTable.Rows[i]["NAME"].ToString().Trim().Equals(""))
{
clientBuilder.Append("<option value=\"" + clientTable.Rows[i]["CODENAME"].ToString() + "\">" + clientTable.Rows[i]["NAME"].ToString() + "</option>");
}
}
clientBuilder.Append("</cell>");
return clientBuilder.ToString();
}
/// <summary>
/// 获取币别信息下拉列表
/// </summary>
/// <returns></returns>
public string GetCurrencyCells(string strCurrencyValue)
{
CurrencyDA currencyDA = new CurrencyDA();
DataTable currencyTable = currencyDA.GetCurrencyList().Tables[0];
StringBuilder currencyBuilder = new StringBuilder();
currencyBuilder.Append("<cell xmlcontent=\"1\">" + strCurrencyValue);
for (int i = 0; i < currencyTable.Rows.Count; i++)
{
if (!currencyTable.Rows[i]["DESCRIPTION"].ToString().Trim().Equals(""))
{
currencyBuilder.Append("<option value=\"" + currencyTable.Rows[i]["CODENAME"].ToString() + "\">" + currencyTable.Rows[i]["DESCRIPTION"].ToString() + "</option>");
}
}
currencyBuilder.Append("</cell>");
return currencyBuilder.ToString();
}
/// <summary>
/// 获取费用代码信息下拉列表
/// </summary>
/// <param name="strFeeCodeValue"></param>
/// <returns></returns>
public string GetFeeCodeCells(string strFeeCodeValue)
{
FeeCodeDA feeCodeDA = new FeeCodeDA();
DataTable feeCodeTable = feeCodeDA.GetFeeCodeList().Tables[0];
StringBuilder feeCodeBuilder = new StringBuilder();
feeCodeBuilder.Append("<cell xmlcontent=\"1\">" + strFeeCodeValue);
for (int i = 0; i < feeCodeTable.Rows.Count; i++)
{
if (!feeCodeTable.Rows[i]["NAME"].ToString().Trim().Equals(""))
{
feeCodeBuilder.Append("<option value=\"" + feeCodeTable.Rows[i]["NAME"].ToString() + "\">" + feeCodeTable.Rows[i]["FULLNAME"].ToString() + "</option>");
}
}
feeCodeBuilder.Append("</cell>");
return feeCodeBuilder.ToString();
}
/// <summary>
/// 获取标准信息下拉列表
/// </summary>
/// <param name="strUnitValue"></param>
/// <returns></returns>
public string GetUnitCells(string strUnitValue)
{
StringBuilder unitBuilder = new StringBuilder();
unitBuilder.Append("<cell xmlcontent=\"1\">" + strUnitValue);
unitBuilder.Append("<option value=\"单票\">单票</option>");
unitBuilder.Append("<option value=\"重量\">重量</option>");
//unitBuilder.Append("<option value=\"净重\">净重</option>");
unitBuilder.Append("<option value=\"尺码\">尺码</option>");
unitBuilder.Append("<option value=\"TEU\">TEU</option>");
unitBuilder.Append("<option value=\"箱型\">箱型</option>");
unitBuilder.Append("<option value=\"CBM\">CBM</option>");
unitBuilder.Append("<option value=\"BILL\">BILL</option>");
unitBuilder.Append("</cell>");
return unitBuilder.ToString();
}
/// <summary>
/// 获取引入类型信息下拉列表
/// </summary>
/// <param name="strFRTValue"></param>
/// <returns></returns>
public string GetFRTCells(string strFRTValue)
{
StringBuilder frtBuilder = new StringBuilder();
frtBuilder.Append("<cell xmlcontent=\"1\">" + strFRTValue);
frtBuilder.Append("<option value=\" \">null</option>");
frtBuilder.Append("<option value=\"pp\">PP</option>");
frtBuilder.Append("<option value=\"cc\">CC</option>");
frtBuilder.Append("</cell>");
return frtBuilder.ToString();
}
}
}