天津投入产出系统后端
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.

380 lines
10 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMFrameWork.Data;
using QMAPP.Entity.Sys;
using QMAPP.Entity.Sys.Entity;
using QMAPP.DAL.Sys;
using System.Collections;
using System.Data;
namespace QMAPP.BLL.Sys
{
/// 组织机构管理
/// 创建者:郭佳伟
/// 创建日期:2013.1.16
public class OrgaizationManageBLL : BaseBLL
{
#region 获取组织机构列表
/// <summary>
/// 获取组织机构列表
/// </summary>
/// <param name="condition">条件</param>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public DataPage GetList(Orgaization condition, DataPage page)
{
List<Orgaization> list = null;
try
{
new OrgaizationManageDAL().GetList(condition, page);
list = page.Result as List<Orgaization>;
foreach (Orgaization o in list)
{
o.ACTIVATEFLG =o.ACTIVATEFLG=="1"?"是":"否";
}
page.Result = list;
return page;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取组织机构树形列表
/// <summary>
/// 获取组织机构树形列表
/// </summary>
/// <returns>数据页</returns>
public List<Orgaization> GetSubTreeList(Orgaization orga)
{
try
{
return new OrgaizationManageDAL().GetSubTreeList(orga);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 判断组织机构编号及名称是否重复
/// <summary>
/// 判断组织机构编号及名称是否重复
/// </summary>
/// <param name="orga">组织机构信息</param>
/// <returns>true:已存在;fasel:不存在。</returns>
public bool ExistsOrga(Orgaization orga)
{
try
{
return new OrgaizationManageDAL().ExistsOrga(orga);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取组织机构数菜单列表
/// <summary>
/// 获取所有组织机构数菜单列表
/// </summary>
/// <param name="condition">条件</param>
/// <returns>同级别菜单列表</returns>
public List<Orgaization> GetAllList()
{
try
{
return new OrgaizationManageDAL().GetAllList();
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取组织机构信息
/// <summary>
/// 获取组织机构所有的权限
/// </summary>
/// <param name="condition">条件</param>
/// <returns>同级别菜单列表</returns>
public Orgaization GetOrgaAuthorityList(Orgaization orga)
{
try
{
return new OrgaizationManageDAL().GetOrgaAuthorityList(orga);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取组织机构信息
/// <summary>
/// 获取组织机构信息
/// </summary>
/// <param name="role">条件</param>
/// <returns>组织机构信息</returns>
public Orgaization Get(Orgaization orga)
{
return new OrgaizationManageDAL().Get(orga);
}
/// <summary>
/// 获取机构角色
/// </summary>
/// <param name="organ">获取条件</param>
/// <returns>机构角色</returns>
public Orgaization GetOrganRoleList(Orgaization organ)
{
return new OrgaizationManageDAL().GetOrganRoleList(organ);
}
#endregion
#region 插入组织机构与人员信息
/// <summary>
/// 插入组织机构与人员信息
/// </summary>
/// <param name="orga">组织机构与人员信息</param>
/// <returns>插入数</returns>
public int InsertOrgaUser(UserOrgaization userorga)
{
try
{
userorga.CreateTime = DateTime.Now;
userorga.CreateUser = userorga.CreateUser;
userorga.UpdateTime = userorga.CreateTime;
userorga.UpdateUser = userorga.UpdateUser;
return new OrgaizationManageDAL().InsertOrgaUser(userorga);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 插入组织机构信息
/// <summary>
/// 插入组织机构
/// </summary>
/// <param name="orga">组织机构信息</param>
/// <returns>插入数</returns>
public int Insert(Orgaization orga)
{
try
{
if (orga.OrgaAuthorityList != null)
{
foreach (OrgaizationAuthority a in orga.OrgaAuthorityList)
{
a.OrgaID = orga.OrgaID;
a.CreateUser = this.LoginUser.UserID;
a.UpdateUser = this.LoginUser.UserID;
}
}
if (orga.RoleList != null)
{
foreach (T_QM_ORGANROLE a in orga.RoleList)
{
a.ORGANID = orga.OrgaID;
a.CREATEUSER = this.LoginUser.UserID;
a.UPDATEUSER = this.LoginUser.UserID;
}
}
orga.CreateUser = this.LoginUser.UserID;
orga.UpdateUser = this.LoginUser.UserID;
return new OrgaizationManageDAL().Insert(orga);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 删除组织机构与人员的关系
/// <summary>
/// 删除组织机构与人员的关系
/// </summary>
/// <param name="role">组织机构信息</param>
/// <returns>删除个数</returns>
public int BatchDeleteOrgaUser(ArrayList users)
{
int count = 0;
try
{
foreach (string user in users)
{
count += this.DeleteOrgaUser(new UserOrgaization { UserID = user.Split(",".ToCharArray())[0], OrgaID = user.Split(",".ToCharArray())[1], IsMainOgra = user.Split(",".ToCharArray())[2] });
}
return count;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 删除组织机构与人员的关系
/// </summary>
/// <param name="role">组织机构信息</param>
/// <returns>删除行数</returns>
public int DeleteOrgaUser(UserOrgaization orga)
{
int count = 0;
try
{
count = new OrgaizationManageDAL().DeleteOrgaUser(orga);
return count;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 删除组织机构
/// <summary>
/// 删除组织机构信息
/// </summary>
/// <param name="role">组织机构信息</param>
/// <returns>删除个数</returns>
public int BatchDelete(ArrayList orgas)
{
int count = 0;
try
{
foreach (string orga in orgas)
{
count += this.Delete(new Orgaization { OrgaID = orga });
}
return count;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 删除组织机构信息
/// </summary>
/// <param name="role">组织机构信息</param>
/// <returns>删除行数</returns>
public int Delete(Orgaization orga)
{
int count = 0;
try
{
count = new OrgaizationManageDAL().Delete(orga);
return count;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 更新组织机构
/// <summary>
/// 更新组织机构
/// </summary>
/// <param name="role">组织机构信息</param>
/// <returns>更新个数</returns>
public int Update(Orgaization orga)
{
try
{
if (orga.OrgaAuthorityList != null)
{
foreach (OrgaizationAuthority a in orga.OrgaAuthorityList)
{
a.OrgaID = orga.OrgaID;
a.CreateUser = this.LoginUser.UserID;
a.UpdateUser = this.LoginUser.UserID;
}
}
if (orga.RoleList != null)
{
foreach (T_QM_ORGANROLE a in orga.RoleList)
{
a.ORGANID = orga.OrgaID;
a.CREATEUSER = this.LoginUser.UserID;
a.UPDATEUSER = this.LoginUser.UserID;
}
}
orga.UpdateUser = this.LoginUser.UserID;
orga.DelFlag = "0";
return new OrgaizationManageDAL().Update(orga);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取导出的数据
/// <summary>
/// 获取导出的数据
/// </summary>
/// <param name="condition">查询条件</param>
/// <returns>数据</returns>
public DataTable GetExportData(Orgaization condition)
{
return new OrgaizationManageDAL().GetExportData(condition);
}
#endregion
}
}