349 lines
11 KiB
C#
349 lines
11 KiB
C#
/** 版本信息模板在安装目录下,可自行修改。
|
|
* admin_user.cs
|
|
*
|
|
* 功 能: N/A
|
|
* 类 名: admin_user
|
|
*
|
|
* Ver 变更日期 负责人 变更内容
|
|
* ───────────────────────────────────
|
|
* V0.01 2021/3/30 8:46:18 N/A 初版
|
|
*
|
|
* Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
|
|
*┌──────────────────────────────────┐
|
|
*│ 此技术信息为本公司机密信息,未经本公司书面同意禁止向第三方披露. │
|
|
*│ 版权所有:动软卓越(北京)科技有限公司 │
|
|
*└──────────────────────────────────┘
|
|
*/
|
|
using System;
|
|
using System.Data;
|
|
using System.Collections.Generic;
|
|
using Maticsoft.Common;
|
|
using DataService.Model;
|
|
using System.Web;
|
|
using System.IO;
|
|
|
|
namespace DataService.BLL
|
|
{
|
|
/// <summary>
|
|
/// admin_user
|
|
/// </summary>
|
|
public partial class admin_user
|
|
{
|
|
private readonly DataService.DAL.admin_user dal = new DataService.DAL.admin_user();
|
|
public admin_user()
|
|
{ }
|
|
#region BasicMethod
|
|
/// <summary>
|
|
/// 是否存在该记录
|
|
/// </summary>
|
|
public bool Exists(string user_id)
|
|
{
|
|
return dal.Exists(user_id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加一条数据
|
|
/// </summary>
|
|
public bool Add(DataService.Model.admin_user model)
|
|
{
|
|
return dal.Add(model);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新一条数据
|
|
/// </summary>
|
|
public bool Update(DataService.Model.admin_user model)
|
|
{
|
|
return dal.Update(model);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除一条数据
|
|
/// </summary>
|
|
public bool Delete(string user_id)
|
|
{
|
|
|
|
return dal.Delete(user_id);
|
|
}
|
|
/// <summary>
|
|
/// 删除一条数据
|
|
/// </summary>
|
|
public bool DeleteList(string user_idlist)
|
|
{
|
|
return dal.DeleteList(user_idlist);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 得到一个对象实体
|
|
/// </summary>
|
|
public DataService.Model.admin_user GetModel(string user_id)
|
|
{
|
|
|
|
return dal.GetModel(user_id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 得到一个对象实体,从缓存中
|
|
/// </summary>
|
|
public DataService.Model.admin_user GetModelByCache(string user_id)
|
|
{
|
|
|
|
string CacheKey = "admin_userModel-" + user_id;
|
|
object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
|
|
if (objModel == null)
|
|
{
|
|
try
|
|
{
|
|
objModel = dal.GetModel(user_id);
|
|
if (objModel != null)
|
|
{
|
|
int ModelCache = Maticsoft.Common.ConfigHelper.GetConfigInt("ModelCache");
|
|
Maticsoft.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero);
|
|
}
|
|
}
|
|
catch { }
|
|
}
|
|
return (DataService.Model.admin_user)objModel;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获得数据列表
|
|
/// </summary>
|
|
public DataSet GetList(string strWhere)
|
|
{
|
|
return dal.GetList(strWhere);
|
|
}
|
|
/// <summary>
|
|
/// 获得数据列表
|
|
/// </summary>
|
|
public List<DataService.Model.admin_user> GetModelList(string strWhere)
|
|
{
|
|
DataSet ds = dal.GetList(strWhere);
|
|
return DataTableToList(ds.Tables[0]);
|
|
}
|
|
/// <summary>
|
|
/// 获得数据列表
|
|
/// </summary>
|
|
public List<DataService.Model.admin_user> DataTableToList(DataTable dt)
|
|
{
|
|
List<DataService.Model.admin_user> modelList = new List<DataService.Model.admin_user>();
|
|
int rowsCount = dt.Rows.Count;
|
|
if (rowsCount > 0)
|
|
{
|
|
DataService.Model.admin_user model;
|
|
for (int n = 0; n < rowsCount; n++)
|
|
{
|
|
model = dal.DataRowToModel(dt.Rows[n]);
|
|
if (model != null)
|
|
{
|
|
modelList.Add(model);
|
|
}
|
|
}
|
|
}
|
|
return modelList;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获得数据列表
|
|
/// </summary>
|
|
public DataSet GetAllList()
|
|
{
|
|
return GetList("");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页获取数据列表
|
|
/// </summary>
|
|
public int GetRecordCount(string strWhere)
|
|
{
|
|
return dal.GetRecordCount(strWhere);
|
|
}
|
|
/// <summary>
|
|
/// 分页获取数据列表
|
|
/// </summary>
|
|
public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
|
|
{
|
|
return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
|
|
}
|
|
/// <summary>
|
|
/// 分页获取数据列表
|
|
/// </summary>
|
|
//public DataSet GetList(int PageSize,int PageIndex,string strWhere)
|
|
//{
|
|
//return dal.GetList(PageSize,PageIndex,strWhere);
|
|
//}
|
|
|
|
#endregion BasicMethod
|
|
#region ExtensionMethod
|
|
/// <summary>
|
|
/// 获取教员及管理员
|
|
/// </summary>
|
|
/// <param name="strWhere"></param>
|
|
/// <returns></returns>
|
|
public DataSet GetSysUsers(string strWhere)
|
|
{
|
|
return dal.GetSysUsers(strWhere);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取学员
|
|
/// </summary>
|
|
/// <param name="strWhere"></param>
|
|
/// <returns></returns>
|
|
public DataSet GetUsrUsers(string strWhere)
|
|
{
|
|
return dal.GetUsrUsers(strWhere);
|
|
}
|
|
|
|
///获取用户姓名
|
|
public static string get_real_name(string user_id)
|
|
{
|
|
if (string.IsNullOrEmpty(user_id))
|
|
return string.Empty;
|
|
string CacheKey = "admin_userModel-Name-" + user_id;
|
|
object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
|
|
if (objModel == null)
|
|
{
|
|
try
|
|
{
|
|
objModel = DataService.DAL.admin_user.get_real_name(user_id);
|
|
if (objModel != null)
|
|
{
|
|
int ModelCache = Maticsoft.Common.ConfigHelper.GetConfigInt("ModelCache");
|
|
Maticsoft.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero);
|
|
}
|
|
}
|
|
catch { }
|
|
}
|
|
return objModel.ToString();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 加载登录信息
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static DataService.Model.admin_user load_login()
|
|
{
|
|
DataService.Model.admin_user admin_cookie_user = new DataService.Model.admin_user();
|
|
HttpContext context = HttpContext.Current;
|
|
if (HttpContext.Current.Request.Cookies["admin_user_token"] != null)
|
|
{
|
|
if (HttpContext.Current.Request.Cookies["admin_user_token"].Values.Count > 1)
|
|
{
|
|
string tmpUid = HttpUtility.UrlDecode(HttpContext.Current.Request.Cookies["admin_user_token"].Values.Get(0)); ;
|
|
string user_desc = HttpContext.Current.Request.Cookies["admin_user_token"].Values.Get(1).Replace("'", "");
|
|
user_desc = HttpUtility.UrlDecode(user_desc);
|
|
string[] temp = user_desc.Split('|');
|
|
admin_cookie_user.user_id = temp[0];
|
|
admin_cookie_user.login_name = temp[1];
|
|
admin_cookie_user.real_name = temp[2];
|
|
//admin_cookie_user.grade = temp[3];
|
|
//admin_cookie_user.major = temp[4];
|
|
}
|
|
}
|
|
else
|
|
{
|
|
HttpContext.Current.Response.Redirect("~/Login.aspx");
|
|
}
|
|
return admin_cookie_user;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 是否存在该记录-按照工号查询
|
|
/// </summary>
|
|
public bool ExistsByJobNumber(string job_number)
|
|
{
|
|
return dal.ExistsByJobNumber(job_number);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 得到一个对象实体--根据工号
|
|
/// </summary>
|
|
public DataService.Model.admin_user GetModelByJobNumber(string job_number)
|
|
{
|
|
|
|
return dal.GetModelByJobNumber(job_number);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 得到一个对象实体
|
|
/// </summary>
|
|
public DataService.Model.admin_user GetUserModel(string strWhere)
|
|
{
|
|
return dal.GetUserModel(strWhere);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 得到一个对象实体,从缓存中
|
|
/// </summary>
|
|
public List<DataService.Model.admin_user> GetModelListByCache(string strWhere)
|
|
{
|
|
string CacheKey = "admin_userModelList";
|
|
object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
|
|
if (objModel == null)
|
|
{
|
|
try
|
|
{
|
|
objModel = GetModelList(strWhere);
|
|
if (objModel != null)
|
|
{
|
|
Maticsoft.Common.DataCache.SetCache(CacheKey, objModel);
|
|
}
|
|
}
|
|
catch { }
|
|
}
|
|
return (List<DataService.Model.admin_user>)objModel;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取运维人员的管理员
|
|
/// </summary>
|
|
/// <param name="strWhere"></param>
|
|
/// <returns></returns>
|
|
public List<DataService.Model.admin_user> GetDevUsers(string strWhere)
|
|
{
|
|
DataSet ds = dal.GetDevUsers(strWhere);
|
|
return DataTableToList(ds.Tables[0]);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获得数据列表
|
|
/// </summary>
|
|
public DataSet GetUserList(string strWhere)
|
|
{
|
|
return dal.GetUserList(strWhere);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 使用事务批量操作删除
|
|
/// </summary>
|
|
/// <param name="user_id">要删除的用户id</param>
|
|
/// <returns></returns>
|
|
public int OperationData(string user_id)
|
|
{
|
|
return dal.OperationData(user_id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 枚举字段值
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<string> GetUnitValues()
|
|
{
|
|
List<string> list = new List<string>();
|
|
var dt = dal.GetUnitValues().Tables[0];
|
|
int rowsCount = dt.Rows.Count;
|
|
for (int n = 0; n < rowsCount; n++)
|
|
{
|
|
var row = dt.Rows[n];
|
|
var value = row[0].ToString();
|
|
list.Add(value);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
#endregion ExtensionMethod
|
|
}
|
|
}
|
|
|