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; } } /// /// 获取费用信息 /// /// 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(""); dataBuilder.Append(""); //int iCount = 13; int iCount = feeTable.Rows.Count; for (int i = 0; i < iCount; i++) { int jCount = feeTable.Columns.Count; dataBuilder.Append(""); 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("" + feeTable.Rows[i][j].ToString() + ""); dataBuilder.Append(GetFRTCells("")); break; default: dataBuilder.Append("" + feeTable.Rows[i][j].ToString() + ""); break; } } //dataBuilder.Append("1"); //dataBuilder.Append(""); //dataBuilder.Append(""); //dataBuilder.Append(""); //dataBuilder.Append(""); //dataBuilder.Append(GetCRMClientCells()); dataBuilder.Append(""); dataBuilder.Append(""); } dataBuilder.Append(""); return dataBuilder.ToString(); } /// /// 获取CRM系统客户信息下拉列表 /// /// 当前列表客户信息值 /// public string GetCRMClientCells(string strClientValue) { CRMClientDA crmClientDA = new CRMClientDA(); DataTable clientTable = crmClientDA.GetCRMClientList().Tables[0]; StringBuilder clientBuilder = new StringBuilder(); clientBuilder.Append("" + strClientValue); for (int i = 0; i < clientTable.Rows.Count; i++) { if (!clientTable.Rows[i]["NAME"].ToString().Trim().Equals("")) { clientBuilder.Append(""); } } clientBuilder.Append(""); return clientBuilder.ToString(); } /// /// 获取币别信息下拉列表 /// /// public string GetCurrencyCells(string strCurrencyValue) { CurrencyDA currencyDA = new CurrencyDA(); DataTable currencyTable = currencyDA.GetCurrencyList().Tables[0]; StringBuilder currencyBuilder = new StringBuilder(); currencyBuilder.Append("" + strCurrencyValue); for (int i = 0; i < currencyTable.Rows.Count; i++) { if (!currencyTable.Rows[i]["DESCRIPTION"].ToString().Trim().Equals("")) { currencyBuilder.Append(""); } } currencyBuilder.Append(""); return currencyBuilder.ToString(); } /// /// 获取费用代码信息下拉列表 /// /// /// public string GetFeeCodeCells(string strFeeCodeValue) { FeeCodeDA feeCodeDA = new FeeCodeDA(); DataTable feeCodeTable = feeCodeDA.GetFeeCodeList().Tables[0]; StringBuilder feeCodeBuilder = new StringBuilder(); feeCodeBuilder.Append("" + strFeeCodeValue); for (int i = 0; i < feeCodeTable.Rows.Count; i++) { if (!feeCodeTable.Rows[i]["NAME"].ToString().Trim().Equals("")) { feeCodeBuilder.Append(""); } } feeCodeBuilder.Append(""); return feeCodeBuilder.ToString(); } /// /// 获取标准信息下拉列表 /// /// /// public string GetUnitCells(string strUnitValue) { StringBuilder unitBuilder = new StringBuilder(); unitBuilder.Append("" + strUnitValue); unitBuilder.Append(""); unitBuilder.Append(""); //unitBuilder.Append(""); unitBuilder.Append(""); unitBuilder.Append(""); unitBuilder.Append(""); unitBuilder.Append(""); unitBuilder.Append(""); unitBuilder.Append(""); return unitBuilder.ToString(); } /// /// 获取引入类型信息下拉列表 /// /// /// public string GetFRTCells(string strFRTValue) { StringBuilder frtBuilder = new StringBuilder(); frtBuilder.Append("" + strFRTValue); frtBuilder.Append(""); frtBuilder.Append(""); frtBuilder.Append(""); frtBuilder.Append(""); return frtBuilder.ToString(); } } }