using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMFrameWork.Data;
using QMAPP.Entity.Example;
using QMAPP.DAL;
using QMAPP.DAL.Example;
using QMAPP.BLL.Dict;
using QMAPP.Entity.Sys;
using QMAPP.BLL.Sys;
namespace QMAPP.BLL.Example
{
///
/// 用户管理逻辑层对象(单表操作示例程序)
/// 创建者:李炳海
/// 创建时间:2012.11.21
///
public class UserManageBLL:BaseBLL
{
#region 插入用户信息
///
/// 插入用户信息
///
/// 用户信息
/// 插入行数
public int Insert(UserInfo user)
{
int count = 0;
try
{
user.UserID = Guid.NewGuid().ToString();
count = new UserManageDAL().Insert(user);
return count;
}
catch (Exception ex)
{
throw ex;
}
}
///
/// 插入用户信息(主、子表)
///
/// 用户信息
/// 插入行数
public int InsertWithDetails(UserInfo user)
{
int count = 0;
try
{
user.UserID = Guid.NewGuid().ToString();
foreach (UserAndRole role in user.RoleList)
{
role.UserID = user.UserID;
}
count = new UserManageDAL().InsertWithDetails(user);
return count;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 更新用户信息
///
/// 更新用户信息
///
/// 用户信息
/// 更新行数
public int Update(UserInfo user)
{
int count = 0;
try
{
count = new UserManageDAL().Update(user);
return count;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 删除用户信息
///
/// 删除用户信息
///
/// 用户列表
/// 删除用户数
public int Delete(string[] users,UserInfo user)
{
int count = 0;
try
{
foreach (string userID in users)
{
count += this.Delete(new UserInfo {UserID=userID });
}
return count;
}
catch (Exception ex)
{
throw ex;
}
}
///
/// 删除用户信息
///
/// 用户信息
/// 删除行数
public int Delete(UserInfo user)
{
int count = 0;
try
{
count = new UserManageDAL().Delete(user);
return count;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取单个用户信息
///
/// 获取单个用户信息
///
/// 查询条件
/// 用户信息
public UserInfo Get(UserInfo user)
{
try
{
return new UserManageDAL().Get(user);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取用户列表
/////
///// 获取用户列表
/////
///// 查询条件
///// 用户列表
//public List GetList(UserInfo user)
//{
// try
// {
// return new UserManageDAL().GetList(user);
// }
// catch (Exception ex)
// {
// throw ex;
// }
//}
///
/// 获取用户列表(数据库端分页)
///
/// 查询条件
/// 数据页
public DataPage GetList(UserInfo user, DataPage page)
{
try
{
page = new UserManageDAL().GetMyList(user, page);
////处理字典信息
//DictManagerBLL dictBll = new DictManagerBLL(DictKind.Sex);
//List list=page.Result as List;
//foreach (UserInfo info in list)
//{
// //替换性别显示值
// info.Sex = dictBll.GetDictValue(info.Sex);
//}
return page;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取导出的数据
///
/// 获取导出的数据
///
/// 查询条件
/// 数据
public DataTable GetExportData(UserInfo user)
{
try
{
return new UserManageDAL().GetExportData(user);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}