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.
158 lines
5.9 KiB
C#
158 lines
5.9 KiB
C#
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.EntityDA;
|
|
using DSWeb.DataAccess;
|
|
using DSWeb.Models;
|
|
using System.Web.Script.Serialization;
|
|
|
|
namespace DSWeb.FeeCodes
|
|
{
|
|
public partial class UserAdapter : System.Web.UI.Page
|
|
{
|
|
private string strMark;
|
|
private string strPos;
|
|
private int iPos = 0;
|
|
public string strSubcompany = "";
|
|
public string strPortName = "";
|
|
public string strUSERNAME = "";
|
|
|
|
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["strSubcompany"] != null)
|
|
{
|
|
UnicodeEncoding unicode = new UnicodeEncoding();
|
|
strSubcompany = unicode.GetString(unicode.GetBytes(Request.QueryString["strSubcompany"].ToString().Trim()));
|
|
}
|
|
if (Request.QueryString["SHOWNAME"] != null)
|
|
{
|
|
UnicodeEncoding unicode = new UnicodeEncoding();
|
|
string strSHOWNAME = unicode.GetString(unicode.GetBytes(Request.QueryString["SHOWNAME"].ToString()));
|
|
getSHOWNAME(strSHOWNAME);
|
|
return;
|
|
}
|
|
if (Request.QueryString["username"] != null)
|
|
{
|
|
strUSERNAME = Request.QueryString["username"].ToString();
|
|
}
|
|
if (Request.QueryString["login"] != null)
|
|
{
|
|
UserDA UserDA = new UserDA();
|
|
UserEntity UserEntity = new UserEntity();
|
|
UserEntity = UserDA.GetCAndU(strSubcompany, strUSERNAME);
|
|
if (UserEntity == null)
|
|
{
|
|
Response.Write("");
|
|
}
|
|
else
|
|
{
|
|
if (UserEntity.ShowName == null)
|
|
{
|
|
Response.Write("");
|
|
}
|
|
else
|
|
{
|
|
Response.Write(UserEntity.ShowName.ToString().Trim());
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
if (Request.QueryString["isbeing"] != null)
|
|
{
|
|
string strBeing = Request.QueryString["isbeing"].ToString();
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
strBeing = T_ALL_DA.GetBeingUser(strBeing);
|
|
Response.Write(strBeing.Trim());
|
|
return;
|
|
}
|
|
|
|
XmlDocument docs = GetDoc();
|
|
Response.ContentType = "text/xml";
|
|
Response.Write(docs.OuterXml.ToString());
|
|
}
|
|
}
|
|
|
|
public void getSHOWNAME(string strSHOWNAME)
|
|
{
|
|
UserDA UserDA = new UserDA();
|
|
UserEntity UserEntity = new UserEntity();
|
|
UserEntity = UserDA.GetUserAllBySHOWNAME(strSHOWNAME);
|
|
strPortName = "";
|
|
if (UserEntity.Gid != null)
|
|
{
|
|
strPortName = UserEntity.BaseInfo.OfficePhone.ToString().Trim()+"&&"+UserEntity.BaseInfo.FaxNum.ToString().Trim()+"&&"+UserEntity.BaseInfo.EmailAddressPrimary.ToString().Trim();
|
|
}
|
|
Response.Write(strPortName);
|
|
}
|
|
|
|
public string BuildXML()
|
|
{
|
|
StringBuilder resultBuilder = new StringBuilder();
|
|
|
|
resultBuilder.Append("<?xml version=\"1.0\" ?>");
|
|
resultBuilder.AppendFormat("<complete{0}>", iPos == 0 ? string.Empty : " add=\"true\"");
|
|
if (!string.IsNullOrEmpty(strMark))
|
|
{
|
|
string js = "";
|
|
UserDA UserDA = new UserDA();
|
|
DataSet ds = UserDA.GetUserSQL(" and GID in (select USERID from user_company where [COMPANYID]=(SELECT GID from [company] where [NAME]='" + strSubcompany + "' and ISDELETED=0)) and ISDISABLE=0 and ISDELETED=0");
|
|
//DataSet ds = UserDA.GetUserSQL(" and ISDISABLE=0 and ISDELETED=0");
|
|
if (ds != null)
|
|
{
|
|
foreach (DataRow dr in ds.Tables[0].Rows)
|
|
{
|
|
if (dr["CODENAME"].ToString().Trim() != "" || dr["SHOWNAME"].ToString().Trim() != "")
|
|
{
|
|
js = dr["CODENAME"].ToString().Trim() + " | " + dr["SHOWNAME"].ToString().Trim();
|
|
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", dr["CODENAME"].ToString().Trim(), js);// dr["DEPTNAME"].ToString().Trim());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", "", "");
|
|
resultBuilder.Append("</complete>");
|
|
return resultBuilder.ToString().Replace("&", "&");
|
|
}
|
|
|
|
public XmlDocument GetDoc()
|
|
{
|
|
XmlDocument xmldoc = new XmlDocument();
|
|
string content = BuildXML();
|
|
try
|
|
{
|
|
xmldoc.LoadXml(content);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
return xmldoc;
|
|
}
|
|
}
|
|
}
|