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 CompanysAdapter : System.Web.UI.Page { private string strMark; private string strPos; private int iPos = 0; public string ISDISABLE = String.Empty; public string ISDELETED = String.Empty; public string strCODENAME = String.Empty; 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["ISDISABLE"] != null) { ISDISABLE = Request.QueryString["ISDISABLE"].ToString(); } if (Request.QueryString["ISDELETED"] != null) { ISDELETED = Request.QueryString["ISDELETED"].ToString(); } if (Request.QueryString["codename"] != null) { strCODENAME = Request.QueryString["codename"].ToString(); } if (Request.QueryString["login"] != null) { CompanyDA CompanyDA = new CompanyDA(); CompanyEntity CompanyEntity = new CompanyEntity(); CompanyEntity = CompanyDA.GetCompanyByCODENAME(strCODENAME); if (CompanyEntity == null) { Response.Write(""); } else { if (CompanyEntity.GID == null || CompanyEntity.GID.ToString().Trim() == "") { Response.Write(""); } else { Response.Write(CompanyEntity.NAME.ToString().Trim()); } } return; } 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 js = " and ISDISABLE=0 and ISDELETED=0"; CompanyDA CompanyDA = new CompanyDA(); DataSet ds = CompanyDA.GetCompanySQL(js); if (ds != null) { foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["CODENAME"].ToString().Trim()!="" || dr["NAME"].ToString().Trim()!="") { js = dr["CODENAME"].ToString().Trim() + " | " + dr["NAME"].ToString().Trim(); resultBuilder.AppendFormat("", dr["CODENAME"].ToString().Trim(), js);//dr["NAME"].ToString().Trim()); } } } } 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; } } }