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 System.Xml.Linq; using System.Text; using System.Data.SqlClient; using System.Collections.Generic; using System.Xml; using DSWeb.Models; using DSWeb.EntityDA; namespace DSWeb.FeeCodes { public partial class COUNTRYIDAdapter : System.Web.UI.Page { private string strMark; private string strPos; private int iPos = 0; public string strType = ""; UnicodeEncoding unicode = new UnicodeEncoding(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strPost = Request.Url.ToString(); 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["type"] != null) { strType = unicode.GetString(unicode.GetBytes(Request.QueryString["type"].ToString())); if (strType.Trim().Equals("countryid")) { XmlDocument xmldoc = new XmlDocument(); Response.ContentType = "text/xml"; string content = BuildXML(); try { xmldoc.LoadXml(content); } catch (Exception) { } Response.Write(xmldoc.OuterXml.ToString()); } else if (strType.Trim().Equals("lanegid")) { XmlDocument xmldoc = new XmlDocument(); Response.ContentType = "text/xml"; string content = getLANEGID(); try { xmldoc.LoadXml(content); } catch (Exception) { } Response.Write(xmldoc.OuterXml.ToString()); } } } } public string getLANEGID() { StringBuilder resultBuilder = new StringBuilder(); resultBuilder.Append(""); resultBuilder.AppendFormat("", iPos == 0 ? string.Empty : " add=\"true\""); if (!string.IsNullOrEmpty(strMark)) { T_ALL_DA T_ALL_DA = new T_ALL_DA(); DataSet ds = T_ALL_DA.GetAllSQL("SELECT * FROM code_lanes order by lane"); if (ds != null) { foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["GID"].ToString().Trim() != "" || dr["lane"].ToString().Trim() != "") { resultBuilder.AppendFormat("", dr["GID"].ToString().Trim(), dr["lane"].ToString().Trim()); } } } } resultBuilder.AppendFormat("", "", ""); resultBuilder.Append(""); return resultBuilder.ToString().Replace("&", "&"); } public string BuildXML() { StringBuilder resultBuilder = new StringBuilder(); resultBuilder.Append(""); resultBuilder.AppendFormat("", iPos == 0 ? string.Empty : " add=\"true\""); if (!string.IsNullOrEmpty(strMark)) { T_ALL_DA T_ALL_DA = new T_ALL_DA(); DataSet ds = T_ALL_DA.GetAllSQL("SELECT countryid=isnull(countryid,'') FROM code_disport group by countryid order by countryid"); if (ds != null) { foreach (DataRow dr in ds.Tables[0].Rows) { resultBuilder.AppendFormat("", dr["countryid"].ToString().Trim(), dr["countryid"].ToString().Trim()); } } } resultBuilder.Append(""); return resultBuilder.ToString().Replace("&", "&"); } } }