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 System.Data.SqlClient; using System.Collections.Generic; using System.Xml; using DSWeb.Models; using DSWeb.EntityDA; using System.Text.RegularExpressions; namespace DSWeb.FeeCodes { public partial class CompanyInfo : System.Web.UI.Page { private string strMark; private string strPos; private int iPos = 0; private string strUserID;//登录用户GID private string strCurrency;//币别 private int iType;//类型 值1获取公司银行信息 值2获取公司账户信息 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strPost = Request.Url.ToString(); if (Session["USERID"] != null) { strUserID = Session["USERID"].ToString(); } else { Server.Transfer("~/Error/FriendError.aspx"); return; //strUserID = ""; } if (Request.QueryString["mask"] != null) { strMark = Request.QueryString["mask"].ToString(); } if (Request.QueryString["pos"] != null) { strPos = Request.QueryString["pos"].ToString(); iPos = int.Parse(strPos); } if (Request.QueryString["currency"] != null) { UnicodeEncoding unicode = new UnicodeEncoding(); strCurrency = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["currency"].ToString()))); } if (Request.QueryString["type"] != null) { iType = int.Parse(Request.QueryString["type"].ToString().Trim()); } XmlDocument docs = GetDoc(); Response.ContentType = "text/xml"; Response.Write(docs.OuterXml.ToString()); } } public string BuildXML() { StringBuilder resultBuilder = new StringBuilder(); resultBuilder.Append(""); resultBuilder.AppendFormat("", iPos == 0 ? string.Empty : " add=\"true\""); if (!string.IsNullOrEmpty(strMark)) { string strSql = String.Format(" SELECT BANKNAME,ACCOUNT FROM sys_bank WHERE LINKID IN " +" (SELECT C.GID FROM [user] as A INNER JOIN user_company as B on A.GID = B.USERID INNER JOIN [company] as C " +" ON B.COMPANYID = C.GID WHERE A.GID = '{0}' and A.ISDELETED=0) AND CURRENCY = '{1}'", strUserID, strCurrency); CRMClientDA crmClientDA = new CRMClientDA(); DataTable sourceTable = crmClientDA.GetExcuteSql(strSql).Tables[0]; if (sourceTable.Rows.Count > 0) { for (int i = 0; i < sourceTable.Rows.Count; i++) { if (iType == 1) { if (sourceTable.Rows[0][0].ToString().Trim() != "") { resultBuilder.AppendFormat("", sourceTable.Rows[i][0].ToString().Trim(), sourceTable.Rows[i][0].ToString().Trim()); } } else if (iType == 2) { if (sourceTable.Rows[0][1].ToString().Trim() != "") { resultBuilder.AppendFormat("", sourceTable.Rows[i][1].ToString().Trim(), sourceTable.Rows[i][1].ToString().Trim()); } } } } else { resultBuilder.AppendFormat("", "", ""); } } resultBuilder.Append(""); return resultBuilder.ToString().Replace("&", "&"); } public XmlDocument GetDoc() { XmlDocument xmldoc = new XmlDocument(); string content = BuildXML(); try { xmldoc.LoadXml(content); } catch (Exception) { } return xmldoc; } } }