using Learun.Util; using System; using System.Data; using System.Collections.Generic; using System.Linq; namespace Learun.Application.TwoDevelopment.LogisticsManagement { /// /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 /// Copyright (c) 2013-2018 北京泉江科技有限公司 /// 创 建:超级管理员 /// 日 期:2019-04-26 15:02 /// 描 述:学生宿舍管理 /// public class AccommodationBLL : AccommodationIBLL { private AccommodationService accommodationService = new AccommodationService(); #region 获取数据 /// /// 获取页面显示列表数据 /// /// 查询参数 /// public IEnumerable GetPageList(Pagination pagination, string queryJson) { try { return accommodationService.GetPageList(pagination, queryJson); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } public IEnumerable GetAllList() { try { return accommodationService.GetAllList(); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } public object GetDormitoryList() { try { return accommodationService.GetDormitoryList(); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } public object GetUnitList(string ParentID) { try { return accommodationService.GetUnitList(ParentID); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } public object GetFloorList(string parentID) { try { return accommodationService.GetFloorList(parentID); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } public object GetRoomList(string parentID) { try { return accommodationService.GetRoomList(parentID); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } public object GetBedList(string parentID) { try { return accommodationService.GetBedList(parentID); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } public string GetBuildType(string parentID) { try { return accommodationService.GetBuildType(parentID); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } /// /// 获取Acc_DormitoryBuild表实体数据 /// 主键 /// /// public Acc_DormitoryBuildEntity GetAcc_DormitoryBuildEntity(string keyValue) { try { return accommodationService.GetAcc_DormitoryBuildEntity(keyValue); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } /// /// 获取Acc_DormitoryBuild表实体数据 /// 主键 /// /// public Acc_DormitoryBuildEntity GetAcc_DormitoryBuildEntityByName(string name) { try { return accommodationService.GetAcc_DormitoryBuildEntityByName(name); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } /// /// 获取Acc_DormitoryBuild表实体数据 /// 主键 /// /// public List GetList() { try { return accommodationService.GetSqlTree(); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } /// /// 获取左侧树形数据 /// /// public List GetTree() { try { List list = accommodationService.GetSqlTree(); List treeList = new List(); foreach (Acc_DormitoryBuildEntity item in list) { TreeModel node = new TreeModel { id = item.ID.ToString(), text = item.Name.ToString(), value = item.ID.ToString(), showcheck = false, checkstate = 0, isexpand = false, parentId = item.ParentID == null ? "" : item.ParentID }; treeList.Add(node); } return treeList.ToTree(); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } public List GetTreeNew() { try { List list = accommodationService.GetSqlTreeNew(); List treeList = new List(); foreach (Acc_DormitoryBuildEntity item in list) { TreeModel node = new TreeModel { id = item.ID.ToString(), text = item.Name.ToString(), value = item.ID.ToString(), showcheck = false, checkstate = 0, isexpand = false, parentId = item.ParentID == null ? "" : item.ParentID }; treeList.Add(node); } return treeList.ToTree(); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } /// /// 根据父id 获取树形数据 /// /// /// public List GetTreeByParentID(string parentID) { try { DataTable list = accommodationService.GetTreeByParentId(parentID); List treeList = new List(); foreach (DataRow item in list.Rows) { TreeModel node = new TreeModel { id = item["id"].ToString(), text = item["name"].ToString(), value = item["id"].ToString(), showcheck = false, checkstate = 0, isexpand = true, parentId = item["parentid"].ToString() }; treeList.Add(node); } return treeList.ToTree(); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } /// /// 根据父id 获取树形数据 /// /// /// public string GetDormitoryInfoByPlanStuNo(string stuNo) { try { return accommodationService.GetDormitoryInfoByPlanStuNo(stuNo); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } public string GetDormitoryInfoByStuNo(string stuNo) { try { return accommodationService.GetDormitoryInfoByStuNo(stuNo); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } public bool MatchDormitoryInfo(string stuNo,string dormitory,string unit,string floor,string room,string bed ,List data) { try { return accommodationService.MatchDormitoryInfo(stuNo,dormitory,unit,floor,room,bed,data); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } #endregion #region 提交数据 /// /// 删除实体数据 /// 主键 /// /// public void DeleteEntity(string keyValue) { try { accommodationService.DeleteEntity(keyValue); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } /// /// 保存实体数据(新增、修改) /// 主键 /// /// public void SaveEntity(string keyValue, Acc_DormitoryBuildEntity entity) { try { accommodationService.SaveEntity(keyValue, entity); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } /// /// 批量添加单元、楼层、宿舍、床位 /// /// /// /// /// /// public void DormitoryAdd(string keyValue, int elementNum, int floorNum, int roomNum, int bedNum) { try { accommodationService.DormitoryAdd(keyValue, elementNum, floorNum, roomNum, bedNum); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } /// /// 随机分配床位给学生 /// /// 是否不许一个名族的在一起 /// 是否不许一个地方的在一起 public void Automatic_allocation_accommodation(bool noNation, bool noPlace) { try { accommodationService.Automatic_allocation_accommodation(noNation, noPlace, "1"); accommodationService.Automatic_allocation_accommodation(noNation, noPlace, "0"); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } } #endregion } }