@@ -42,6 +42,8 @@ namespace Learun.Application.WebApi
private Response GetApplyResult(dynamic _)
private Response GetApplyResult(dynamic _)
{
{
var msg = "正在提交,请等待!";//返回结果信息
var resultData = new { msg = msg };
dynamic parameter = this.GetReqData<dynamic>();
dynamic parameter = this.GetReqData<dynamic>();
string keyValue = parameter.keyValue;
string keyValue = parameter.keyValue;
string account = parameter.StuNo;
string account = parameter.StuNo;
@@ -49,13 +51,15 @@ namespace Learun.Application.WebApi
var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(account);
var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(account);
if (stuInfoBasicEntity == null)
if (stuInfoBasicEntity == null)
{
{
return Success("当前学员不存在!");
msg = "当前学员不存在!";
return Success(resultData);
}
}
//课程信息
//课程信息
var olpeEntity = openLessonPlanOfElectiveIbll.GetOpenLessonPlanOfElectiveEntity(keyValue);
var olpeEntity = openLessonPlanOfElectiveIbll.GetOpenLessonPlanOfElectiveEntity(keyValue);
if (olpeEntity == null)
if (olpeEntity == null)
{
{
return Success("当前课程不存在!");
msg = "当前课程不存在!";
return Success(resultData);
}
}
//当前学员本学期是否有报名课程:每学期一门
//当前学员本学期是否有报名课程:每学期一门
@@ -93,11 +97,13 @@ namespace Learun.Application.WebApi
{
{
if (sslleEntity.Status == 1)
if (sslleEntity.Status == 1)
{
{
return Success("当前课程报名审核中,请耐心等待!");
msg = "当前课程报名审核中,请耐心等待!";
return Success(resultData);
}
}
else if (sslleEntity.Status == 2)
else if (sslleEntity.Status == 2)
{
{
return Success("当前课程已报名成功!");
msg = "当前课程已报名成功!";
return Success(resultData);
}
}
}
}
else
else
@@ -107,7 +113,8 @@ namespace Learun.Application.WebApi
var aaa = aa.Count(x => x.Status == 1 || x.Status == 2);
var aaa = aa.Count(x => x.Status == 1 || x.Status == 2);
if (aaa >= olpeEntity.StuNumMax)
if (aaa >= olpeEntity.StuNumMax)
{
{
return Success("当前课程报名人数已满,请选择其他课程!");
msg = "当前课程报名人数已满,请选择其他课程!";
return Success(resultData);
}
}
//每学期最多两门
//每学期最多两门
var sslleList = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveListByStuNo(account);
var sslleList = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveListByStuNo(account);
@@ -115,17 +122,19 @@ namespace Learun.Application.WebApi
var sslleListOfNow1 = sslleListOfNow.Where(x => x.Status == 1 || x.Status == 2);
var sslleListOfNow1 = sslleListOfNow.Where(x => x.Status == 1 || x.Status == 2);
if (sslleListOfNow1.Count() >= Config.GetValue("ElectiveLessonApplyMax").ToInt())
if (sslleListOfNow1.Count() >= Config.GetValue("ElectiveLessonApplyMax").ToInt())
{
{
return Success("每学期最多选择" + Config.GetValue("ElectiveLessonApplyMax").ToInt() + "门选修课!");
msg = "每学期最多选择" + Config.GetValue("ElectiveLessonApplyMax").ToInt() + "门选修课!";
return Success(resultData);
}
}
//相同时间不能报名
//相同时间不能报名
if (sslleListOfNow1.Where(x => x.LessonSection == olpeEntity.LessonSection).Any())
if (sslleListOfNow1.Where(x => x.LessonSection == olpeEntity.LessonSection).Any())
{
{
//相同时间不能报名
//相同时间不能报名
return Success("本学期此时间段已有报名的选修课!");
msg = "本学期此时间段已有报名的选修课!";
return Success(resultData);
}
}
}
}
return Fail("正在提交,请等待!" );
return Fail(resultData );
}
}
#region 获取数据
#region 获取数据
@@ -312,6 +321,8 @@ namespace Learun.Application.WebApi
/// <returns></returns>
/// <returns></returns>
public Response SignInPre(dynamic _)
public Response SignInPre(dynamic _)
{
{
var msg = "报名成功";//返回结果信息
var resultData = new { msg = msg };
dynamic parameter = this.GetReqData<dynamic>();
dynamic parameter = this.GetReqData<dynamic>();
string keyValue = parameter.keyValue;
string keyValue = parameter.keyValue;
string account = parameter.StuNo;
string account = parameter.StuNo;
@@ -319,20 +330,23 @@ namespace Learun.Application.WebApi
var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(account);
var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(account);
if (stuInfoBasicEntity == null)
if (stuInfoBasicEntity == null)
{
{
return Fail("当前学员不存在!");
msg = "当前学员不存在!";
return Fail(resultData);
}
}
//课程信息
//课程信息
var olpeEntity = openLessonPlanOfElectiveIbll.GetOpenLessonPlanOfElectiveEntity(keyValue);
var olpeEntity = openLessonPlanOfElectiveIbll.GetOpenLessonPlanOfElectiveEntity(keyValue);
if (olpeEntity == null)
if (olpeEntity == null)
{
{
return Fail("当前课程不存在!");
msg = "当前课程不存在!";
return Fail(resultData);
}
}
//所选课程的报名人数是否已满
//所选课程的报名人数是否已满
var aa = stuSelectLessonListOfElectivePreIBLL.GetStuSelectLessonListOfElectivePreListByOLPEId(olpeEntity.Id);
var aa = stuSelectLessonListOfElectivePreIBLL.GetStuSelectLessonListOfElectivePreListByOLPEId(olpeEntity.Id);
var aaa = aa.Where(x => x.Status == 2).Count();
var aaa = aa.Where(x => x.Status == 2).Count();
if (aaa >= olpeEntity.StuNumMax)
if (aaa >= olpeEntity.StuNumMax)
{
{
return Fail("当前课程报名人数已满,请选择其他课程!");
msg = "当前课程报名人数已满,请选择其他课程!";
return Fail(resultData);
}
}
//当前学员本学期是否有报名课程:每学期一门
//当前学员本学期是否有报名课程:每学期一门
//var sslleEntity = stuSelectLessonListOfElectivePreIBLL.GetStuSelectLessonListOfElectivePreEntityByStuNo(account, "");
//var sslleEntity = stuSelectLessonListOfElectivePreIBLL.GetStuSelectLessonListOfElectivePreEntityByStuNo(account, "");
@@ -364,7 +378,8 @@ namespace Learun.Application.WebApi
var sslleListOfNow2 = sslleListOfNow.Where(x => x.Status == 3);
var sslleListOfNow2 = sslleListOfNow.Where(x => x.Status == 3);
if (sslleListOfNow1.Count() >= Config.GetValue("ElectiveLessonApplyMax").ToInt())
if (sslleListOfNow1.Count() >= Config.GetValue("ElectiveLessonApplyMax").ToInt())
{
{
return Fail("每学期最多选择" + Config.GetValue("ElectiveLessonApplyMax").ToInt() + "门选修课!");
msg = "每学期最多选择" + Config.GetValue("ElectiveLessonApplyMax").ToInt() + "门选修课!";
return Fail(resultData);
}
}
else
else
{
{
@@ -373,11 +388,13 @@ namespace Learun.Application.WebApi
{
{
if (m.Status == 1)
if (m.Status == 1)
{
{
return Fail("当前课程报名审核中,请耐心等待!");
msg = "当前课程报名审核中,请耐心等待!";
return Fail(resultData);
}
}
else if (m.Status == 2)
else if (m.Status == 2)
{
{
return Fail("当前课程已报名成功!");
msg = "当前课程已报名成功!";
return Fail(resultData);
}
}
}
}
}
}
@@ -392,7 +409,8 @@ namespace Learun.Application.WebApi
if (sslleListOfNow1.Select(x => x.LessonSection == olpeEntity.LessonSection).Any())
if (sslleListOfNow1.Select(x => x.LessonSection == olpeEntity.LessonSection).Any())
{
{
//相同时间不能报名
//相同时间不能报名
return Success("本学期此时间段已有报名的选修课!");
msg = "本学期此时间段已有报名的选修课!";
return Success(resultData);
}
}
//新增报名数据
//新增报名数据
var model = new StuSelectLessonListOfElectivePreEntity()
var model = new StuSelectLessonListOfElectivePreEntity()
@@ -434,7 +452,7 @@ namespace Learun.Application.WebApi
};
};
stuSelectLessonListOfElectivePreIBLL.SaveEntity("", model);
stuSelectLessonListOfElectivePreIBLL.SaveEntity("", model);
return Success("报名成功" );
return Success(resultData );
}
}
#endregion
#endregion