534 lines
19 KiB
C#
534 lines
19 KiB
C#
|
namespace BLL
|
|||
|
{
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Configuration;
|
|||
|
using System.Linq;
|
|||
|
using System.Web.Security;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
using Model;
|
|||
|
|
|||
|
public static class Sys_UserService
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// <20>û<EFBFBD><C3BB><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <param name="loginname"><3E><>½<EFBFBD><C2BD></param>
|
|||
|
/// <param name="password">δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
|||
|
/// <param name="rememberMe"><3E><>ס<EFBFBD>ҿ<EFBFBD><D2BF><EFBFBD></param>
|
|||
|
/// <param name="page"><3E><><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3></param>
|
|||
|
/// <returns><3E>Ƿ<EFBFBD><C7B7><EFBFBD>½<EFBFBD>ɹ<EFBFBD></returns>
|
|||
|
public static bool UserLogOn(string account, string password, bool rememberMe, System.Web.UI.Page page)
|
|||
|
{
|
|||
|
string https = ConfigurationManager.AppSettings["Https"];
|
|||
|
bool IsSuccess = false;
|
|||
|
password = EncryptionPassword(password);
|
|||
|
var q = from y in Funs.DB.Sys_User where y.Account.ToLower() == account.ToLower() select y;
|
|||
|
List<Model.Sys_User> x = null;
|
|||
|
ErrLogInfo.WriteLog($"q.Count={q.Count()}");
|
|||
|
if (q.Count() > 0)
|
|||
|
{
|
|||
|
x = (from y in Funs.DB.Sys_User
|
|||
|
where y.Account.ToLower() == account.ToLower() && y.IsPost == true
|
|||
|
&& y.Password == password
|
|||
|
select y).ToList();
|
|||
|
if (x.Any())
|
|||
|
{
|
|||
|
ErrLogInfo.WriteLog($"<22><>¼<EFBFBD>ɹ<EFBFBD>");
|
|||
|
FormsAuthentication.SetAuthCookie(account, false);
|
|||
|
Model.Sys_User s = x.First();
|
|||
|
page.Session[SessionName.CurrUser] = s;
|
|||
|
//page.Session.Timeout = 600;
|
|||
|
//if (rememberMe)
|
|||
|
//{
|
|||
|
// System.Web.HttpCookie u = new System.Web.HttpCookie("UserInfo");
|
|||
|
// u["username"] = account;
|
|||
|
// //u["password"] = null;
|
|||
|
// // Cookies<65><73><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊһ<CEAA><D2BB>.
|
|||
|
// u.Expires = DateTime.Now.AddYears(1);
|
|||
|
// if (https == "true")
|
|||
|
// {
|
|||
|
// u.Secure = true;
|
|||
|
// }
|
|||
|
// page.Response.Cookies.Add(u);
|
|||
|
//}
|
|||
|
//else
|
|||
|
//{
|
|||
|
// // <20><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD>û<EFBFBD><C3BB><EFBFBD>ʱ,Cookies<65><73><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>.
|
|||
|
// page.Response.Cookies["UserInfo"].Expires = DateTime.Now.AddDays(-1);
|
|||
|
// page.Response.Cookies["UserInfo"].Secure = true;
|
|||
|
//}
|
|||
|
IsSuccess = true;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return IsSuccess;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>½<EFBFBD><C2BD>ȡ<EFBFBD>û<EFBFBD><C3BB><EFBFBD>Ϣ
|
|||
|
/// </summary>
|
|||
|
/// <param name="account"></param>
|
|||
|
/// <param name="password"></param>
|
|||
|
/// <param name="rememberMe"></param>
|
|||
|
/// <param name="page"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public static bool ADUserLogOn(string account, bool rememberMe, System.Web.UI.Page page)
|
|||
|
{
|
|||
|
string https = ConfigurationManager.AppSettings["Https"];
|
|||
|
bool IsSuccess = false;
|
|||
|
var user = Funs.DB.Sys_User.FirstOrDefault(x => x.Account.ToLower() == account.ToLower() && x.IsPost == true);
|
|||
|
if (user != null)
|
|||
|
{
|
|||
|
FormsAuthentication.SetAuthCookie(account, false);
|
|||
|
page.Session[SessionName.CurrUser] = user;
|
|||
|
//if (rememberMe)
|
|||
|
//{
|
|||
|
// System.Web.HttpCookie u = new System.Web.HttpCookie("UserInfo");
|
|||
|
// u["username"] = account;
|
|||
|
// // u["password"] = null;
|
|||
|
// // Cookies<65><73><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊһ<CEAA><D2BB>.
|
|||
|
// u.Expires = DateTime.Now.AddYears(1);
|
|||
|
// if (https == "true")
|
|||
|
// {
|
|||
|
// u.Secure = true;
|
|||
|
// }
|
|||
|
// page.Response.Cookies.Add(u);
|
|||
|
//}
|
|||
|
//else
|
|||
|
//{
|
|||
|
// // <20><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD>û<EFBFBD><C3BB><EFBFBD>ʱ,Cookies<65><73><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>.
|
|||
|
// page.Response.Cookies["UserInfo"].Expires = DateTime.Now.AddDays(-1);
|
|||
|
//}
|
|||
|
|
|||
|
IsSuccess = true;
|
|||
|
}
|
|||
|
|
|||
|
return IsSuccess;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <param name="password"><3E><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
|||
|
/// <returns><3E><><EFBFBD>ܺ<EFBFBD><DCBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></returns>
|
|||
|
public static string EncryptionPassword(string password)
|
|||
|
{
|
|||
|
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>ȡ<EFBFBD>û<EFBFBD><C3BB><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <param name="unitId"><3E><>λid</param>
|
|||
|
/// <param name="phone"><3E>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD></param>
|
|||
|
/// <returns></returns>
|
|||
|
public static string GetEncryptionPassword(string account)
|
|||
|
{
|
|||
|
string passNo = string.Empty;
|
|||
|
if (!string.IsNullOrEmpty(account))
|
|||
|
{
|
|||
|
passNo += account.ToLower() + ".1234";
|
|||
|
}
|
|||
|
return EncryptionPassword(passNo);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>ȡ<EFBFBD>û<EFBFBD><C3BB><EFBFBD>Ϣ
|
|||
|
/// </summary>
|
|||
|
/// <param name="userId"><3E>û<EFBFBD>Id</param>
|
|||
|
/// <returns><3E>û<EFBFBD><C3BB><EFBFBD>Ϣ</returns>
|
|||
|
public static Model.Sys_User GetUsersByUserId(string userId)
|
|||
|
{
|
|||
|
Model.Sys_User m = Funs.DB.Sys_User.FirstOrDefault(e => e.UserId == userId);
|
|||
|
return m;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>ȡ<EFBFBD>û<EFBFBD><C3BB>˺<EFBFBD><CBBA>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <param name="userId"><3E>û<EFBFBD>id</param>
|
|||
|
/// <param name="account"><3E>˺<EFBFBD></param>
|
|||
|
/// <param name="projectId"><3E><>ĿID</param>
|
|||
|
/// <returns><3E>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD></returns>
|
|||
|
public static bool IsExistUserAccount(string userId, string account)
|
|||
|
{
|
|||
|
bool isExist = false;
|
|||
|
if (!string.IsNullOrEmpty(userId))
|
|||
|
{
|
|||
|
var user = Funs.DB.Sys_User.FirstOrDefault(x => x.Account == account && x.UserId != userId);
|
|||
|
if (user != null)
|
|||
|
{
|
|||
|
isExist = true;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
var user = Funs.DB.Sys_User.FirstOrDefault(x => x.Account == account);
|
|||
|
if (user != null)
|
|||
|
{
|
|||
|
isExist = true;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return isExist;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>ȡͬ<C8A1><CDAC>λ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <param name="userId"><3E>û<EFBFBD>id</param>
|
|||
|
/// <param name="userName"><3E>˺<EFBFBD></param>
|
|||
|
/// <param name="unitId"><3E><>ĿID</param>
|
|||
|
/// <returns><3E>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD></returns>
|
|||
|
//public static bool IsExistUserName(string userId, string userName)
|
|||
|
//{
|
|||
|
// bool isExist = false;
|
|||
|
// var name = Funs.DB.Sys_User.FirstOrDefault(x => x.UserName == userName && x.UserId != userId);
|
|||
|
// if (name != null)
|
|||
|
// {
|
|||
|
// isExist = true;
|
|||
|
// }
|
|||
|
// return isExist;
|
|||
|
//}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD>ݲ<EFBFBD><DDB2>Ż<EFBFBD>ȡ<EFBFBD>û<EFBFBD><C3BB><EFBFBD>Ϣ
|
|||
|
/// </summary>
|
|||
|
/// <param name="departId"></param>
|
|||
|
/// <returns></returns>
|
|||
|
//public static List<Model.Sys_User> GetUsersByDep(string departId)
|
|||
|
//{
|
|||
|
// return (from x in Funs.DB.Sys_User where x.DepartId == departId select x).ToList();
|
|||
|
//}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>ID<49><44>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <param name="userId"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public static string GetUserNameByUserId(string userId)
|
|||
|
{
|
|||
|
string userName = string.Empty;
|
|||
|
Model.Sys_User m = Funs.DB.Sys_User.FirstOrDefault(e => e.UserId == userId);
|
|||
|
if (m != null)
|
|||
|
{
|
|||
|
userName = m.UserName;
|
|||
|
}
|
|||
|
return userName;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <param name="userId"></param>
|
|||
|
/// <param name="password"></param>
|
|||
|
public static void UpdatePassword(string userId, string password)
|
|||
|
{
|
|||
|
Model.Sys_User m = Funs.DB.Sys_User.FirstOrDefault(e => e.UserId == userId);
|
|||
|
if (m != null)
|
|||
|
{
|
|||
|
m.Password = password;
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>Ϣ
|
|||
|
/// </summary>
|
|||
|
/// <param name="user"><3E><>Աʵ<D4B1><CAB5></param>
|
|||
|
public static void AddUser(Model.Sys_User user)
|
|||
|
{
|
|||
|
Model.Sys_User newUser = new Model.Sys_User();
|
|||
|
newUser.UserId = user.UserId;
|
|||
|
newUser.Account = user.Account;
|
|||
|
newUser.UserCode = user.UserCode;
|
|||
|
newUser.Password = user.Password;
|
|||
|
newUser.UserName = user.UserName;
|
|||
|
newUser.UnitId = user.UnitId;
|
|||
|
newUser.RoleId = user.RoleId;
|
|||
|
newUser.IsPost = user.IsPost;
|
|||
|
newUser.DepartId = user.DepartId;
|
|||
|
newUser.Email = user.Email;
|
|||
|
newUser.EmailPassword = user.EmailPassword;
|
|||
|
newUser.Phone = user.Phone;
|
|||
|
newUser.Remark = user.Remark;
|
|||
|
newUser.ActType = user.ActType;
|
|||
|
newUser.IsCTE = user.IsCTE;
|
|||
|
newUser.IsCalculated = user.IsCalculated;
|
|||
|
newUser.ChineseName = user.ChineseName;
|
|||
|
newUser.IsThirdParty = user.IsThirdParty;
|
|||
|
newUser.ManagerName = user.ManagerName;
|
|||
|
|
|||
|
Funs.DB.Sys_User.InsertOnSubmit(newUser);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><EFBFBD><DEB8><EFBFBD>Ա<EFBFBD><D4B1>Ϣ
|
|||
|
/// </summary>
|
|||
|
/// <param name="user"><3E><>Աʵ<D4B1><CAB5></param>
|
|||
|
public static void UpdateUser(Model.Sys_User user)
|
|||
|
{
|
|||
|
Model.Sys_User newUser = Funs.DB.Sys_User.FirstOrDefault(e => e.UserId == user.UserId);
|
|||
|
if (newUser != null)
|
|||
|
{
|
|||
|
newUser.Account = user.Account;
|
|||
|
newUser.UserCode = user.UserCode;
|
|||
|
//newUser.Password = user.Password;
|
|||
|
newUser.UserName = user.UserName;
|
|||
|
newUser.UnitId = user.UnitId;
|
|||
|
newUser.RoleId = user.RoleId;
|
|||
|
newUser.IsPost = user.IsPost;
|
|||
|
newUser.DepartId = user.DepartId;
|
|||
|
newUser.Email = user.Email;
|
|||
|
if (!String.IsNullOrEmpty(user.EmailPassword))
|
|||
|
{
|
|||
|
newUser.EmailPassword = user.EmailPassword;
|
|||
|
}
|
|||
|
newUser.Phone = user.Phone;
|
|||
|
newUser.Remark = user.Remark;
|
|||
|
newUser.ActType = user.ActType;
|
|||
|
newUser.IsCTE = user.IsCTE;
|
|||
|
newUser.IsCalculated = user.IsCalculated;
|
|||
|
newUser.ChineseName = user.ChineseName;
|
|||
|
newUser.IsThirdParty = user.IsThirdParty;
|
|||
|
newUser.ManagerName = user.ManagerName;
|
|||
|
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>û<EFBFBD><C3BB><EFBFBD>Ϣ
|
|||
|
/// </summary>
|
|||
|
/// <param name="userId"></param>
|
|||
|
public static void DeleteUserById(string userId)
|
|||
|
{
|
|||
|
Model.Sys_User u = Funs.DB.Sys_User.FirstOrDefault(e => e.UserId == userId);
|
|||
|
if (u != null)
|
|||
|
{
|
|||
|
Funs.DB.Sys_User.DeleteOnSubmit(u);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>ʺŻ<CABA>ȡ<EFBFBD>û<EFBFBD><C3BB><EFBFBD>Ϣ
|
|||
|
/// </summary>
|
|||
|
/// <param name="account"><3E>ʺ<EFBFBD></param>
|
|||
|
/// <returns><3E>û<EFBFBD><C3BB><EFBFBD>Ϣ</returns>
|
|||
|
public static Model.Sys_User GetUserByAccount(string account)
|
|||
|
{
|
|||
|
Model.Sys_User m = Funs.DB.Sys_User.FirstOrDefault(e => e.Account == account);
|
|||
|
return m;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD>ݲ<EFBFBD><DDB2>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>Ӧ<EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD><EFBFBD><EFBFBD>CTE<54>û<EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.Sys_User> GetUserListByDepartId(string departId)
|
|||
|
{
|
|||
|
var q = (from x in Funs.DB.Sys_User
|
|||
|
where x.IsPost == true && x.DepartId == departId
|
|||
|
&& x.IsCTE == true
|
|||
|
orderby x.UserName
|
|||
|
select x).ToList();
|
|||
|
return q;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>ID<49>жϸ<D0B6><CFB8>û<EFBFBD><C3BB>Ƿ<EFBFBD><C7B7><EFBFBD>CTE<54><45>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˹<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <param name="userId"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public static bool IsCTEAndCalculated(string userId)
|
|||
|
{
|
|||
|
bool isExist = false;
|
|||
|
var q = from x in Funs.DB.Sys_User
|
|||
|
where x.UserId==userId && x.IsCTE == true && x.IsCalculated == true
|
|||
|
orderby x.UserName
|
|||
|
select x;
|
|||
|
if (q.Count() > 0)
|
|||
|
{
|
|||
|
isExist = true;
|
|||
|
}
|
|||
|
return isExist;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD>ڸڵ<DAB8><DAB5>û<EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.Sys_User> GetUserList()
|
|||
|
{
|
|||
|
return (from x in Funs.DB.Sys_User where x.IsPost == true orderby x.UserName select x).ToList();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD>ݽ<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5>ڸ<EFBFBD><DAB8>û<EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static Model.Sys_User GetMaxUserByRoleId(string roleId)
|
|||
|
{
|
|||
|
return (from x in Funs.DB.Sys_User where x.IsPost == true && x.RoleId == roleId && (x.UserCode != "" && x.UserCode != null) orderby x.UserCode descending select x).FirstOrDefault();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
/// <param name="user"></param>
|
|||
|
public static void UpdateUserList(Model.Sys_User user)
|
|||
|
{
|
|||
|
Model.Sys_User newUser = Funs.DB.Sys_User.FirstOrDefault(e => e.Account == user.Account);
|
|||
|
if (newUser != null)
|
|||
|
{
|
|||
|
newUser.DepartId = user.DepartId;
|
|||
|
newUser.ManagerName = user.ManagerName;
|
|||
|
newUser.UserName = user.UserName;
|
|||
|
newUser.ChineseName = user.ChineseName;
|
|||
|
newUser.Email = user.Email;
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD>ݽ<EFBFBD>ɫid<69><64>ȡ<EFBFBD>û<EFBFBD><C3BB><EFBFBD>ͼ<EFBFBD>б<EFBFBD><D0B1><EFBFBD>Ϣ
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.View_Sys_Users> GetUserRoleIdViewList(string RoleId)
|
|||
|
{
|
|||
|
return (from x in Funs.DB.View_Sys_Users where x.IsPost == true && x.RoleId == RoleId orderby x.DepartName, x.UserName select x).ToList();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>ȡ<EFBFBD>û<EFBFBD><C3BB><EFBFBD>ͼ<EFBFBD>б<EFBFBD><D0B1><EFBFBD>Ϣ
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.View_Sys_Users> GetUserViewList()
|
|||
|
{
|
|||
|
return (from x in Funs.DB.View_Sys_Users where x.IsPost == true orderby x.DepartName, x.UserName select x).ToList();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>ȡCTE<54>û<EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.View_Sys_Users> GetCTEUser()
|
|||
|
{
|
|||
|
return (from x in Funs.DB.View_Sys_Users
|
|||
|
where x.IsPost == true && x.IsCTE==true
|
|||
|
orderby x.DepartName, x.UserName
|
|||
|
select x).ToList();
|
|||
|
}
|
|||
|
|
|||
|
public static void InitCTEUserDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
|||
|
{
|
|||
|
dropName.DataGroupField = "DepartName";
|
|||
|
dropName.DataValueField = "UserId";
|
|||
|
dropName.DataTextField = "UserName";
|
|||
|
dropName.DataSource = BLL.Sys_UserService.GetCTEUser();
|
|||
|
dropName.DataBind();
|
|||
|
if (isShowPlease)
|
|||
|
{
|
|||
|
Funs.FineUIPleaseSelect(dropName);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <param name="dropName"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
|||
|
/// <param name="isShowPlease"><3E>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ<EFBFBD><CABE>ѡ<EFBFBD><D1A1></param>
|
|||
|
public static void InitUserDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
|||
|
{
|
|||
|
dropName.DataGroupField = "DepartName";
|
|||
|
dropName.DataValueField = "UserId";
|
|||
|
dropName.DataTextField = "UserName";
|
|||
|
dropName.DataSource = BLL.Sys_UserService.GetUserViewList();
|
|||
|
dropName.DataBind();
|
|||
|
if (isShowPlease)
|
|||
|
{
|
|||
|
Funs.FineUIPleaseSelect(dropName);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static void InitUserDrpNA(FineUIPro.DropDownList dropName, bool isShowPlease)
|
|||
|
{
|
|||
|
dropName.DataGroupField = "DepartName";
|
|||
|
dropName.DataValueField = "UserId";
|
|||
|
dropName.DataTextField = "UserName";
|
|||
|
dropName.DataSource = BLL.Sys_UserService.GetUserViewList();
|
|||
|
dropName.DataBind();
|
|||
|
if (isShowPlease)
|
|||
|
{
|
|||
|
Funs.FineUINA(dropName);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>û<EFBFBD><C3BB><EFBFBD>Ϣ
|
|||
|
/// </summary>
|
|||
|
/// <param name="username"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public static Model.Sys_User GetUserByUserName(string username)
|
|||
|
{
|
|||
|
return Funs.DB.Sys_User.FirstOrDefault(e => e.UserName == username);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD>ID<49><44>ȡCTE<54>û<EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <param name="userId"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public static Model.View_Sys_Users GetCTEUserByUserId(string userId)
|
|||
|
{
|
|||
|
return Funs.DB.View_Sys_Users.FirstOrDefault(e => e.DepartName.Contains("CTE") && e.UserId == userId);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>Ż<EFBFBD><C5BB>û<EFBFBD>
|
|||
|
/// </summary>
|
|||
|
/// <param name="dropName"></param>
|
|||
|
/// <param name="isShowPlease"></param>
|
|||
|
public static void InitUserAndDepartDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
|||
|
{
|
|||
|
dropName.DataValueField = "ID";
|
|||
|
dropName.DataTextField = "Name";
|
|||
|
dropName.DataSource = (from x in Funs.DB.View_UserDropDownList orderby x.GroupId, x.Name select x).ToList();
|
|||
|
dropName.DataBind();
|
|||
|
if (isShowPlease)
|
|||
|
{
|
|||
|
Funs.FineUIPleaseSelect(dropName);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static void InitDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
|||
|
{
|
|||
|
dropName.DataValueField = "ID";
|
|||
|
dropName.DataTextField = "Name";
|
|||
|
dropName.DataSource = (from x in Funs.DB.View_UserDepartDropDownList orderby x.GroupId, x.Name select x).ToList();
|
|||
|
dropName.DataBind();
|
|||
|
if (isShowPlease)
|
|||
|
{
|
|||
|
Funs.FineUIPleaseSelect(dropName);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static void InitDrpNA(FineUIPro.DropDownList dropName, bool isShowPlease)
|
|||
|
{
|
|||
|
dropName.DataValueField = "ID";
|
|||
|
dropName.DataTextField = "Name";
|
|||
|
dropName.DataSource = (from x in Funs.DB.View_UserDepartDropDownList orderby x.GroupId, x.Name select x).ToList();
|
|||
|
dropName.DataBind();
|
|||
|
if (isShowPlease)
|
|||
|
{
|
|||
|
Funs.FineUINA(dropName);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|