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
{
///
/// 用户管理逻辑层对象(单表操作示例程序)
/// 创建者:李炳海
/// 创建时间:2012.11.21
///
public class UserManageBLL1:BaseBLL
{
#region 插入用户信息
///
/// 插入用户信息
///
/// 用户信息
/// 插入行数
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;
}
}
///
/// 插入用户信息(主、子表)
///
/// 用户信息
/// 插入行数
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 更新用户信息
///
/// 更新用户信息
///
/// 用户信息
/// 更新行数
public int Update(UserInfo1 user)
{
int count = 0;
try
{
count = new UserManageDAL1().Update(user);
return count;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 删除用户信息
///
/// 删除用户信息
///
/// 用户列表
/// 删除用户数
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;
}
}
///
/// 删除用户信息
///
/// 用户信息
/// 删除行数
public int Delete(UserInfo1 user)
{
int count = 0;
try
{
count = new UserManageDAL1().Delete(user);
return count;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取单个用户信息
///
/// 获取单个用户信息
///
/// 查询条件
/// 用户信息
public UserInfo1 Get(UserInfo1 user)
{
try
{
return new UserManageDAL1().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(UserInfo1 user, DataPage page)
{
try
{
page = new UserManageDAL1().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(UserInfo1 user)
{
try
{
return new UserManageDAL1().GetExportData(user);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}