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; }
///
/// 查询院系教室信息CollegeClassroomView
///
///
///
///
///
///
///
///
///
///
///
///
///
public IGridResultSet GetCollegeClassroomViewGrid(ConfiguretView configuretView, Guid? collegeCampusID, Guid? collegeID,
Guid? buildingsInfoID, string classroomName, int? classroomTypeID, int? isConcurrentUse, int? isReserve, int? isAvailable, int pageIndex, int pageSize)
{
Expression> 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(pageIndex, pageSize);
}
///
/// 查询院系教室信息List
///
///
///
///
///
///
///
///
///
///
///
public IList GetCollegeClassroomViewList(ConfiguretView configuretView, Guid? collegeCampusID, Guid? collegeID,
Guid? buildingsInfoID, string classroomName, int? classroomTypeID, int? isConcurrentUse, int? isReserve, int? isAvailable)
{
Expression> 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();
}
///
/// 查询对应的院系教室信息CollegeClassroomView(根据院系教室ID)
///
///
///
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);
}
}
///
/// 编辑(新增、修改)
///
///
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);
}
}
///
/// 院系教室信息批量新增(根据院系所信息选择教室信息新增)
///
///
///
///
public string CollegeClassroomBatchAdd(List 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 collegeClassroomInList = new List();
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(collegeClassroomInList);
if (success > 0 && fail <= 0)
{
tipMessage = success + "条";
}
else
{
tipMessage = success + "条," + fail + "条失败,原因:已存在相同的院系教室信息,请检查";
}
return tipMessage;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
///
/// 查询院系教室中未新增的教室信息ClassroomView
///
///
///
///
///
///
///
///
///
///
///
///
///
public IGridResultSet GetClassroomViewNoAddGrid(ConfiguretView configuretView, Guid? campusID, Guid? buildingsInfoID,
string classroomName, int? classroomTypeID, int? isConcurrentUse, int? isReserve, int? isAvailable, Guid? collegeID, int pageIndex, int pageSize)
{
//教室信息
Expression> 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> 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(pageIndex, pageSize);
}
///
/// 查询院系教室中未新增的教室信息List
///
///
///
///
///
///
///
///
///
///
///
public IList GetClassroomViewNoAddList(ConfiguretView configuretView, Guid? campusID, Guid? buildingsInfoID,
string classroomName, int? classroomTypeID, int? isConcurrentUse, int? isReserve, int? isAvailable, Guid? collegeID)
{
//教室信息
Expression> 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> 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();
}
///
/// 院系教室信息批量新增(根据院系教室信息CollegeClassroomView)
///
///
///
///
public string CollegeClassroomBatchAdd(List 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 collegeClassroomInList = new List();
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(collegeClassroomInList);
if (success > 0 && fail <= 0)
{
tipMessage = success + "条";
}
else
{
tipMessage = success + "条," + fail + "条失败,原因:已存在相同的院系教室信息,请检查";
}
return tipMessage;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
///
/// 查询未新增的院系教室信息CollegeClassroomView
///
///
///
///
///
///
///
///
///
///
///
///
///
public IGridResultSet GetCollegeClassroomViewNoAddGrid(ConfiguretView configuretView, Guid? buildingsInfoCampusID,
Guid? buildingsInfoID, string classroomName, int? classroomTypeID, int? isConcurrentUse, int? isReserve,
int? isAvailable, Guid? collegeID, int pageIndex, int pageSize)
{
//院系所信息
Expression> 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> 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(pageIndex, pageSize);
}
///
/// 查询未新增的院系教室信息List
///
///
///
///
///
///
///
///
///
///
///
public IList GetCollegeClassroomViewNoAddList(ConfiguretView configuretView, Guid? buildingsInfoCampusID,
Guid? buildingsInfoID, string classroomName, int? classroomTypeID, int? isConcurrentUse, int? isReserve,
int? isAvailable, Guid? collegeID)
{
//院系所信息
Expression> 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> 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();
}
///
/// 删除
///
///
///
public bool CollegeClassroomDelete(List collegeClassroomIDs)
{
try
{
UnitOfWork.Delete(x => collegeClassroomIDs.Contains(x.CollegeClassroomID));
UnitOfWork.Commit();
return true;
}
catch (Exception)
{
throw;
}
}
}
}