You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
240 lines
5.8 KiB
240 lines
5.8 KiB
using System;
|
|
using System.Data;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using QMFrameWork.Data;
|
|
using QMAPP.FJC.Entity.Example;
|
|
using QMAPP.FJC.DAL;
|
|
using QMAPP.FJC.DAL.Example;
|
|
using QMAPP.BLL;
|
|
using QMAPP.BLL.Dict;
|
|
|
|
|
|
namespace QMAPP.FJC.BLL.Example
|
|
{
|
|
/// <summary>
|
|
/// 用户管理逻辑层对象(单表操作示例程序)
|
|
/// 创建者:李炳海
|
|
/// 创建时间:2012.11.21
|
|
/// </summary>
|
|
public class UserManageBLL1:BaseBLL
|
|
{
|
|
|
|
#region 插入用户信息
|
|
|
|
/// <summary>
|
|
/// 插入用户信息
|
|
/// </summary>
|
|
/// <param name="user">用户信息</param>
|
|
/// <returns>插入行数</returns>
|
|
public int Insert(UserInfo1 user)
|
|
{
|
|
int count = 0;
|
|
try
|
|
{
|
|
user.UserID = Guid.NewGuid().ToString();
|
|
count = new UserManageDAL1().Insert(user);
|
|
|
|
return count;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 插入用户信息(主、子表)
|
|
/// </summary>
|
|
/// <param name="user">用户信息</param>
|
|
/// <returns>插入行数</returns>
|
|
public int InsertWithDetails(UserInfo1 user)
|
|
{
|
|
int count = 0;
|
|
try
|
|
{
|
|
user.UserID = Guid.NewGuid().ToString();
|
|
|
|
foreach (UserAndRole1 role in user.RoleList)
|
|
{
|
|
role.UserID = user.UserID;
|
|
}
|
|
|
|
count = new UserManageDAL1().InsertWithDetails(user);
|
|
|
|
return count;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 更新用户信息
|
|
|
|
/// <summary>
|
|
/// 更新用户信息
|
|
/// </summary>
|
|
/// <param name="user">用户信息</param>
|
|
/// <returns>更新行数</returns>
|
|
public int Update(UserInfo1 user)
|
|
{
|
|
int count = 0;
|
|
try
|
|
{
|
|
count = new UserManageDAL1().Update(user);
|
|
|
|
return count;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 删除用户信息
|
|
|
|
/// <summary>
|
|
/// 删除用户信息
|
|
/// </summary>
|
|
/// <param name="users">用户列表</param>
|
|
/// <returns>删除用户数</returns>
|
|
public int Delete(string[] users,UserInfo1 user)
|
|
{
|
|
int count = 0;
|
|
try
|
|
{
|
|
foreach (string userID in users)
|
|
{
|
|
count += this.Delete(new UserInfo1 {UserID=userID });
|
|
}
|
|
|
|
return count;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除用户信息
|
|
/// </summary>
|
|
/// <param name="user">用户信息</param>
|
|
/// <returns>删除行数</returns>
|
|
public int Delete(UserInfo1 user)
|
|
{
|
|
int count = 0;
|
|
|
|
try
|
|
{
|
|
count = new UserManageDAL1().Delete(user);
|
|
return count;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 获取单个用户信息
|
|
|
|
/// <summary>
|
|
/// 获取单个用户信息
|
|
/// </summary>
|
|
/// <param name="user">查询条件</param>
|
|
/// <returns>用户信息</returns>
|
|
public UserInfo1 Get(UserInfo1 user)
|
|
{
|
|
try
|
|
{
|
|
return new UserManageDAL1().Get(user);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 获取用户列表
|
|
|
|
///// <summary>
|
|
///// 获取用户列表
|
|
///// </summary>
|
|
///// <param name="user">查询条件</param>
|
|
///// <returns>用户列表</returns>
|
|
//public List<UserInfo> GetList(UserInfo user)
|
|
//{
|
|
// try
|
|
// {
|
|
// return new UserManageDAL().GetList(user);
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// throw ex;
|
|
// }
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 获取用户列表(数据库端分页)
|
|
/// </summary>
|
|
/// <param name="user">查询条件</param>
|
|
/// <returns>数据页</returns>
|
|
public DataPage GetList(UserInfo1 user, DataPage page)
|
|
{
|
|
try
|
|
{
|
|
page = new UserManageDAL1().GetMyList(user, page);
|
|
|
|
////处理字典信息
|
|
//DictManagerBLL dictBll = new DictManagerBLL(DictKind.Sex);
|
|
//List<UserInfo> list=page.Result as List<UserInfo>;
|
|
//foreach (UserInfo info in list)
|
|
//{
|
|
// //替换性别显示值
|
|
// info.Sex = dictBll.GetDictValue(info.Sex);
|
|
//}
|
|
|
|
return page;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 获取导出的数据
|
|
|
|
/// <summary>
|
|
/// 获取导出的数据
|
|
/// </summary>
|
|
/// <param name="user">查询条件</param>
|
|
/// <returns>数据</returns>
|
|
public DataTable GetExportData(UserInfo1 user)
|
|
{
|
|
try
|
|
{
|
|
return new UserManageDAL1().GetExportData(user);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
}
|
|
|