Browse Source

学生宿舍管理调整列表

西昌缴费二期
zhangli 2 years ago
parent
commit
c6edfa2328
5 changed files with 79 additions and 560 deletions
  1. +20
    -28
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.cshtml
  2. +45
    -248
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.js
  3. +1
    -13
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/Acc_DormitoryBuildEntity.cs
  4. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs
  5. +12
    -270
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs

+ 20
- 28
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.cshtml View File

@@ -3,7 +3,6 @@
Layout = "~/Views/Shared/_Form.cshtml";
}
<div class="lr-form-wrap">
@*<input value="@ViewBag.BuildType"/>*@
@if (ViewBag.ParentID != null)
{
<div class="col-xs-12 lr-form-item" data-table="Acc_DormitoryBuild">
@@ -36,17 +35,17 @@
<div id="Campus"></div>
</div>
@*<div class="col-xs-6 lr-form-item" data-table="Acc_DormitoryBuild">
<div class="lr-form-item-title">系</div>
<div id="Dept"></div>
</div>
<div class="col-xs-6 lr-form-item" data-table="Acc_DormitoryBuild">
<div class="lr-form-item-title">专业</div>
<div id="Major"></div>
</div>
<div class="col-xs-6 lr-form-item" data-table="Acc_DormitoryBuild">
<div class="lr-form-item-title">班级</div>
<div id="Class"></div>
</div>*@
<div class="lr-form-item-title">系</div>
<div id="Dept"></div>
</div>
<div class="col-xs-6 lr-form-item" data-table="Acc_DormitoryBuild">
<div class="lr-form-item-title">专业</div>
<div id="Major"></div>
</div>
<div class="col-xs-6 lr-form-item" data-table="Acc_DormitoryBuild">
<div class="lr-form-item-title">班级</div>
<div id="Class"></div>
</div>*@
<div class="col-xs-6 lr-form-item" data-table="Acc_DormitoryBuild">
<div class="lr-form-item-title">负责人</div>
<input id="Functionary" type="text" class="form-control" />
@@ -59,14 +58,13 @@
<div class="lr-form-item-title">价格</div>
<input id="Price" type="text" class="form-control" />
</div>
@*<div class="col-xs-6 lr-form-item" data-table="Acc_DormitoryBuild">
<div class="lr-form-item-title">顺序</div>
<input id="sort" type="number" class="form-control"/>
</div>*@
<div class="col-xs-6 lr-form-item" data-table="Acc_DormitoryBuild">
<div class="lr-form-item-title">顺序</div>
<input id="sort" type="number" class="form-control"/>
</div>

@if (ViewBag.BuildType == "3")
@if (ViewBag.BuildType == "4")
{
//寝室信息
<div class="col-xs-6 lr-form-item" data-table="Acc_DormitoryBuild">
<div class="lr-form-item-title">性别</div>
<div id="Sex"></div>
@@ -76,8 +74,8 @@
<input id="Leader" type="text" class="form-control" />
</div>
<div class="col-xs-6 lr-form-item" data-table="Acc_DormitoryBuild">
<div class="lr-form-item-title">几人寝<font face="宋体">*</font></div>
<input id="RoomType" type="number" class="form-control" isvalid="yes" checkexpession="NotNull"/>
<div class="lr-form-item-title">学生名字</div>
<input id="StudentID" type="text" class="form-control" />
</div>
<div class="col-xs-6 lr-form-item" data-table="Acc_DormitoryBuild">
<div class="lr-form-item-title">星级</div>
@@ -88,16 +86,10 @@
<div id="HasToilet"></div>
</div>
}
@if (ViewBag.BuildType == "4")
{
<div class="col-xs-6 lr-form-item" data-table="Acc_DormitoryBuild">
<div class="lr-form-item-title">学生名字</div>
<input id="StudentID" type="text" class="form-control" />
</div>
}

<div class="col-xs-12 lr-form-item" data-table="Acc_DormitoryBuild">
<div class="lr-form-item-title">备注</div>
<textarea id="Remark" class="form-control" style="height: 100px;"></textarea>
<textarea id="Remark" class="form-control" style="height:100px;"></textarea>
</div>
</div>
@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Accommodation/Form.js")

+ 45
- 248
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.js View File

@@ -14,113 +14,17 @@ var bootstrap = function ($, learun) {
page.initGird();
page.search({ ParentID: '' });
page.bind();
},
bind: function () {

$('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
page.search(queryJson);
}, 420, 400);
//宿舍楼
$('#ApartmentId').lrselect({
allowSearch: true,
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DormitoryInfo',
param: { strWhere: " BuildType='1' " },
value: "id",
text: "name",
select: function (item) {
if (!!item) {
//单元
$('#UnitId').lrselectRefresh({
allowSearch: true,
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DormitoryInfo',
param: { strWhere: " BuildType='2' and ApartmentId='" + item.id + "'" },
value: "id",
text: "name",
select: function (item) {
if (!!item) {
//楼层
$('#FloorId').lrselectRefresh({
allowSearch: true,
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DormitoryInfo',
param: { strWhere: " BuildType='3' and UnitId='" + item.id + "'" },
value: "id",
text: "name"
});
}
}
});
}
}
});
$('#UnitId').lrselect({ allowSearch: true });
$('#FloorId').lrselect({ allowSearch: true });

$('#Sex').lrDataItemSelect({ code: 'usersex' });
//.lrRadioCheckbox({
// type: 'radio',
// code: 'usersex',
//});

$('#Class').lrselect({
value: "classno",
text: "classname"
});

$('#Dept').lrselect({
value: "deptno",
text: "deptname",
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdDeptInfo',
select: function (item) {
if (item) {
$('#Major').lrselectRefresh({
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
param: { code: "CdMajorInfo", strWhere: "DeptNo='" + item.deptno + "'" }
});
}
else {
$('#Major').lrselectRefresh({
url: "",
data: []
});
}
$('#Class').lrselectRefresh({
url: "",
data: []
});
}
}, 220, 400);
$('#Sex').lrRadioCheckbox({
type: 'radio',
code: 'usersex',
});
$('#Major').lrselect({
value: "majorno",
text: "majorname",
select: function (item) {
if (item) {
$('#Class').lrselectRefresh({
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
param: { code: "bjsj", strWhere: "DeptNo='" + item.deptno + "' and majorno='" + item.majorno + "'" }
});
}

}
});


$('#Major').on("click",
function () {
var data = $('#Dept').lrselectGet();
if (!data) {
learun.alert.error('请先选择系');
}
});
$('#Class').on("click",
function () {
var data1 = $('#Dept').lrselectGet();
var data2 = $('#Major').lrselectGet();
if (!data1 || !data2) {
learun.alert.error('请先选择系和专业');
}
});

// 刷新
$('#lr_refresh').on('click', function () {
location.reload();
@@ -288,7 +192,7 @@ var bootstrap = function ($, learun) {
nodeClick: function (item) {
selectedParent.ID = item.value;
selectedParent.Name = item.text;
selectedParent.BuildType = item.title;
if (item.parent) {
if (!item.parent.parentId) {
selectedParent.ChildType = "2";
@@ -302,24 +206,13 @@ var bootstrap = function ($, learun) {
if (item.text.indexOf("室") > -1) {
selectedParent.ChildType = "5";
}
var param = {};
if (item.title == '1')
param.ApartmentId = item.value;
else if (item.title == '2')
param.UnitId = item.value;
else if (item.title == '3')
param.FloorId = item.value;
//page.initGird();
//page.search({ ParentID: item.value });
page.search(param);
page.initGird();
page.search({ ParentID: item.value });
}
});
},
// 初始化列表
initGird: function () {
//宿舍数据
$('#gridtable').jfGrid({
url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList',
headData: [
@@ -328,11 +221,9 @@ var bootstrap = function ($, learun) {
label: "宿舍楼", name: "ApartmentName", width: 100, align: "left"
},
{
label: "单元", name: "UnitName", width: 100, align: "left"
},
label: "单元", name: "UnitName", width: 100, align: "left" },
{
label: "楼层", name: "FloorName", width: 100, align: "left"
},
label: "楼层", name: "FloorName", width: 100, align: "left" },
//{
// label: "学生", name: "StudentID", width: 100, align: "left",
// formatterAsync: function (callback, value, row, op, $cell) {
@@ -389,26 +280,16 @@ var bootstrap = function ($, learun) {
}
},
{ label: "班级", name: "Class", width: 100, align: "left" },
{
label: "寝室类型", name: "RoomType", width: 100, align: "left",
formatter: function (value, row) {
if (value) {
return value + '人寝';
} else {
return '';
}
}
},
{ label: "入住人数", name: "CheckInStu", width: 100, align: "left" },
{
label: "性别", name: "Sex", width: 100, align: "left",
formatter: function (value, row) {
if (value == '0')
return '女';
else if (value == '1')
return '男';
else
return '';
formatterAsync: function (callback, value, row, op, $cell) {
learun.clientdata.getAsync('dataItem', {
key: value,
code: 'usersex',
callback: function (_data) {
callback(_data.text);
}
});
}
},
{ label: "负责人", name: "Functionary", width: 100, align: "left" },
@@ -420,142 +301,58 @@ var bootstrap = function ($, learun) {
isMultiselect: true,
sidx: 'ApartmentId asc,UnitId asc ,FloorId asc ',
//sord: 'ASC',
isSubGrid: true, // 是否有子表
subGridExpanded: function (subContentId, rowItem) {
$('#' + subContentId).jfGrid({
url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetBedListByRoomId?RoomId=' + rowItem.ID,
headData: [
{ label: "名称", name: "Name", width: 100, align: "left" },
{
label: "学生", name: "StudentID", width: 100, align: "left",
formatterAsync: function (callback, value, row, op, $cell) {
learun.clientdata.getAsync('custmerData', {
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic',
key: value,
keyId: 'stuid',
callback: function (_data) {
callback(_data['stuname']);
}
});
}
},
],
mainId: 'ID',
isPage: false,
//sidx: 'DNo',
//sord: 'ASC',
});
//var param;
//param = param || {};
//param.ParentID = rowItem.Id;
$('#' + subContentId).jfGridSet('reload');
},
subGridHeight: 250,
});
//$("#gridtable").empty();
//$("#gridtable")[0].dfop = undefined;
//if (selectedParent.BuildType == undefined || selectedParent.BuildType === "3") {
//} else {
// //lrAuthorizeJfGridLei
// $('#gridtable').jfGrid({
//if (selectedParent.ChildType == "5") {
// $('#gridtable').lrAuthorizeJfGridLei({
// url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList',
// headData: [
// { label: "名称", name: "Name", width: 100, align: "left" },
// {
// label: "宿舍楼", name: "ApartmentName", width: 100, align: "left"
// },
// {
// label: "单元", name: "UnitName", width: 100, align: "left"
// },
// {
// label: "楼层", name: "FloorName", width: 100, align: "left"
// },
// //{
// // label: "学生", name: "StudentID", width: 100, align: "left",
// // formatterAsync: function (callback, value, row, op, $cell) {
// { label: "学生名字", name: "StuName", width: 100, align: "left" },

// // learun.clientdata.getAsync('custmerData', {
// // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic',
// // key: value,
// // keyId: 'stuid',
// // callback: function (_data) {
// // callback(_data['stuname']);
// // }
// // });
// // }
// //},
// { label: "位置", name: "Address", width: 100, align: "left" },
// { label: "班级", name: "Class", width: 100, align: "left" },
// {
// label: "校区", name: "Campus", width: 100, align: "left",
// label: "性别", name: "Sex", width: 100, align: "left",
// formatterAsync: function (callback, value, row, op, $cell) {

// learun.clientdata.getAsync('custmerData', {
// url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company',
// learun.clientdata.getAsync('dataItem', {
// key: value,
// keyId: 'f_companyid',
// code: 'usersex',
// callback: function (_data) {
// callback(_data['f_fullname']);
// callback(_data.text);
// }
// });
// }
// },
// //{
// // label: "系", name: "Dept", width: 100, align: "left",
// // formatterAsync: function (callback, value, row, op, $cell) {
// // learun.clientdata.getAsync('custmerData', {
// // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
// // key: value,
// // keyId: 'deptno',
// // callback: function (_data) {
// // callback(_data['deptname']);
// // }
// // });
// // }
// //},
// //{
// // label: "专业", name: "Major", width: 100, align: "left",
// // formatterAsync: function (callback, value, row, op, $cell) {
// // learun.clientdata.getAsync('custmerData', {
// // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
// // key: value,
// // keyId: 'id',
// // callback: function (_data) {
// // callback(_data['majorname']);
// // }
// // });
// // }
// //},
// //{ label: "班级", name: "Class", width: 100, align: "left" },
// //{
// // label: "性别", name: "Sex", width: 100, align: "left",
// // formatterAsync: function (callback, value, row, op, $cell) {
// // learun.clientdata.getAsync('dataItem', {
// // key: value,
// // code: 'usersex',
// // callback: function (_data) {
// // callback(_data.text);
// // }
// // });
// // }
// //},
// { label: "负责人", name: "Functionary", width: 100, align: "left" },
// { label: "负责人电话", name: "Phone", width: 100, align: "left" },
// { label: "价格", name: "Price", width: 100, align: "left" },
// { label: "星级", name: "Starred", width: 100, align: "left" },
// {
// label: "是否独卫", name: "HasToilet", width: 100, align: "left",
// formatterAsync: function (callback, value, row, op, $cell) {
// learun.clientdata.getAsync('dataItem', {
// key: value,
// code: 'HasToilet',
// callback: function (_data) {
// callback(_data.text);
// }
// });
// }
// },
// { label: "舍长", name: "Leader", width: 100, align: "left" },
// { label: "备注", name: "Remark", width: 100, align: "left" },
// ],
// mainId: 'ID',
// isPage: true,
// //isMultiselect: true
// //sidx: 'ApartmentId asc,UnitId asc ,FloorId asc ',
// //sord: 'ASC',
// isMultiselect:true
// });
//}
//} else {

//}
//page.search();
},
search: function (param) {
param = param || {};
param.SqlParameter = " AND t.BuildType ='4' ";
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
}
};


+ 1
- 13
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/Acc_DormitoryBuildEntity.cs View File

@@ -24,7 +24,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
/// </summary>
[Column("DNO")]
public string DNo { get; set; }
/// <summary>
/// 名称
/// </summary>
@@ -166,21 +166,9 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
/// </summary>
[Column("PLANBEDNUM")]
public int? PlanBedNum { get; set; }
/// <summary>
/// 寝室类型(几人寝)
/// </summary>
[Column("ROOMTYPE")]
public int? RoomType { get; set; }
/// <summary>
/// 入住人数
/// </summary>
[Column("CHECKINSTU")]
public int? CheckInStu { get; set; }
#endregion

#region 扩展字段

[NotMapped]
public string ApartmentName { get; set; }
[NotMapped]


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs View File

@@ -289,7 +289,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
value = item.ID.ToString(),
showcheck = false,
checkstate = 0,
isexpand = false,
isexpand = true,
parentId = item.ParentID == null ? "" : item.ParentID

};


+ 12
- 270
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs View File

@@ -51,8 +51,8 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
t.ParentID,
t.Remark,
t.Starred,
t.HasToilet,t.RoomType,
t.ApartmentId,t.UnitId,t.FloorId,t.CheckInStu,
t.HasToilet,
t.ApartmentId,t.UnitId,t.FloorId,
a.name as ApartmentName,b.name as UnitName,c.Name as FloorName
");
strSql.Append(" FROM Acc_DormitoryBuild t ");
@@ -68,25 +68,9 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName
dp.Add("ParentID", queryParam["ParentID"].ToString(), DbType.String);
strSql.Append(" AND t.ParentID =@ParentID ");
}
//else
//{
// strSql.Append(" AND t.BuildType ='4' ");
//}

if (!queryParam["ApartmentId"].IsEmpty())
{
dp.Add("ApartmentId", queryParam["ApartmentId"].ToString(), DbType.String);
strSql.Append(" AND t.ApartmentId =@ApartmentId ");
}
if (!queryParam["UnitId"].IsEmpty())
{
dp.Add("UnitId", queryParam["UnitId"].ToString(), DbType.String);
strSql.Append(" AND t.UnitId =@UnitId ");
}
if (!queryParam["FloorId"].IsEmpty())
else
{
dp.Add("FloorId", queryParam["FloorId"].ToString(), DbType.String);
strSql.Append(" AND t.FloorId =@FloorId ");
strSql.Append(" AND t.BuildType ='4' ");
}

if (!queryParam["Name"].IsEmpty())
@@ -102,17 +86,17 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName
if (!queryParam["Dept"].IsEmpty())
{
dp.Add("Dept", "%" + queryParam["Dept"].ToString() + "%", DbType.String);
strSql.Append(" AND t.Dept=@Dept ");
strSql.Append(" AND t.Dept Like @Dept ");
}
if (!queryParam["Class"].IsEmpty())
{
dp.Add("Class", "%" + queryParam["Class"].ToString() + "%", DbType.String);
strSql.Append(" AND t.Class=@Class ");
strSql.Append(" AND t.Class Like @Class ");
}
if (!queryParam["Major"].IsEmpty())
{
dp.Add("Major", "%" + queryParam["Major"].ToString() + "%", DbType.String);
strSql.Append(" AND t.Major=@Major ");
strSql.Append(" AND t.Major Like @Major ");
}
if (!queryParam["Sex"].IsEmpty())
{
@@ -190,27 +174,6 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName
}
}
}

