|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897 |
- 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
-
- }
- }
|