|
- using Learun.Util;
- using System;
- using System.Data;
- using System.Collections.Generic;
- using System.Linq;
- using Learun.Application.TwoDevelopment.EducationalAdministration;
-
- namespace Learun.Application.TwoDevelopment.LogisticsManagement
- {
- /// <summary>
- /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
- /// Copyright (c) 2013-2018 北京泉江科技有限公司
- /// 创 建:超级管理员
- /// 日 期:2019-04-26 15:02
- /// 描 述:学生宿舍管理
- /// </summary>
- public class AccommodationBLL : AccommodationIBLL
- {
- private AccommodationService accommodationService = new AccommodationService();
-
- #region 获取数据
-
- /// <summary>
- /// 获取页面显示列表数据
- /// <summary>
- /// <param name="queryJson">查询参数</param>
- /// <returns></returns>
- public IEnumerable<Acc_DormitoryBuildEntity> 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<Acc_DormitoryBuildEntity> GetDromStu(string keyValue)
- {
- try
- {
- return accommodationService.GetDromStu(keyValue);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
-
- public IEnumerable<Acc_DormitoryBuildEntity> GetBedListByRoomId(string RoomId)
- {
- try
- {
- return accommodationService.GetBedListByRoomId(RoomId);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
-
- public IEnumerable<Acc_DormitoryBuildEntity> GetAllList()
- {
- try
- {
- return accommodationService.GetAllList();
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
-
- public IEnumerable<Acc_DormitoryBuildEntity> GetClassifyList(Pagination paginationobj, string queryJson)
- {
- try
- {
- return accommodationService.GetClassifyList(paginationobj, queryJson);
- }
- 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);
- }
- }
-
- }
-
- public string GetParentBuildType(string keyValue)
- {
- try
- {
- return accommodationService.GetParentBuildType(keyValue);
-
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
-
- }
-
- /// <summary>
- /// 获取Acc_DormitoryBuild表实体数据
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- 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);
- }
- }
- }
-
- /// <summary>
- /// 获取Acc_DormitoryBuild表实体数据
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- 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);
- }
- }
- }
-
- /// <summary>
- /// 获取Acc_DormitoryBuild表实体数据
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- public List<Acc_DormitoryBuildEntity> GetList()
- {
- try
- {
- return accommodationService.GetSqlTree();
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
-
- public List<Acc_DormitoryBuildEntity> GetDept()
- {
- try
- {
- return accommodationService.GetDeptOrMajorOrClass("").Select(x => new Acc_DormitoryBuildEntity { Dept = x.Dept, DeptName = x.DeptName }).Distinct().ToList();
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
- public List<Acc_DormitoryBuildEntity> GetMajor(string strWhere)
- {
- try
- {
- return accommodationService.GetDeptOrMajorOrClass(strWhere).Select(x => new Acc_DormitoryBuildEntity { Major = x.Major, MajorName = x.MajorName }).Distinct().ToList();
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
- public List<Acc_DormitoryBuildEntity> GetClass(string strWhere)
- {
- try
- {
- return accommodationService.GetDeptOrMajorOrClass(strWhere).Select(x => new Acc_DormitoryBuildEntity { Class = x.Class, ClassName = x.ClassName }).Distinct().ToList();
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
-
- /// <summary>
- /// 获取左侧树形数据
- /// <summary>
- /// <returns></returns>
- public List<TreeModel> GetTree()
- {
- try
- {
- List<Acc_DormitoryBuildEntity> list = accommodationService.GetSqlTree();
- List<TreeModel> treeList = new List<TreeModel>();
- 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 = true,
- parentId = item.ParentID == null ? "" : item.ParentID,
- title = item.BuildType
-
- };
-
-
- treeList.Add(node);
-
-
- }
-
-
- return treeList.ToTree();
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
-
-
- public List<TreeModel> GetTreeNew()
- {
- try
- {
- List<Acc_DormitoryBuildEntity> list = accommodationService.GetSqlTreeNew();
- List<TreeModel> treeList = new List<TreeModel>();
- 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<TreeModel> GetClassifyTree()
- {
- try
- {
- List<Acc_DormitoryBuildEntity> list = accommodationService.GetClassifyTree();
- List<TreeModel> treeList = new List<TreeModel>();
- 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,
- title = string.IsNullOrEmpty(item.BuildType) ? "" : (Convert.ToInt32(item.BuildType) + 1).ToString(),
-
- };
-
-
- treeList.Add(node);
-
-
- }
-
-
- return treeList.ToTree();
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
-
-
- /// <summary>
- /// 根据父id 获取树形数据
- /// </summary>
- /// <param name="parentID"></param>
- /// <returns></returns>
- public List<TreeModel> GetTreeByParentID(string parentID)
- {
- try
- {
- DataTable list = accommodationService.GetTreeByParentId(parentID);
- List<TreeModel> treeList = new List<TreeModel>();
- 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);
- }
-
- }
- }
-
- /// <summary>
- /// 根据父id 获取树形数据
- /// </summary>
- /// <param name="parentID"></param>
- /// <returns></returns>
- 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<Acc_DormitoryBuildEntity> 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 提交数据
-
- /// <summary>
- /// 删除实体数据
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- public void DeleteEntity(string keyValue)
- {
- try
- {
- accommodationService.DeleteEntity(keyValue);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
-
-
- /// <summary>
- /// 删除实体数据
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- public void DeleteBed(string keyValue, string ParentID)
- {
- try
- {
- accommodationService.DeleteBed(keyValue, ParentID);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
-
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- 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);
- }
- }
- }
-
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- public void SaveBedEntity(string keyValue, string ParentID, Acc_DormitoryBuildEntity entity)
- {
- try
- {
- accommodationService.SaveBedEntity(keyValue, ParentID, entity);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
-
-
-
- /// <summary>
- /// 分配系
- /// </summary>
- /// <param name="keyValue"></param>
- /// <param name="entity"></param>
- public void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity, int type)
- {
- try
- {
- accommodationService.SaveDeptClass(keyValue, entity, type);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
-
- public string SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list)
- {
- try
- {
- return accommodationService.SaveRoom(RoomId, list);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
-
- /// <summary>
- /// 批量添加单元、楼层、宿舍、床位
- /// </summary>
- /// <param name="keyValue"></param>
- /// <param name="elementNum"></param>
- /// <param name="floorNum"></param>
- /// <param name="roomNum"></param>
- /// <param name="bedNum"></param>
- 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);
- }
- }
- }
-
-
- /// <summary>
- /// 随机分配床位给学生
- /// </summary>
- /// <param name="noNation">是否不许一个名族的在一起</param>
- /// <param name="noPlace">是否不许一个地方的在一起</param>
- 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);
- }
-
- }
- }
-
- public void SyncData()
- {
- try
- {
- accommodationService.SyncData();
-
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
-
- }
- }
-
- public (DataTable failDt, int snum, int fnum) ExecuteImportExcel(DataTable dt, string fileGuid)
- {
- try
- {
- return accommodationService.ExecuteImportExcel(dt, fileGuid);
-
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
-
- }
- }
-
-
- public List<ClassInfoEntity> GetClassNo(string MainClass)
- {
- try
- {
- return accommodationService.GetClassNo(MainClass).Select(x => new ClassInfoEntity { ClassNo = x.ClassNo, ClassName = x.ClassName }).ToList();
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
- #endregion
-
- }
- }
|