public IEnumerable<Acc_DormitoryBuildEntity> GetBedListByRoomId(string RoomId)
{
try
{
string sql = $"select ID,Name,DNo,StudentID from Acc_DormitoryBuild where BuildType='5' and ParentID='{RoomId}'";
return this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(sql);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

public IEnumerable<Acc_DormitoryBuildEntity> GetAllList()
{
try
@@ -317,7 +280,7 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName
{
try
{
var entity = this.BaseRepository("CollegeMIS").FindEntity<Acc_DormitoryBuildEntity>(a => a.ID == parentID);
var entity = this.BaseRepository("CollegeMIS").FindEntity<Acc_DormitoryBuildEntity>(a => a.ParentID == parentID);
if (null != entity)
{
return entity.BuildType;
@@ -340,35 +303,6 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName
}
}

public string GetParentBuildType(string keyValue)
{
try
{
string sql = $@" select BuildType from [dbo].[Acc_DormitoryBuild] where Id=(
select parentid from [dbo].[Acc_DormitoryBuild] where id='{keyValue}')";
var data = this.BaseRepository("CollegeMIS").FindObject(sql);
if (data == null)
{
return "";
}
else
{
return data.ToString();
}
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}

internal object GetRoomList(string parentID)
{
try
@@ -958,6 +892,10 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName
}
bedInfo.StudentID = stuInfo.StuId;
bedInfo.StuName = stuInfo.StuName;
bedInfo.Dept = stuInfo.DeptNo;
bedInfo.Major = stuInfo.MajorNo;
bedInfo.Class = stuInfo.ClassNo;
bedInfo.Sex = Convert.ToString(stuInfo.GenderNo);
this.BaseRepository("CollegeMIS").Update(bedInfo);
return true;
}
@@ -1023,27 +961,6 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName
}
}


public void DeleteBed(string keyValue, string ParentID)
{
try
{
this.BaseRepository("CollegeMIS").Delete<Acc_RewardEntity>(t => t.ID == keyValue);
UpdateCheckInNum(ParentID);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

public void DeleteAll(string parentid)
{
var list = this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(a => a.ParentID == parentid).ToList();
@@ -1087,9 +1004,7 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName
var elementEntity = new Acc_DormitoryBuildEntity
{
ParentID = keyValue,
ApartmentId = keyValue,
Name = i.ToString() + "单元",
DNo = i.ToString(),
BuildType = "2",//单元类型
Sex = dormitory.Sex,
Address = dormitory.Address,
@@ -1116,10 +1031,7 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName
var floorEntity = new Acc_DormitoryBuildEntity
{
ParentID = elementEntity.ID,
ApartmentId = keyValue,
UnitId = elementEntity.ID,
Name = j.ToString() + "层",
DNo = j.ToString(),
BuildType = "3",//楼层类型,
Sex = dormitory.Sex,
Address = dormitory.Address,
@@ -1146,11 +1058,7 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName
var roomEntity = new Acc_DormitoryBuildEntity
{
ParentID = floorEntity.ID,
ApartmentId = keyValue,
UnitId = elementEntity.ID,
FloorId = floorEntity.ID,
Name = j.ToString() + (n < 10 ? "0" + n.ToString() : n.ToString()) + "室",
DNo = j.ToString() + (n < 10 ? "0" + n.ToString() : n.ToString()),
BuildType = "4",//房间类型
Sex = dormitory.Sex,
Address = dormitory.Address,
@@ -1163,7 +1071,6 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName
Major = dormitory.Major,
Phone = dormitory.Phone,
Price = dormitory.Price,
RoomType = bedNum,
UpdateBy = currentUser.realName,
UpdateTime = DateTime.Now,
Starred = "3",
@@ -1181,7 +1088,6 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName
{
ParentID = roomEntity.ID,
Name = m.ToString() + "床",
DNo = m.ToString(),
BuildType = "5",
Sex = dormitory.Sex,
Address = dormitory.Address,
@@ -1603,170 +1509,6 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName
}


/// <summary>
/// 保存实体数据(新增、修改)
/// <param name="keyValue">主键</param>
/// <summary>
/// <returns></returns>
public void SaveBedEntity(string keyValue, string ParentID, Acc_DormitoryBuildEntity entity)
{
var db = this.BaseRepository("CollegeMIS");
try
{
db.BeginTrans();
if (!string.IsNullOrEmpty(keyValue))
{
entity.Modify(keyValue);
db.Update(entity);
}
else
{
var parentEntity = db.FindEntity<Acc_DormitoryBuildEntity>(ParentID);
entity.Create();
entity.ApartmentId = parentEntity.ApartmentId;
entity.UnitId = parentEntity.UnitId;
entity.FloorId = parentEntity.FloorId;
entity.ParentID = ParentID;
entity.BuildType = "5";
db.Insert(entity);
}
db.Commit();
UpdateCheckInNum(ParentID);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

private void UpdateCheckInNum(string ParentID)
{
try
{
string sql = $@"update [dbo].[Acc_DormitoryBuild] set RoomType=(
select count(1) from [dbo].[Acc_DormitoryBuild] where ParentId='{ParentID}' and BuildType='5'
)
where ID='{ParentID}'
";
this.BaseRepository("CollegeMIS").ExecuteBySql(sql);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

public void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity, int type)
{
try
{
if (keyValue.Contains(","))
{
keyValue = string.Join("','", keyValue.Split(','));
}
string sql = $"update Acc_DormitoryBuild set ";
if (type == 1)
{
sql += $" Dept='{entity.Dept}' ";
}
else
{
sql += $"Major='{entity.Major}',Class='{entity.Class}'";
}

sql += $" where ID in ('{keyValue}')";

this.BaseRepository("CollegeMIS").ExecuteBySql(sql);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

/// <summary>
/// 分配宿舍
/// </summary>
/// <param name="RoomId"></param>
/// <param name="list"></param>
public void SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list)
{
var db = this.BaseRepository("CollegeMIS").BeginTrans();
try
{
foreach (var entity in list)
{
string sql = $"update Acc_DormitoryBuild set StudentID='{entity.StudentID}' where ID='{entity.ID}'";
db.ExecuteBySql(sql);
}

int checkInStu = list.Where(x => x.StudentID != null).Count();
string checkInSql = $"update Acc_DormitoryBuild set CheckInStu='{checkInStu}' where ID='{RoomId}'";
db.ExecuteBySql(checkInSql);

db.Commit();
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

/// <summary>
/// 同步宿舍信息
/// </summary>
public void SyncData()
{
var db = this.BaseRepository("CollegeMIS").BeginTrans();
try
{
string sql = "select 学号,姓名,性别,公寓,单元,楼层,宿舍号,床位号 from t1 where 学号 is not null order by 公寓,单元,楼层,宿舍号,床位号";
DataTable dt = db.FindTable(sql);
//var list = db.FindList<Acc_DormitoryBuildEntity>();
//select * from Acc_DormitoryBuild where parentid= (select ID from Acc_DormitoryBuild where parentid=( select ID from Acc_DormitoryBuild where name='一号学生公寓'));

}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

#endregion 提交数据
}
}

Loading…
Cancel
Save