using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FangYar.BLL.TBL
{
public class SysDeptBLL
{
private static readonly FangYar.IDAL.TBL.SysDeptIDAL dal = FangYar.DALFactory.Factory.GetSysDeptDAL();
///
/// 根据ID获取model
///
public FangYar.Model.TBL.TBL_SYS_DEPT_Model GetModelByID(string ID)
{
return dal.GetModelByID(ID);
}
///
/// 添加菜单
///
public bool Add(FangYar.Model.TBL.TBL_SYS_DEPT_Model model)
{
return dal.Add(model);
}
///
/// 删除
///
public bool Delete(string IDList)
{
return dal.Delete(IDList);
}
///
/// 编辑
///
public bool Edit(FangYar.Model.TBL.TBL_SYS_DEPT_Model model)
{
return dal.Edit(model);
}
///
/// 分页获取数据列表
///
public int GetRecordCount(string strWhere)
{
return dal.GetRecordCount(strWhere);
}
public List QueryList(int PageIndex, int PageSize, string strwhere, string order)
{
return dal.QueryList(PageIndex, PageSize, strwhere, order);
}
///
/// 添加部门
///
public bool AddDept(FangYar.Model.TBL.TBL_SYS_DEPT_Model model)
{
return dal.AddDept(model);
}
///
/// 修改部门信息
///
public bool EditDept(FangYar.Model.TBL.TBL_SYS_DEPT_Model model)
{
return dal.EditDept(model);
}
///
/// 删除部门
///
public int DelDept(string DeptList)
{
int deptCount = dal.GetEmpCount("DEPT_ID in(" + DeptList + ")");
if (0 == deptCount)
{
if (dal.DelDept(DeptList))
{
return 0;
}
else
{
return 2;
}
} if (0 < deptCount)
{
return 1;
}
return 2;
}
}
}