123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Linq.Expressions;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using EMIS.Utility;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using EMIS.ViewModel.SchedulingManage.SchedulingSettings;
- using EMIS.ViewModel.UniversityManage.ClassroomManage;
- using EMIS.DataLogic.SchedulingManage.SchedulingSettings;
- namespace EMIS.CommonLogic.SchedulingManage.SchedulingSettings
- {
- public class CollegeClassroomServices : BaseServices, ICollegeClassroomServices
- {
- public CollegeClassroomDAL CollegeClassroomDAL { get; set; }
- /// <summary>
- /// 查询院系教室信息CollegeClassroomView
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="collegeCampusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="buildingsInfoID"></param>
- /// <param name="classroomName"></param>
- /// <param name="classroomTypeID"></param>
- /// <param name="isConcurrentUse"></param>
- /// <param name="isReserve"></param>
- /// <param name="isAvailable"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<CollegeClassroomView> GetCollegeClassroomViewGrid(ConfiguretView configuretView, Guid? collegeCampusID, Guid? collegeID,
- Guid? buildingsInfoID, string classroomName, int? classroomTypeID, int? isConcurrentUse, int? isReserve, int? isAvailable, int pageIndex, int pageSize)
- {
- Expression<Func<ES_CollegeClassroom, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (collegeID.HasValue)
- {
- exp = exp.And(x => x.CollegeID == collegeID);
- }
- var query = CollegeClassroomDAL.GetCollegeClassroomViewQueryable(exp);
- if (collegeCampusID.HasValue)
- {
- query = query.Where(x => x.CollegeCampusID == collegeCampusID);
- }
- if (buildingsInfoID.HasValue)
- {
- query = query.Where(x => x.BuildingsInfoID == buildingsInfoID);
- }
- if (!string.IsNullOrEmpty(classroomName) && classroomName != "-1")
- {
- //教室名称
- query = query.Where(x => x.ClassroomName == classroomName);
- }
- if (classroomTypeID.HasValue)
- {
- //教室类型(模糊查询)
- query = query.Where(x => x.CF_ClassroomType.Select(w => w.ClassroomType).Contains(classroomTypeID));
- }
- if (isConcurrentUse.HasValue)
- {
- //可否多班教学
- if (isConcurrentUse.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsConcurrentUse == true);
- }
- if (isConcurrentUse.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsConcurrentUse != true);
- }
- }
- if (isReserve.HasValue)
- {
- //是否预留(排课用)
- if (isReserve.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsReserve == true);
- }
- if (isReserve.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsReserve != true);
- }
- }
- if (isAvailable.HasValue)
- {
- //是否可用
- if (isAvailable.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsAvailable == true);
- }
- if (isAvailable.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsAvailable != true);
- }
- }
-
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ThenBy(x => x.ClassroomCode.Length).ThenBy(x => x.ClassroomCode).ThenBy(x => x.RoomUseID)
- .ThenBy(x => x.BuildingsInfoCode.Length).ThenBy(x => x.BuildingsInfoCode)
- .ToGridResultSet<CollegeClassroomView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 查询院系教室信息List
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="collegeCampusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="buildingsInfoID"></param>
- /// <param name="classroomName"></param>
- /// <param name="classroomTypeID"></param>
- /// <param name="isConcurrentUse"></param>
- /// <param name="isReserve"></param>
- /// <param name="isAvailable"></param>
- /// <returns></returns>
- public IList<CollegeClassroomView> GetCollegeClassroomViewList(ConfiguretView configuretView, Guid? collegeCampusID, Guid? collegeID,
- Guid? buildingsInfoID, string classroomName, int? classroomTypeID, int? isConcurrentUse, int? isReserve, int? isAvailable)
- {
- Expression<Func<ES_CollegeClassroom, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (collegeID.HasValue)
- {
- exp = exp.And(x => x.CollegeID == collegeID);
- }
- var query = CollegeClassroomDAL.GetCollegeClassroomViewQueryable(exp);
- if (collegeCampusID.HasValue)
- {
- query = query.Where(x => x.CollegeCampusID == collegeCampusID);
- }
- if (buildingsInfoID.HasValue)
- {
- query = query.Where(x => x.BuildingsInfoID == buildingsInfoID);
- }
- if (!string.IsNullOrEmpty(classroomName) && classroomName != "-1")
- {
- //教室名称
- query = query.Where(x => x.ClassroomName == classroomName);
- }
- if (classroomTypeID.HasValue)
- {
- //教室类型(模糊查询)
- query = query.Where(x => x.CF_ClassroomType.Select(w => w.ClassroomType).Contains(classroomTypeID));
- }
- if (isConcurrentUse.HasValue)
- {
- //可否多班教学
- if (isConcurrentUse.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsConcurrentUse == true);
- }
- if (isConcurrentUse.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsConcurrentUse != true);
- }
- }
- if (isReserve.HasValue)
- {
- //是否预留(排课用)
- if (isReserve.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsReserve == true);
- }
- if (isReserve.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsReserve != true);
- }
- }
- if (isAvailable.HasValue)
- {
- //是否可用
- if (isAvailable.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsAvailable == true);
- }
- if (isAvailable.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsAvailable != true);
- }
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ThenBy(x => x.ClassroomCode.Length).ThenBy(x => x.ClassroomCode).ThenBy(x => x.RoomUseID)
- .ThenBy(x => x.BuildingsInfoCode.Length).ThenBy(x => x.BuildingsInfoCode).ToList();
- }
- /// <summary>
- /// 查询对应的院系教室信息CollegeClassroomView(根据院系教室ID)
- /// </summary>
- /// <param name="collegeClassroomID"></param>
- /// <returns></returns>
- public CollegeClassroomView GetCollegeClassroomView(Guid? collegeClassroomID)
- {
- try
- {
- var query = CollegeClassroomDAL.GetCollegeClassroomViewQueryable(x => x.CollegeClassroomID == collegeClassroomID).SingleOrDefault();
- return query;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 编辑(新增、修改)
- /// </summary>
- /// <param name="collegeClassroomView"></param>
- public void CollegeClassroomEdit(CollegeClassroomView collegeClassroomView)
- {
- try
- {
- //查询数据库进行验证
- var collegeClassroomVerify = CollegeClassroomDAL.CollegeClassroomRepository
- .GetList(x => x.CollegeClassroomID != collegeClassroomView.CollegeClassroomID
- && x.CollegeID == collegeClassroomView.CollegeID
- && x.ClassroomID == collegeClassroomView.ClassroomID).SingleOrDefault();
- if (collegeClassroomVerify == null)
- {
- //数据有误验证
- if (collegeClassroomView.CollegeClassroomID != Guid.Empty)
- {
- var collegeClassroom = CollegeClassroomDAL.CollegeClassroomRepository
- .GetList(x => x.CollegeClassroomID == collegeClassroomView.CollegeClassroomID).SingleOrDefault();
- if (collegeClassroom == null)
- {
- throw new Exception("数据有误,请核查。");
- }
- else
- {
- //表示修改
- collegeClassroom.CollegeID = collegeClassroomView.CollegeID;
- collegeClassroom.ClassroomID = collegeClassroomView.ClassroomID;
- SetModifyStatus(collegeClassroom);
- }
- }
- else
- {
- //表示新增
- var newCollegeClassroom = new ES_CollegeClassroom();
- newCollegeClassroom.CollegeClassroomID = Guid.NewGuid();
- newCollegeClassroom.CollegeID = collegeClassroomView.CollegeID;
- newCollegeClassroom.ClassroomID = collegeClassroomView.ClassroomID;
- SetNewStatus(newCollegeClassroom);
- UnitOfWork.Add(newCollegeClassroom);
- }
- }
- else
- {
- throw new Exception("已存在相同的院系教室信息,请核查。");
- }
- //事务提交
- UnitOfWork.Commit();
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 院系教室信息批量新增(根据院系所信息选择教室信息新增)
- /// </summary>
- /// <param name="classroomIDList"></param>
- /// <param name="collegeClassroomView"></param>
- /// <returns></returns>
- public string CollegeClassroomBatchAdd(List<Guid?> classroomIDList, CollegeClassroomView collegeClassroomView)
- {
- try
- {
- //查询对应的院系教室信息List
- var collegeClassroomList = CollegeClassroomDAL.CollegeClassroomRepository
- .GetList(x => classroomIDList.Contains(x.ClassroomID)).ToList();
- int success = 0; //成功
- int fail = 0; //失败
- string tipMessage = null; //提示消息
- List<ES_CollegeClassroom> collegeClassroomInList = new List<ES_CollegeClassroom>();
- foreach (var classroomID in classroomIDList)
- {
- var collegeClassroomVerify = collegeClassroomList.Where(x => x.CollegeID == collegeClassroomView.CollegeID
- && x.ClassroomID == classroomID).SingleOrDefault();
- if (collegeClassroomVerify == null)
- {
- //新增
- var newCollegeClassroom = new ES_CollegeClassroom();
- newCollegeClassroom.CollegeClassroomID = Guid.NewGuid();
- newCollegeClassroom.CollegeID = collegeClassroomView.CollegeID;
- newCollegeClassroom.ClassroomID = classroomID;
- SetNewStatus(newCollegeClassroom);
- collegeClassroomInList.Add(newCollegeClassroom);
- success++;
- }
- else
- {
- //表示已存在相同的院系教室信息
- fail++;
- }
- }
- //批量插入
- UnitOfWork.BulkInsert<ES_CollegeClassroom>(collegeClassroomInList);
- if (success > 0 && fail <= 0)
- {
- tipMessage = success + "条";
- }
- else
- {
- tipMessage = success + "条," + fail + "条失败,原因:已存在相同的院系教室信息,请检查";
- }
- return tipMessage;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询院系教室中未新增的教室信息ClassroomView
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="campusID"></param>
- /// <param name="buildingsInfoID"></param>
- /// <param name="classroomName"></param>
- /// <param name="classroomTypeID"></param>
- /// <param name="isConcurrentUse"></param>
- /// <param name="isReserve"></param>
- /// <param name="isAvailable"></param>
- /// <param name="collegeID"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<ClassroomView> GetClassroomViewNoAddGrid(ConfiguretView configuretView, Guid? campusID, Guid? buildingsInfoID,
- string classroomName, int? classroomTypeID, int? isConcurrentUse, int? isReserve, int? isAvailable, Guid? collegeID, int pageIndex, int pageSize)
- {
- //教室信息
- Expression<Func<CF_Classroom, bool>> expClassroom = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (buildingsInfoID.HasValue)
- {
- //建筑信息
- expClassroom = expClassroom.And(x => x.BuildingsInfoID == buildingsInfoID);
- }
- if (!string.IsNullOrEmpty(classroomName) && classroomName != "-1")
- {
- //教室名称
- expClassroom = expClassroom.And(x => x.Name == classroomName);
- }
- if (classroomTypeID.HasValue)
- {
- //教室类型(模糊查询)
- expClassroom = expClassroom.And(x => x.CF_ClassroomType.Select(w => w.ClassroomType).Contains(classroomTypeID));
- }
- if (isConcurrentUse.HasValue)
- {
- //可否多班教学
- if (isConcurrentUse.Value == (int)CF_GeneralPurpose.IsYes)
- {
- expClassroom = expClassroom.And(x => x.IsConcurrentUse == true);
- }
- if (isConcurrentUse.Value == (int)CF_GeneralPurpose.IsNo)
- {
- expClassroom = expClassroom.And(x => x.IsConcurrentUse != true);
- }
- }
- if (isAvailable.HasValue)
- {
- //是否可用
- if (isAvailable.Value == (int)CF_GeneralPurpose.IsYes)
- {
- expClassroom = expClassroom.And(x => x.IsAvailable == true);
- }
- if (isAvailable.Value == (int)CF_GeneralPurpose.IsNo)
- {
- expClassroom = expClassroom.And(x => x.IsAvailable != true);
- }
- }
-
- //院系教室
- Expression<Func<ES_CollegeClassroom, bool>> expCollegeClassroom = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (collegeID.HasValue)
- {
- expCollegeClassroom = expCollegeClassroom.And(x => x.CollegeID == collegeID);
- }
- var query = CollegeClassroomDAL.GetClassroomViewNoAddQueryable(expClassroom, expCollegeClassroom);
- if (campusID.HasValue)
- {
- //校区
- query = query.Where(x => x.CampusID == campusID);
- }
- if (isReserve.HasValue)
- {
- //是否预留(排课用)
- if (isReserve.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsReserve == true);
- }
- if (isReserve.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsReserve != true);
- }
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCampus(query)
- .OrderBy(x => x.CampusCode.Length).ThenBy(x => x.CampusCode)
- .ThenBy(x => x.Code.Length).ThenBy(x => x.Code)
- .ThenBy(x => x.RoomUseID).ToGridResultSet<ClassroomView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 查询院系教室中未新增的教室信息List
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="campusID"></param>
- /// <param name="buildingsInfoID"></param>
- /// <param name="classroomName"></param>
- /// <param name="classroomTypeID"></param>
- /// <param name="isConcurrentUse"></param>
- /// <param name="isReserve"></param>
- /// <param name="isAvailable"></param>
- /// <param name="collegeID"></param>
- /// <returns></returns>
- public IList<ClassroomView> GetClassroomViewNoAddList(ConfiguretView configuretView, Guid? campusID, Guid? buildingsInfoID,
- string classroomName, int? classroomTypeID, int? isConcurrentUse, int? isReserve, int? isAvailable, Guid? collegeID)
- {
- //教室信息
- Expression<Func<CF_Classroom, bool>> expClassroom = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (buildingsInfoID.HasValue)
- {
- //建筑信息
- expClassroom = expClassroom.And(x => x.BuildingsInfoID == buildingsInfoID);
- }
- if (!string.IsNullOrEmpty(classroomName) && classroomName != "-1")
- {
- //教室名称
- expClassroom = expClassroom.And(x => x.Name == classroomName);
- }
- if (classroomTypeID.HasValue)
- {
- //教室类型(模糊查询)
- expClassroom = expClassroom.And(x => x.CF_ClassroomType.Select(w => w.ClassroomType).Contains(classroomTypeID));
- }
- if (isConcurrentUse.HasValue)
- {
- //可否多班教学
- if (isConcurrentUse.Value == (int)CF_GeneralPurpose.IsYes)
- {
- expClassroom = expClassroom.And(x => x.IsConcurrentUse == true);
- }
- if (isConcurrentUse.Value == (int)CF_GeneralPurpose.IsNo)
- {
- expClassroom = expClassroom.And(x => x.IsConcurrentUse != true);
- }
- }
- if (isAvailable.HasValue)
- {
- //是否可用
- if (isAvailable.Value == (int)CF_GeneralPurpose.IsYes)
- {
- expClassroom = expClassroom.And(x => x.IsAvailable == true);
- }
- if (isAvailable.Value == (int)CF_GeneralPurpose.IsNo)
- {
- expClassroom = expClassroom.And(x => x.IsAvailable != true);
- }
- }
- //院系教室
- Expression<Func<ES_CollegeClassroom, bool>> expCollegeClassroom = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (collegeID.HasValue)
- {
- expCollegeClassroom = expCollegeClassroom.And(x => x.CollegeID == collegeID);
- }
- var query = CollegeClassroomDAL.GetClassroomViewNoAddQueryable(expClassroom, expCollegeClassroom);
- if (campusID.HasValue)
- {
- //校区
- query = query.Where(x => x.CampusID == campusID);
- }
- if (isReserve.HasValue)
- {
- //是否预留(排课用)
- if (isReserve.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsReserve == true);
- }
- if (isReserve.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsReserve != true);
- }
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCampus(query)
- .OrderBy(x => x.CampusCode.Length).ThenBy(x => x.CampusCode)
- .ThenBy(x => x.Code.Length).ThenBy(x => x.Code)
- .ThenBy(x => x.RoomUseID).ToList();
- }
- /// <summary>
- /// 院系教室信息批量新增(根据院系教室信息CollegeClassroomView)
- /// </summary>
- /// <param name="collegeClassroomViewList"></param>
- /// <param name="collegeClassroomView"></param>
- /// <returns></returns>
- public string CollegeClassroomBatchAdd(List<CollegeClassroomView> collegeClassroomViewList, CollegeClassroomView collegeClassroomView)
- {
- try
- {
- //查询对应的院系所信息IDList
- var collegeIDList = collegeClassroomViewList.Select(x => x.CollegeID).Distinct().ToList();
- //查询对应的院系教室信息List(暂时只匹配院系所信息ID)
- var collegeClassroomList = CollegeClassroomDAL.CollegeClassroomRepository
- .GetList(x => collegeIDList.Contains(x.CollegeID)).ToList();
- int success = 0; //成功
- int fail = 0; //失败
- string tipMessage = null; //提示消息
- List<ES_CollegeClassroom> collegeClassroomInList = new List<ES_CollegeClassroom>();
- foreach (var newCollegeClassroomView in collegeClassroomViewList)
- {
- var collegeClassroomVerify = collegeClassroomList.Where(x => x.CollegeID == newCollegeClassroomView.CollegeID
- && x.ClassroomID == newCollegeClassroomView.ClassroomID).SingleOrDefault();
- if (collegeClassroomVerify == null)
- {
- //新增
- var newCollegeClassroom = new ES_CollegeClassroom();
- newCollegeClassroom.CollegeClassroomID = newCollegeClassroomView.CollegeClassroomID;
- newCollegeClassroom.CollegeID = newCollegeClassroomView.CollegeID;
- newCollegeClassroom.ClassroomID = newCollegeClassroomView.ClassroomID;
- SetNewStatus(newCollegeClassroom);
- collegeClassroomInList.Add(newCollegeClassroom);
- success++;
- }
- else
- {
- //表示已存在相同的院系教室信息
- fail++;
- }
- }
- //批量插入
- UnitOfWork.BulkInsert<ES_CollegeClassroom>(collegeClassroomInList);
- if (success > 0 && fail <= 0)
- {
- tipMessage = success + "条";
- }
- else
- {
- tipMessage = success + "条," + fail + "条失败,原因:已存在相同的院系教室信息,请检查";
- }
- return tipMessage;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询未新增的院系教室信息CollegeClassroomView
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="buildingsInfoCampusID"></param>
- /// <param name="buildingsInfoID"></param>
- /// <param name="classroomName"></param>
- /// <param name="classroomTypeID"></param>
- /// <param name="isConcurrentUse"></param>
- /// <param name="isReserve"></param>
- /// <param name="isAvailable"></param>
- /// <param name="collegeID"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<CollegeClassroomView> GetCollegeClassroomViewNoAddGrid(ConfiguretView configuretView, Guid? buildingsInfoCampusID,
- Guid? buildingsInfoID, string classroomName, int? classroomTypeID, int? isConcurrentUse, int? isReserve,
- int? isAvailable, Guid? collegeID, int pageIndex, int pageSize)
- {
- //院系所信息
- Expression<Func<CF_College, bool>> expCollege = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expCollege = expCollege.And(x => x.CF_CollegeProfile.UnitCategoryID == (int)CF_UnitCategory.College);
- if (collegeID.HasValue)
- {
- expCollege = expCollege.And(x => x.CollegeID == collegeID);
- }
- //教室信息
- Expression<Func<CF_Classroom, bool>> expClassroom = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (buildingsInfoID.HasValue)
- {
- //建筑信息
- expClassroom = expClassroom.And(x => x.BuildingsInfoID == buildingsInfoID);
- }
- if (!string.IsNullOrEmpty(classroomName) && classroomName != "-1")
- {
- //教室名称
- expClassroom = expClassroom.And(x => x.Name == classroomName);
- }
- if (classroomTypeID.HasValue)
- {
- //教室类型(模糊查询)
- expClassroom = expClassroom.And(x => x.CF_ClassroomType.Select(w => w.ClassroomType).Contains(classroomTypeID));
- }
- if (isConcurrentUse.HasValue)
- {
- //可否多班教学
- if (isConcurrentUse.Value == (int)CF_GeneralPurpose.IsYes)
- {
- expClassroom = expClassroom.And(x => x.IsConcurrentUse == true);
- }
- if (isConcurrentUse.Value == (int)CF_GeneralPurpose.IsNo)
- {
- expClassroom = expClassroom.And(x => x.IsConcurrentUse != true);
- }
- }
- if (isAvailable.HasValue)
- {
- //是否可用
- if (isAvailable.Value == (int)CF_GeneralPurpose.IsYes)
- {
- expClassroom = expClassroom.And(x => x.IsAvailable == true);
- }
- if (isAvailable.Value == (int)CF_GeneralPurpose.IsNo)
- {
- expClassroom = expClassroom.And(x => x.IsAvailable != true);
- }
- }
- var query = CollegeClassroomDAL.GetCollegeClassroomViewNoAddQueryable(expCollege, expClassroom);
- if (buildingsInfoCampusID.HasValue)
- {
- query = query.Where(x => x.CampusID == buildingsInfoCampusID);
- }
- if (isReserve.HasValue)
- {
- //是否预留(排课用)
- if (isReserve.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsReserve == true);
- }
- if (isReserve.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsReserve != true);
- }
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCampus(GetQueryByDataRangeByCollege(query))
- .OrderBy(x => x.BuildingsInfoCode.Length).ThenBy(x => x.BuildingsInfoCode)
- .ThenBy(x => x.ClassroomCode.Length).ThenBy(x => x.ClassroomCode).ThenBy(x => x.RoomUseID)
- .ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ToGridResultSet<CollegeClassroomView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 查询未新增的院系教室信息List
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="buildingsInfoCampusID"></param>
- /// <param name="buildingsInfoID"></param>
- /// <param name="classroomName"></param>
- /// <param name="classroomTypeID"></param>
- /// <param name="isConcurrentUse"></param>
- /// <param name="isReserve"></param>
- /// <param name="isAvailable"></param>
- /// <param name="collegeID"></param>
- /// <returns></returns>
- public IList<CollegeClassroomView> GetCollegeClassroomViewNoAddList(ConfiguretView configuretView, Guid? buildingsInfoCampusID,
- Guid? buildingsInfoID, string classroomName, int? classroomTypeID, int? isConcurrentUse, int? isReserve,
- int? isAvailable, Guid? collegeID)
- {
- //院系所信息
- Expression<Func<CF_College, bool>> expCollege = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expCollege = expCollege.And(x => x.CF_CollegeProfile.UnitCategoryID == (int)CF_UnitCategory.College);
- if (collegeID.HasValue)
- {
- expCollege = expCollege.And(x => x.CollegeID == collegeID);
- }
- //教室信息
- Expression<Func<CF_Classroom, bool>> expClassroom = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (buildingsInfoID.HasValue)
- {
- //建筑信息
- expClassroom = expClassroom.And(x => x.BuildingsInfoID == buildingsInfoID);
- }
- if (!string.IsNullOrEmpty(classroomName) && classroomName != "-1")
- {
- //教室名称
- expClassroom = expClassroom.And(x => x.Name == classroomName);
- }
- if (classroomTypeID.HasValue)
- {
- //教室类型(模糊查询)
- expClassroom = expClassroom.And(x => x.CF_ClassroomType.Select(w => w.ClassroomType).Contains(classroomTypeID));
- }
- if (isConcurrentUse.HasValue)
- {
- //可否多班教学
- if (isConcurrentUse.Value == (int)CF_GeneralPurpose.IsYes)
- {
- expClassroom = expClassroom.And(x => x.IsConcurrentUse == true);
- }
- if (isConcurrentUse.Value == (int)CF_GeneralPurpose.IsNo)
- {
- expClassroom = expClassroom.And(x => x.IsConcurrentUse != true);
- }
- }
- if (isAvailable.HasValue)
- {
- //是否可用
- if (isAvailable.Value == (int)CF_GeneralPurpose.IsYes)
- {
- expClassroom = expClassroom.And(x => x.IsAvailable == true);
- }
- if (isAvailable.Value == (int)CF_GeneralPurpose.IsNo)
- {
- expClassroom = expClassroom.And(x => x.IsAvailable != true);
- }
- }
- var query = CollegeClassroomDAL.GetCollegeClassroomViewNoAddQueryable(expCollege, expClassroom);
- if (buildingsInfoCampusID.HasValue)
- {
- query = query.Where(x => x.CampusID == buildingsInfoCampusID);
- }
- if (isReserve.HasValue)
- {
- //是否预留(排课用)
- if (isReserve.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsReserve == true);
- }
- if (isReserve.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsReserve != true);
- }
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCampus(GetQueryByDataRangeByCollege(query))
- .OrderBy(x => x.BuildingsInfoCode.Length).ThenBy(x => x.BuildingsInfoCode)
- .ThenBy(x => x.ClassroomCode.Length).ThenBy(x => x.ClassroomCode).ThenBy(x => x.RoomUseID)
- .ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ToList();
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="collegeClassroomIDs"></param>
- /// <returns></returns>
- public bool CollegeClassroomDelete(List<Guid?> collegeClassroomIDs)
- {
- try
- {
- UnitOfWork.Delete<ES_CollegeClassroom>(x => collegeClassroomIDs.Contains(x.CollegeClassroomID));
- UnitOfWork.Commit();
- return true;
- }
- catch (Exception)
- {
- throw;
- }
- }
- }
- }
|