202 lines
6.2 KiB
C#
202 lines
6.2 KiB
C#
![]() |
using Epost.Common;
|
|||
|
using Epost.DAL;
|
|||
|
using Epost.Model;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace Epost.BLL
|
|||
|
{
|
|||
|
|
|||
|
public class UserBLL
|
|||
|
{
|
|||
|
OrdersDAL dal = new OrdersDAL();
|
|||
|
UserDAL usersDAL = new UserDAL();
|
|||
|
|
|||
|
#region 检测用户
|
|||
|
public string CheckUser(string username, string password)
|
|||
|
{
|
|||
|
string loginname = usersDAL.CheckUser(username, password);
|
|||
|
return loginname;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 添加用户
|
|||
|
public bool AddUser(string Id, string username, string password, string loginName, string admin,string lightcolor="")
|
|||
|
{
|
|||
|
password = EncryptHelper.EncryptMD5By32(password);
|
|||
|
bool dt = usersDAL.AddUser(Id, username, password, loginName, admin,lightcolor);
|
|||
|
return dt;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 根据条件查询用户
|
|||
|
public IList<UserModel> SelectUser(string userId, string userName, string loginName)
|
|||
|
{
|
|||
|
DataTable dt = usersDAL.SelectUser(userId, userName, loginName);
|
|||
|
IList<UserModel> User = ModelConvertHelper<UserModel>.ConvertToModel(dt);
|
|||
|
return User;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 根据用户名查询数据库是否有用户名
|
|||
|
public int SelectUserName(string userName, string Id)
|
|||
|
{
|
|||
|
int dt = usersDAL.SelectUserName(userName, Id);
|
|||
|
|
|||
|
return dt;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 根据用户名查询数据库是否有用户名
|
|||
|
public int SelectUserName2(string Id)
|
|||
|
{
|
|||
|
int dt = usersDAL.SelectUserName2(Id);
|
|||
|
|
|||
|
return dt;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 根据条件删除用户
|
|||
|
public bool DeleteUser(string strwhere)
|
|||
|
{
|
|||
|
bool dt = usersDAL.DeleteUser(strwhere);
|
|||
|
if (dt == true)
|
|||
|
{
|
|||
|
//记录日志
|
|||
|
|
|||
|
ErrorLogBLL logBLL = new ErrorLogBLL();
|
|||
|
ErrorLogModel error_model = new ErrorLogModel();
|
|||
|
error_model.Type = "3";
|
|||
|
error_model.Remark = "删除用户";
|
|||
|
logBLL.InsertErrorLog(error_model);
|
|||
|
}
|
|||
|
return dt;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 分页获取用户表列表
|
|||
|
/// <summary>
|
|||
|
/// 分页获取数据列表
|
|||
|
/// </summary>
|
|||
|
public List<Model.UserModel> GetUsesListByPage(string strWhere, string orderby, int pageSize, int pageIndex, out int recordCount)
|
|||
|
{
|
|||
|
int startIndex = 0;
|
|||
|
int endIndex = 0;
|
|||
|
if (pageIndex <= 0)
|
|||
|
pageIndex = 1;
|
|||
|
//计算查询的开始行数与结束行数
|
|||
|
startIndex = (pageIndex - 1) * pageSize ;
|
|||
|
endIndex = pageIndex * pageSize;
|
|||
|
return usersDAL.GetUsersListByPageByMySql(strWhere, orderby, startIndex, endIndex, out recordCount);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region 获取工号
|
|||
|
public string getUsercode(string block, string area)
|
|||
|
{
|
|||
|
DataTable userlist = usersDAL.getUsercode(block, area);
|
|||
|
if (userlist != null && userlist.Rows.Count > 0)
|
|||
|
{
|
|||
|
return userlist.Rows[0]["id"].ToString();
|
|||
|
}
|
|||
|
else {
|
|||
|
return "";
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 根据工号获取对应颜色
|
|||
|
public DataTable getUserColor(string usercode)
|
|||
|
{
|
|||
|
DataTable userlist = usersDAL.getUserColor(usercode);
|
|||
|
return userlist;
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
//绩效
|
|||
|
#region 分页显示绩效查询
|
|||
|
#region
|
|||
|
/// <summary>
|
|||
|
/// 分页显示绩效查询
|
|||
|
/// </summary>
|
|||
|
public List<Model.AddressstorageModel> GetPerformanceListByPage(string strWhere, string orderby, int pageSize, int pageIndex, out int recordCount)
|
|||
|
{
|
|||
|
int startIndex = 0;
|
|||
|
int endIndex = 0;
|
|||
|
if (pageIndex <= 0)
|
|||
|
pageIndex = 1;
|
|||
|
//计算查询的开始行数与结束行数
|
|||
|
startIndex = (pageIndex - 1) * pageSize + 1;
|
|||
|
endIndex = pageIndex * pageSize;
|
|||
|
return usersDAL.GetPerformanceByPage(strWhere, orderby, startIndex, endIndex, out recordCount);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region 绑定用户
|
|||
|
public bool AddUserArea(string Id, string username, string password, string loginName, string admin, string Area)
|
|||
|
{
|
|||
|
bool dt = false;
|
|||
|
try
|
|||
|
{
|
|||
|
dt = usersDAL.AddUserArea(Id, username, password, loginName, admin, Area);
|
|||
|
if (dt == true)
|
|||
|
{
|
|||
|
//记录日志
|
|||
|
|
|||
|
ErrorLogBLL logBLL = new ErrorLogBLL();
|
|||
|
ErrorLogModel error_model = new ErrorLogModel();
|
|||
|
error_model.Type = "3";
|
|||
|
|
|||
|
error_model.Remark = "人员录入: insert into Users(UserName,PassWord,LoginName,Role_Id,Area) values(" + username + "," + password +
|
|||
|
"," + loginName + "," + admin + "," + Area + ")";
|
|||
|
logBLL.InsertErrorLog(error_model);
|
|||
|
}
|
|||
|
return dt;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
ErrorLogBLL logBLL = new ErrorLogBLL();
|
|||
|
logBLL.SaveSysytemError("绑定用户", ex.ToString());
|
|||
|
return dt;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 获取一个人的所有的拣货和
|
|||
|
public DataTable GetUserNameNumber(string sql)
|
|||
|
{
|
|||
|
DataTable dt = usersDAL.GetUsernameNumber(sql);
|
|||
|
return dt;
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 获取一个人的所有的拣货次数
|
|||
|
public DataTable GetUserNameCount(string sql)
|
|||
|
{
|
|||
|
DataTable dt = usersDAL.GetUsernameCount(sql);
|
|||
|
return dt;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region 更新用户录入名字
|
|||
|
public bool UserInoutModify(string area, string id,
|
|||
|
string area_pre, string id_pre)
|
|||
|
{
|
|||
|
bool dt = usersDAL.UserInputModify(area,id,area_pre,id_pre);
|
|||
|
return dt;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
}
|