Commit d2dd7ea7 authored by 黄奎's avatar 黄奎

页面修改

parent 643c4144
......@@ -48,6 +48,11 @@ namespace Edu.Module.Exam
/// </summary>
private readonly RB_QuestionRepository questionRepository = new RB_QuestionRepository();
/// <summary>
/// 考试发布仓储层对象
/// </summary>
private readonly RB_Examination_PublishRepository examination_PublishRepository = new RB_Examination_PublishRepository();
/// <summary>
/// 获取试卷分页列表
/// </summary>
......@@ -666,5 +671,62 @@ namespace Edu.Module.Exam
return resultList;
}
/// <summary>
/// 获取发布试卷分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Examination_Publish_ViewModel> GetExaminationPublishPageModule(int pageIndex, int pageSize, out long rowsCount, RB_Examination_Publish_ViewModel query)
{
return examination_PublishRepository.GetExaminationPublishPageRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 新增修改考试发布
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetExaminationPublishModule(RB_Examination_Publish_ViewModel model)
{
bool flag = true;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Examination_Publish_ViewModel.PaperId), model.PaperId },
{nameof(RB_Examination_Publish_ViewModel.PublishType), model.PublishType },
{nameof(RB_Examination_Publish_ViewModel.ExamStartTime), model.ExamStartTime },
{nameof(RB_Examination_Publish_ViewModel.ExamEndTime), model.ExamEndTime },
{nameof(RB_Examination_Publish_ViewModel.ExamTimes), model.ExamTimes },
{nameof(RB_Examination_Publish_ViewModel.SubmitTimes), model.SubmitTimes },
{nameof(RB_Examination_Publish_ViewModel.EnterTimes), model.EnterTimes },
{nameof(RB_Examination_Publish_ViewModel.IsQuestionRandom), model.IsQuestionRandom },
{nameof(RB_Examination_Publish_ViewModel.IsOptionRandom), model.IsOptionRandom },
{nameof(RB_Examination_Publish_ViewModel.IsLeaveAnswer), model.IsLeaveAnswer },
{nameof(RB_Examination_Publish_ViewModel.LeaveTimes), model.LeaveTimes },
{nameof(RB_Examination_Publish_ViewModel.IsDisableMultiTerminal), model.IsDisableMultiTerminal },
{nameof(RB_Examination_Publish_ViewModel.IsExamType), model.IsExamType },
{nameof(RB_Examination_Publish_ViewModel.ExamTypeValue), model.ExamTypeValue },
{nameof(RB_Examination_Publish_ViewModel.ExamNotice), model.ExamNotice },
{nameof(RB_Examination_Publish_ViewModel.PassScore), model.PassScore },
{nameof(RB_Examination_Publish_ViewModel.IsAutoSubmit), model.IsAutoSubmit },
{nameof(RB_Examination_Publish_ViewModel.FillInIsSubject), model.FillInIsSubject },
{nameof(RB_Examination_Publish_ViewModel.FillInIsIgnore), model.FillInIsIgnore },
{nameof(RB_Examination_Publish_ViewModel.IsHalfScore), model.IsHalfScore },
};
flag = examination_PublishRepository.Update(fileds, new WhereHelper(nameof(RB_Examination_Publish_ViewModel.Id), model.Id));
}
else
{
var newId = examination_PublishRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
}
}
......@@ -28,6 +28,13 @@ SELECT A.*
FROM RB_Examination_Publish AS A
WHERE 1=1
");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Examination_Publish_ViewModel.Group_Id), query.Group_Id);
}
}
return GetPage<RB_Examination_Publish_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
}
......
......@@ -375,5 +375,69 @@ namespace Edu.WebApi.Controllers.Exam
return ApiResult.Success(data: obj);
}
/// <summary>
/// 发布考试
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult PublishExam()
{
var model = new RB_Examination_Publish_ViewModel()
{
Id = base.ParmJObj.GetInt("Id"),
PaperId = base.ParmJObj.GetInt("PaperId"),
PublishType = base.ParmJObj.GetInt("PublishType"),
ExamStartTime = base.ParmJObj.GetDateTime("ExamStartTime"),
ExamEndTime = base.ParmJObj.GetDateTime("ExamEndTime"),
ExamTimes = base.ParmJObj.GetInt("ExamTimes"),
SubmitTimes = base.ParmJObj.GetInt("SubmitTimes"),
EnterTimes = base.ParmJObj.GetInt("EnterTimes"),
IsQuestionRandom = base.ParmJObj.GetInt("IsQuestionRandom"),
IsOptionRandom = base.ParmJObj.GetInt("IsOptionRandom"),
IsLeaveAnswer = base.ParmJObj.GetInt("IsLeaveAnswer"),
LeaveTimes = base.ParmJObj.GetInt("LeaveTimes"),
IsDisableMultiTerminal = base.ParmJObj.GetInt("IsDisableMultiTerminal"),
IsExamType = base.ParmJObj.GetInt("IsExamType"),
ExamTypeValue = base.ParmJObj.GetInt("ExamTypeValue"),
ExamNotice = base.ParmJObj.GetStringValue("ExamNotice"),
PassScore = base.ParmJObj.GetDecimal("PassScore"),
IsAutoSubmit = base.ParmJObj.GetInt("IsAutoSubmit"),
FillInIsSubject = base.ParmJObj.GetInt("FillInIsSubject"),
FillInIsIgnore = base.ParmJObj.GetInt("FillInIsIgnore"),
IsHalfScore = base.ParmJObj.GetInt("IsHalfScore"),
};
model.CreateBy = base.UserInfo.Id;
model.CreateTime = DateTime.Now;
model.Group_Id = base.UserInfo.Group_Id;
model.School_Id = base.UserInfo.School_Id;
model.Status = 0;
var flag = paperModule.SetExaminationPublishModule(model);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取发布考试分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetPublishExamPage()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Examination_Publish_ViewModel()
{
PaperId = base.ParmJObj.GetInt("PaperId"),
};
query.Group_Id = base.UserInfo.Group_Id;
List<object> result = new List<object>();
var list = paperModule.GetExaminationPublishPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
result.Add(item);
}
pageModel.Count = rowsCount;
pageModel.PageData = result;
return ApiResult.Success(data: pageModel);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment