|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.Services;
|
|
|
|
|
using HomeService.DBHelper;
|
|
|
|
|
using HomeService.Models;
|
|
|
|
|
using HomeService.Utility;
|
|
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
|
|
|
|
|
|
|
namespace HomeService
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// HomeService 的摘要说明
|
|
|
|
|
/// </summary>
|
|
|
|
|
[WebService(Namespace = "http://tempuri.org/")]
|
|
|
|
|
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
|
|
|
|
[System.ComponentModel.ToolboxItem(false)]
|
|
|
|
|
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
|
|
|
|
|
// [System.Web.Script.Services.ScriptService]
|
|
|
|
|
public class HomeService : System.Web.Services.WebService
|
|
|
|
|
{
|
|
|
|
|
/*[WebMethod]
|
|
|
|
|
public static void StoreMemcachedForLogin(string codeName)
|
|
|
|
|
{
|
|
|
|
|
string codeNameStr = CacheHelper.Get("loginUser") as string;
|
|
|
|
|
if (codeName != "" && codeName != null)
|
|
|
|
|
{
|
|
|
|
|
if (codeNameStr == null)
|
|
|
|
|
{
|
|
|
|
|
CacheHelper.Set("loginUser", codeName, DateTime.Now.AddMinutes(4));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (codeNameStr.IndexOf(codeName) != -1)
|
|
|
|
|
{
|
|
|
|
|
//已经包含登录的CODENAME
|
|
|
|
|
CacheHelper.Replace("loginUser", codeNameStr, DateTime.Now.AddMinutes(4));
|
|
|
|
|
}
|
|
|
|
|
else if (codeNameStr.IndexOf(codeName) == -1)
|
|
|
|
|
{
|
|
|
|
|
//未包含登录的CODENAME
|
|
|
|
|
if (codeNameStr == "")
|
|
|
|
|
{
|
|
|
|
|
//写入memcache
|
|
|
|
|
CacheHelper.Set("loginUser", codeName, DateTime.Now.AddMinutes(4));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//覆盖memcache
|
|
|
|
|
CacheHelper.Replace("loginUser", codeNameStr + "|" + codeName, DateTime.Now.AddMinutes(4));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
[WebMethod]
|
|
|
|
|
public static void StoreMemcachedForUser(string codeName, string userid, string showName, string companyid, string companyCodeName, string companyName, string localcurr, string workflowMsg, string deptid, string deptName)
|
|
|
|
|
{
|
|
|
|
|
string _user = CacheHelper.Get(codeName) as string;
|
|
|
|
|
if (_user == null)
|
|
|
|
|
{
|
|
|
|
|
CacheHelper.Set(codeName, userid + "|" + showName + "|" + companyid + "|" + companyCodeName + "|" + companyName + "|" + localcurr + "|" + workflowMsg + "|" + deptid + "|" + deptName, DateTime.Now.AddHours(18));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CacheHelper.Replace(codeName, userid + "|" + showName + "|" + companyid + "|" + companyCodeName + "|" + companyName + "|" + localcurr + "|" + workflowMsg + "|" + deptid + "|" + deptName, DateTime.Now.AddHours(18));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[WebMethod]
|
|
|
|
|
public static void StoreMemcachedForCount(string codeName)//加入用户的codeName,正好用于查询用户信息
|
|
|
|
|
{
|
|
|
|
|
string gid = "";
|
|
|
|
|
string codename = "";
|
|
|
|
|
string showname = "";
|
|
|
|
|
string companyid = "";
|
|
|
|
|
string companycodename = "";
|
|
|
|
|
string companyname = "";
|
|
|
|
|
string localcurr = "";
|
|
|
|
|
string workflowmsg = "";
|
|
|
|
|
string deptname = "";
|
|
|
|
|
string deptid = "";
|
|
|
|
|
string templetid = "";
|
|
|
|
|
string linkurl = "";
|
|
|
|
|
string sql = "";
|
|
|
|
|
string userid = "";
|
|
|
|
|
|
|
|
|
|
#region opration
|
|
|
|
|
if (codeName != "")
|
|
|
|
|
{
|
|
|
|
|
List<MsTempletStructure> modInquire = new List<MsTempletStructure>();
|
|
|
|
|
modInquire = GetSQLForCount(codeName);
|
|
|
|
|
string _user = CacheHelper.Get(codeName) as string;
|
|
|
|
|
string[] _userArr = _user.Split('|');
|
|
|
|
|
|
|
|
|
|
userid = _userArr[0];
|
|
|
|
|
showname = _userArr[1];
|
|
|
|
|
companyid = _userArr[2];
|
|
|
|
|
companycodename = _userArr[3];
|
|
|
|
|
companyname = _userArr[4];
|
|
|
|
|
localcurr = _userArr[5];
|
|
|
|
|
workflowmsg = _userArr[6];
|
|
|
|
|
deptid = _userArr[7];
|
|
|
|
|
deptname = _userArr[8];
|
|
|
|
|
|
|
|
|
|
#region get templet
|
|
|
|
|
foreach (MsTempletStructure _templet in modInquire)
|
|
|
|
|
{
|
|
|
|
|
gid = _templet.GID;
|
|
|
|
|
companyid = _templet.COMPANYID;
|
|
|
|
|
templetid = _templet.TEMPLETID;
|
|
|
|
|
linkurl = _templet.LINKURL;
|
|
|
|
|
sql = _templet.SQL;
|
|
|
|
|
|
|
|
|
|
DataTable dt = new DataTable();
|
|
|
|
|
if (sql != "")
|
|
|
|
|
{
|
|
|
|
|
if (sql.IndexOf("\" + userid + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + userid + \"", userid);
|
|
|
|
|
else if (sql.IndexOf("\"+userid+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+userid+\"", userid);
|
|
|
|
|
if (sql.IndexOf("\" + codename + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + codename + \"", codename);
|
|
|
|
|
else if (sql.IndexOf("\"+codename+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+codename+\"", codename);
|
|
|
|
|
if (sql.IndexOf("\" + showname + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + showname + \"", showname);
|
|
|
|
|
else if (sql.IndexOf("\"+showname+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+showname+\"", showname);
|
|
|
|
|
if (sql.IndexOf("\" + companyid + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + companyid + \"", companyid);
|
|
|
|
|
else if (sql.IndexOf("\"+companyid+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+companyid+\"", companyid);
|
|
|
|
|
if (sql.IndexOf("\" + companycodename + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + companycodename + \"", companycodename);
|
|
|
|
|
else if (sql.IndexOf("\"+companycodename+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+companycodename+\"", companycodename);
|
|
|
|
|
if (sql.IndexOf("\" + companyname + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + companyname + \"", companyname);
|
|
|
|
|
else if (sql.IndexOf("\"+companyname+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+companyname+\"", companyname);
|
|
|
|
|
if (sql.IndexOf("\" + localcurr + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + localcurr + \"", localcurr);
|
|
|
|
|
else if (sql.IndexOf("\"+localcurr+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+localcurr+\"", localcurr);
|
|
|
|
|
if (sql.IndexOf("\" + workflowmsg + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + workflowmsg + \"", workflowmsg);
|
|
|
|
|
else if (sql.IndexOf("\"+workflowmsg+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+workflowmsg+\"", workflowmsg);
|
|
|
|
|
if (sql.IndexOf("\" + deptname + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + deptname + \"", deptname);
|
|
|
|
|
else if (sql.IndexOf("\"+deptname+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+deptname+\"", deptname);
|
|
|
|
|
if (sql.IndexOf("\" + deptgid + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + deptgid + \"", deptid);
|
|
|
|
|
else if (sql.IndexOf("\"+deptgid+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+deptgid+\"", deptid);
|
|
|
|
|
|
|
|
|
|
sql = "select (" + sql + ") as result";
|
|
|
|
|
dt = SqlHelper.ExecuteSql(sql);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
if (!CacheHelper.IsExists(gid + "|" + companyid + "|" + userid + "|" + templetid))
|
|
|
|
|
{
|
|
|
|
|
CacheHelper.Set(gid + "|" + companyid + "|" + userid + "|" + templetid, dt, DateTime.Now.AddMinutes(2));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CacheHelper.Replace(gid + "|" + companyid + "|" + userid + "|" + templetid, dt, DateTime.Now.AddMinutes(2));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[WebMethod]
|
|
|
|
|
public static void StoreMemcachedForList(string codeName)
|
|
|
|
|
{
|
|
|
|
|
string gid = "";
|
|
|
|
|
string codename = "";
|
|
|
|
|
string showname = "";
|
|
|
|
|
string companyid = "";
|
|
|
|
|
string companycodename = "";
|
|
|
|
|
string companyname = "";
|
|
|
|
|
string localcurr = "";
|
|
|
|
|
string workflowmsg = "";
|
|
|
|
|
string deptname = "";
|
|
|
|
|
string deptid = "";
|
|
|
|
|
string templetid = "";
|
|
|
|
|
string linkurl = "";
|
|
|
|
|
string sql = "";
|
|
|
|
|
string userid = "";
|
|
|
|
|
|
|
|
|
|
#region operation
|
|
|
|
|
if (codeName != "")
|
|
|
|
|
{
|
|
|
|
|
List<MsTempletStructure> modInquire = new List<MsTempletStructure>();
|
|
|
|
|
modInquire = GetSQLForList(codeName);
|
|
|
|
|
string _user = CacheHelper.Get(codeName) as string;
|
|
|
|
|
string[] _userArr = _user.Split('|');
|
|
|
|
|
|
|
|
|
|
userid = _userArr[0];
|
|
|
|
|
showname = _userArr[1];
|
|
|
|
|
companyid = _userArr[2];
|
|
|
|
|
companycodename = _userArr[3];
|
|
|
|
|
companyname = _userArr[4];
|
|
|
|
|
localcurr = _userArr[5];
|
|
|
|
|
workflowmsg = _userArr[6];
|
|
|
|
|
deptid = _userArr[7];
|
|
|
|
|
deptname = _userArr[8];
|
|
|
|
|
|
|
|
|
|
#region get templet
|
|
|
|
|
foreach (MsTempletStructure _templet in modInquire)
|
|
|
|
|
{
|
|
|
|
|
gid = _templet.GID;
|
|
|
|
|
companyid = _templet.COMPANYID;
|
|
|
|
|
templetid = _templet.TEMPLETID;
|
|
|
|
|
linkurl = _templet.LINKURL;
|
|
|
|
|
sql = _templet.SQL;
|
|
|
|
|
|
|
|
|
|
DataTable dt = new DataTable();
|
|
|
|
|
if (sql != "")
|
|
|
|
|
{
|
|
|
|
|
if (sql.IndexOf("\" + userid + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + userid + \"", userid);
|
|
|
|
|
else if (sql.IndexOf("\"+userid+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+userid+\"", userid);
|
|
|
|
|
if (sql.IndexOf("\" + codename + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + codename + \"", codename);
|
|
|
|
|
else if (sql.IndexOf("\"+codename+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+codename+\"", codename);
|
|
|
|
|
if (sql.IndexOf("\" + showname + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + showname + \"", showname);
|
|
|
|
|
else if (sql.IndexOf("\"+showname+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+showname+\"", showname);
|
|
|
|
|
if (sql.IndexOf("\" + companyid + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + companyid + \"", companyid);
|
|
|
|
|
else if (sql.IndexOf("\"+companyid+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+companyid+\"", companyid);
|
|
|
|
|
if (sql.IndexOf("\" + companycodename + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + companycodename + \"", companycodename);
|
|
|
|
|
else if (sql.IndexOf("\"+companycodename+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+companycodename+\"", companycodename);
|
|
|
|
|
if (sql.IndexOf("\" + companyname + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + companyname + \"", companyname);
|
|
|
|
|
else if (sql.IndexOf("\"+companyname+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+companyname+\"", companyname);
|
|
|
|
|
if (sql.IndexOf("\" + localcurr + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + localcurr + \"", localcurr);
|
|
|
|
|
else if (sql.IndexOf("\"+localcurr+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+localcurr+\"", localcurr);
|
|
|
|
|
if (sql.IndexOf("\" + workflowmsg + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + workflowmsg + \"", workflowmsg);
|
|
|
|
|
else if (sql.IndexOf("\"+workflowmsg+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+workflowmsg+\"", workflowmsg);
|
|
|
|
|
if (sql.IndexOf("\" + deptname + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + deptname + \"", deptname);
|
|
|
|
|
else if (sql.IndexOf("\"+deptname+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+deptname+\"", deptname);
|
|
|
|
|
if (sql.IndexOf("\" + deptgid + \"") != -1 && linkurl != ".") sql = sql.Replace("\" + deptgid + \"", deptid);
|
|
|
|
|
else if (sql.IndexOf("\"+deptgid+\"") != -1 && linkurl != ".") sql = sql.Replace("\"+deptgid+\"", deptid);
|
|
|
|
|
|
|
|
|
|
//sql = "select (" + sql + ") as result";
|
|
|
|
|
dt = SqlHelper.ExecuteSql(sql);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dt = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
if (!CacheHelper.IsExists(gid + "|" + companyid + "|" + userid + "|" + templetid))
|
|
|
|
|
{
|
|
|
|
|
CacheHelper.Set(gid + "|" + companyid + "|" + userid + "|" + templetid, dt, DateTime.Now.AddMinutes(2));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CacheHelper.Replace(gid + "|" + companyid + "|" + userid + "|" + templetid, dt, DateTime.Now.AddMinutes(2));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[WebMethod]
|
|
|
|
|
public static DataTable DeliveryMemcachedForCount(string gid, string codeName, string companyid, string userid, string templetid)
|
|
|
|
|
{
|
|
|
|
|
DataTable _delivery = new DataTable();
|
|
|
|
|
DataTable _de = CacheHelper.Get(gid + "|" + companyid + "|" + userid + "|" + templetid) as DataTable;
|
|
|
|
|
if (_de != null)
|
|
|
|
|
{
|
|
|
|
|
_delivery = CacheHelper.Get(gid + "|" + companyid + "|" + userid + "|" + templetid) as DataTable;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
StoreMemcachedForCount(codeName);
|
|
|
|
|
_delivery = CacheHelper.Get(gid + "|" + companyid + "|" + userid + "|" + templetid) as DataTable;
|
|
|
|
|
}
|
|
|
|
|
return _delivery;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[WebMethod]
|
|
|
|
|
public static DataTable DeliveryMemcachedImmediatelyForCount(string gid, string codeName, string companyid, string userid, string templetid)
|
|
|
|
|
{
|
|
|
|
|
DataTable _delivery = new DataTable();
|
|
|
|
|
StoreMemcachedForCount(codeName);
|
|
|
|
|
_delivery = CacheHelper.Get(gid + "|" + companyid + "|" + userid + "|" + templetid) as DataTable;
|
|
|
|
|
return _delivery;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[WebMethod]
|
|
|
|
|
public static DataTable DeliveryMemcachedForList(string gid, string codeName, string companyid, string userid, string templetid)
|
|
|
|
|
{
|
|
|
|
|
DataTable _delivery = new DataTable();
|
|
|
|
|
DataTable _de = CacheHelper.Get(gid + "|" + companyid + "|" + userid + "|" + templetid) as DataTable;
|
|
|
|
|
if (_de != null)
|
|
|
|
|
{
|
|
|
|
|
_delivery = CacheHelper.Get(gid + "|" + companyid + "|" + userid + "|" + templetid) as DataTable;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
StoreMemcachedForList(codeName);
|
|
|
|
|
_delivery = CacheHelper.Get(gid + "|" + companyid + "|" + userid + "|" + templetid) as DataTable;
|
|
|
|
|
}
|
|
|
|
|
return _delivery;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[WebMethod]
|
|
|
|
|
public static DataTable DeliveryMemcachedImmediatelyForList(string gid, string codeName, string companyid, string userid, string templetid)
|
|
|
|
|
{
|
|
|
|
|
DataTable _delivery = new DataTable();
|
|
|
|
|
StoreMemcachedForList(codeName);
|
|
|
|
|
_delivery = CacheHelper.Get(gid + "|" + companyid + "|" + userid + "|" + templetid) as DataTable;
|
|
|
|
|
return _delivery;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static List<MsTempletStructure> GetSQLForCount(string codeName)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
|
|
sql.AppendLine("select B.GID,B.COMPANYID,A.USERTEMPLETID as TEMPLETID,LINKURL,[SQL] from main_module as A ");
|
|
|
|
|
sql.AppendLine("left join user_templet as B on A.USERTEMPLETID=B.TEMPLETID ");
|
|
|
|
|
sql.AppendLine("where B.LINKURL is not NULL and B.LINKURL != '.' and B.LINKURL != '#' and B.SQL is not null ");
|
|
|
|
|
sql.AppendLine("and A.CREATEUSER=(select GID from [user] where CODENAME='" + codeName + "') and B.USERID=(select GID from [user] where CODENAME='" + codeName + "')");
|
|
|
|
|
return SetSQL(sql);
|
|
|
|
|
}
|
|
|
|
|
private static List<MsTempletStructure> GetSQLForList(string codeName)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
|
|
sql.AppendLine("select B.GID,B.COMPANYID,A.USERTEMPLETID as TEMPLETID,LINKURL,[SQL] from main_module as A ");
|
|
|
|
|
sql.AppendLine("left join user_templet as B on A.USERTEMPLETID=B.TEMPLETID ");
|
|
|
|
|
sql.AppendLine("where B.LINKURL is not NULL and B.LINKURL != '.' and B.LINKURL = '#' and B.SQL is not null ");
|
|
|
|
|
sql.AppendLine("and A.CREATEUSER=(select GID from [user] where CODENAME='" + codeName + "') and B.USERID=(select GID from [user] where CODENAME='" + codeName + "')");
|
|
|
|
|
return SetSQL(sql);
|
|
|
|
|
}
|
|
|
|
|
private static List<MsTempletStructure> SetSQL(StringBuilder sql)
|
|
|
|
|
{
|
|
|
|
|
var list = new List<MsTempletStructure>();
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, sql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
MsTempletStructure data = new MsTempletStructure();
|
|
|
|
|
#region Set DB data to Object
|
|
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
|
|
data.COMPANYID = Convert.ToString(reader["COMPANYID"]);
|
|
|
|
|
data.TEMPLETID = Convert.ToString(reader["TEMPLETID"]);
|
|
|
|
|
data.LINKURL = Convert.ToString(reader["LINKURL"]);
|
|
|
|
|
data.SQL = Convert.ToString(reader["SQL"]);
|
|
|
|
|
#endregion
|
|
|
|
|
list.Add(data);
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static List<Employee> GetUserInfo()
|
|
|
|
|
{
|
|
|
|
|
DataTable dt = new DataTable();
|
|
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
|
|
sql.AppendLine("select GID,USERNAME,CODENAME,SHOWNAME,PASSWORD from [user] ");
|
|
|
|
|
return SetUserInfo(sql);
|
|
|
|
|
}
|
|
|
|
|
private static List<Employee> SetUserInfo(StringBuilder sql)
|
|
|
|
|
{
|
|
|
|
|
var list = new List<Employee>();
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, sql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
Employee data = new Employee();
|
|
|
|
|
#region Set DB data to Object
|
|
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
|
|
data.USERNAME = Convert.ToString(reader["USERNAME"]);
|
|
|
|
|
data.CODENAME = Convert.ToString(reader["CODENAME"]);
|
|
|
|
|
data.SHOWNAME = Convert.ToString(reader["SHOWNAME"]);
|
|
|
|
|
data.PASSWORD = Convert.ToString(reader["PASSWORD"]);
|
|
|
|
|
#endregion
|
|
|
|
|
list.Add(data);
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|