20220802新增考试记录页 校正考题重复按钮,优化交卷功能

This commit is contained in:
2022-08-02 14:59:32 +08:00
parent 5767f8d259
commit 019e2fc83e
12 changed files with 174 additions and 81 deletions
@@ -0,0 +1,9 @@
-- 重置双氧水项目人员下发状态 为空
disable trigger [dbo].[SitePerson_Person_Bak_TRIGGER] on [dbo].[SitePerson_Person]
go
update SitePerson_Person set ExchangeTime=null,ExchangeTime2=null where ProjectId='0d511d27-c4ea-49ba-bd75-7b1c49a04382'
go
update SitePerson_Person_Bak set ExchangeTime=null,ExchangeTime2=null where ProjectId='0d511d27-c4ea-49ba-bd75-7b1c49a04382'
go
enable trigger [dbo].[SitePerson_Person_Bak_TRIGGER] on [dbo].[SitePerson_Person]
go
+2 -1
View File
@@ -202,6 +202,7 @@ namespace BLL
}
}
}
//// 获取得到的单选题、多选题、判断题 数量
int getDiffTestType1Count = sumTestType1Count - getTestTrainingItemList.Where(x => x.TestType == "1").Count();
int getDiffTestType2Count = sumTestType2Count - getTestTrainingItemList.Where(x => x.TestType == "2").Count();
@@ -606,7 +607,7 @@ namespace BLL
db.SubmitChanges();
var getTestPlan = db.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == newTestRecord.TestPlanId);
var person = PersonService.GetPersonByUserId(newTestRecord.TestManId, getTestPlan.ProjectId);
var person =db.SitePerson_Person.FirstOrDefault(x=>x.PersonId == getTestRecord.TestManId);
if (getTestPlan != null && person != null)
{
CreateTestRecordItem(getTestPlan, newTestRecord.TestRecordId, person);
@@ -222,6 +222,7 @@ namespace BLL
return personName;
}
#endregion
/// <summary>
/// 根据UserId主键获取人员信息
/// </summary>
@@ -57,6 +57,8 @@
</f:CheckBox>
<f:Label runat="server" Text="红色表示分数低于80分。" CssClass="LabelColor"></f:Label>
<f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill>
<f:Button ID="btnRefresh" Text="校正重复试题" Icon="ArrowRefresh" runat="server" Hidden="true" OnClick="btnRefresh_Click">
</f:Button>
<f:Button ID="btnOut" OnClick="btnMenuOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button>
@@ -1,12 +1,10 @@
using Aspose.Words;
using BLL;
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
namespace FineUIPro.Web.HSSE.EduTrain
{
public partial class TestRecord : PageBase
@@ -316,6 +314,7 @@ namespace FineUIPro.Web.HSSE.EduTrain
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnMenuDelete.Hidden = false;
this.btnRefresh.Hidden= false;
}
}
}
@@ -331,5 +330,49 @@ namespace FineUIPro.Web.HSSE.EduTrain
PrinterDocService.PrinterDocMethod(Const.ProjectTestRecordMenuId, Grid1.SelectedRowID, "试卷");
}
protected void btnRefresh_Click(object sender, EventArgs e)
{
int countRecod = 0;
var getData = from x in Funs.DB.Training_TestRecordItem
join y in Funs.DB.Training_TestRecord on x.TestRecordId equals y.TestRecordId
where y.ProjectId == this.CurrUser.LoginProjectId
group x by new { x.TestRecordId, x.TrainingItemCode } into g
where g.Count() > 1
select new { g.FirstOrDefault().TestRecordId, g.FirstOrDefault().TrainingItemCode, gCount= g.Count() };
if (getData.Count() > 0)
{
List<string> TestRecordIdList = getData.Select(x => x.TestRecordId).Distinct().ToList();
foreach (var item in getData)
{
var getTestRecordItem = Funs.DB.Training_TestRecordItem.FirstOrDefault(x => x.TestRecordId == item.TestRecordId
&& x.TrainingItemCode == item.TrainingItemCode && (!x.SubjectScore.HasValue || x.SubjectScore < x.Score ));
if (getTestRecordItem == null)
{
getTestRecordItem = Funs.DB.Training_TestRecordItem.FirstOrDefault(x => x.TestRecordId == item.TestRecordId
&& x.TrainingItemCode == item.TrainingItemCode);
}
if (getTestRecordItem != null)
{
Funs.DB.Training_TestRecordItem.DeleteOnSubmit(getTestRecordItem);
Funs.DB.SubmitChanges();
}
}
foreach (var item in TestRecordIdList)
{
var getTestRecord = Funs.DB.Training_TestRecord.FirstOrDefault(x => x.TestRecordId == item);
if (getTestRecord != null)
{
getTestRecord.TestScores = Funs.DB.Training_TestRecordItem.Where(x => x.TestRecordId == item).Sum(x => x.SubjectScore ?? 0);
Funs.DB.SubmitChanges();
countRecod++;
}
}
}
Alert.ShowInTop("操作完成,共处理"+countRecod.ToString()+"条考试记录", MessageBoxIcon.Success);
}
}
}
+38 -27
View File
@@ -7,11 +7,13 @@
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.EduTrain {
public partial class TestRecord {
namespace FineUIPro.Web.HSSE.EduTrain
{
public partial class TestRecord
{
/// <summary>
/// form1 控件。
/// </summary>
@@ -20,7 +22,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
@@ -29,7 +31,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
@@ -38,7 +40,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Grid1 控件。
/// </summary>
@@ -47,7 +49,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar1 控件。
/// </summary>
@@ -56,7 +58,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// txtName 控件。
/// </summary>
@@ -65,7 +67,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtName;
/// <summary>
/// txtMinScores 控件。
/// </summary>
@@ -74,7 +76,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.NumberBox txtMinScores;
/// <summary>
/// txtMaxScores 控件。
/// </summary>
@@ -83,7 +85,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.NumberBox txtMaxScores;
/// <summary>
/// IsTemp 控件。
/// </summary>
@@ -92,7 +94,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.CheckBox IsTemp;
/// <summary>
/// txtStartDate 控件。
/// </summary>
@@ -101,7 +103,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtStartDate;
/// <summary>
/// txtEndDate 控件。
/// </summary>
@@ -110,7 +112,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtEndDate;
/// <summary>
/// ckIsNULL 控件。
/// </summary>
@@ -119,7 +121,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.CheckBox ckIsNULL;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
@@ -128,7 +130,16 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnRefresh 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnRefresh;
/// <summary>
/// btnOut 控件。
/// </summary>
@@ -137,7 +148,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnOut;
/// <summary>
/// labNumber 控件。
/// </summary>
@@ -146,7 +157,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label labNumber;
/// <summary>
/// ToolbarSeparator1 控件。
/// </summary>
@@ -155,7 +166,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
/// <summary>
/// ToolbarText1 控件。
/// </summary>
@@ -164,7 +175,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize 控件。
/// </summary>
@@ -173,7 +184,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window1 控件。
/// </summary>
@@ -182,7 +193,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Menu1 控件。
/// </summary>
@@ -191,7 +202,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuView 控件。
/// </summary>
@@ -200,7 +211,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuView;
/// <summary>
/// btnPrinter 控件。
/// </summary>
@@ -209,7 +220,7 @@ namespace FineUIPro.Web.HSSE.EduTrain {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnPrinter;
/// <summary>
/// btnMenuDelete 控件。
/// </summary>
@@ -192,59 +192,62 @@ namespace WebAPI.Controllers
var responeData = new Model.ResponeData();
try
{
var getTestPlan = Funs.DB.Training_TestPlan.FirstOrDefault(e => e.TestPlanId == testPlanId && e.States != "3" && e.TestStartTime <= DateTime.Now && e.TestEndTime >= DateTime.Now);
if (getTestPlan != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var person = PersonService.GetPersonByUserId(personId, getTestPlan.ProjectId);
if (person != null )
var getTestPlan = db.Training_TestPlan.FirstOrDefault(e => e.TestPlanId == testPlanId && e.States != "3" && e.TestStartTime <= DateTime.Now && e.TestEndTime >= DateTime.Now);
if (getTestPlan != null)
{
//2-考试中;生成考试试卷
if (getTestPlan.States == "2" )
var person = PersonService.GetPersonByUserId(personId, getTestPlan.ProjectId);
if (person != null)
{
var testRecord = Funs.DB.Training_TestRecord.FirstOrDefault(x => x.TestPlanId == getTestPlan.TestPlanId && x.TestManId == person.PersonId && !x.TestEndTime.HasValue);
if (testRecord != null)
//2-考试中;生成考试试卷
if (getTestPlan.States == "2")
{
string testRecordId = APITestRecordService.CreateTestRecordItem(getTestPlan, testRecord.TestRecordId, person);
responeData.code = 2;
responeData.data = new { testRecordId };
}
}
else
{
if (string.IsNullOrEmpty(getTestPlan.PlanId) && getTestPlan.UnitIds.Contains(person.UnitId) && (getTestPlan.WorkPostIds == null || getTestPlan.WorkPostIds.Contains(person.WorkPostId)))
{
//0-待提交;1-已发布未考试 将人员添加进考试记录
var testTRecord = Funs.DB.Training_TestRecord.FirstOrDefault(x => x.TestPlanId == testPlanId && x.TestManId == personId);
if ((getTestPlan.States == "0" || getTestPlan.States == "1") && testTRecord == null && !string.IsNullOrEmpty(personId))
var testRecord = db.Training_TestRecord.FirstOrDefault(x => x.TestPlanId == getTestPlan.TestPlanId && x.TestManId == person.PersonId && !x.TestEndTime.HasValue);
if (testRecord != null)
{
Model.Training_TestRecord newTestRecord = new Model.Training_TestRecord
string testRecordId = APITestRecordService.CreateTestRecordItem(getTestPlan, testRecord.TestRecordId, person);
responeData.code = 2;
responeData.data = new { testRecordId };
}
}
else
{
if (string.IsNullOrEmpty(getTestPlan.PlanId) && getTestPlan.UnitIds.Contains(person.UnitId) && (getTestPlan.WorkPostIds == null || getTestPlan.WorkPostIds.Contains(person.WorkPostId)))
{
//0-待提交;1-已发布未考试 将人员添加进考试记录
var testTRecord = db.Training_TestRecord.FirstOrDefault(x => x.TestPlanId == testPlanId && x.TestManId == personId);
if ((getTestPlan.States == "0" || getTestPlan.States == "1") && testTRecord == null && !string.IsNullOrEmpty(personId))
{
TestRecordId = SQLHelper.GetNewID(),
ProjectId = getTestPlan.ProjectId,
TestPlanId = getTestPlan.TestPlanId,
TestManId = personId,
};
if (string.IsNullOrEmpty(newTestRecord.TestType))
{
var getTrainTypeName = Funs.DB.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == newTestRecord.TestPlanId);
if (getTrainTypeName != null)
Model.Training_TestRecord newTestRecord = new Model.Training_TestRecord
{
newTestRecord.TestType = getTrainTypeName.PlanName;
TestRecordId = SQLHelper.GetNewID(),
ProjectId = getTestPlan.ProjectId,
TestPlanId = getTestPlan.TestPlanId,
TestManId = personId,
};
if (string.IsNullOrEmpty(newTestRecord.TestType))
{
var getTrainTypeName = db.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == newTestRecord.TestPlanId);
if (getTrainTypeName != null)
{
newTestRecord.TestType = getTrainTypeName.PlanName;
}
}
TestRecordService.AddTestRecord(newTestRecord);
responeData.code = 3;
responeData.message = "您已加入考试计划!";
}
TestRecordService.AddTestRecord(newTestRecord);
responeData.code = 3;
responeData.message = "您已加入考试计划!";
}
}
}
}
}
}
if (responeData.code == 1)
{
//其他状态时 查看考试计划详细页
responeData.data = APITestPlanService.getTestPlanByTestPlanId(testPlanId);
if (responeData.code == 1)
{
//其他状态时 查看考试计划详细页
responeData.data = APITestPlanService.getTestPlanByTestPlanId(testPlanId);
}
}
}
catch (Exception ex)
@@ -374,6 +374,37 @@ namespace WebAPI.Controllers
return responeData;
}
#endregion
#endregion
/// <summary>
/// 重考
/// </summary>
/// <param name="testRecordId">试卷ID</param>
public Model.ResponeData getRetakeTestRecordByTestRecordId(string testRecordId)
{
var responeData = new Model.ResponeData();
try
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
string returnTestRecordId = string.Empty;
var getTestRecord = db.Training_TestRecord.FirstOrDefault(e => e.TestRecordId == testRecordId);
if (getTestRecord != null)
{
////重新生成一条考试记录 以及考试试卷
returnTestRecordId = APITestRecordService.getResitTestRecord(getTestRecord);
responeData.data = new { returnTestRecordId };
}
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
}
-8
View File
@@ -1,8 +0,0 @@
publickey
<RSAKeyValue><Modulus>rnq6pYDFkcrpzVtMrLbf2dvDPs2FDo5yeDub6YCnl0hXov3MVEVMbVe3NCnC5Thl3dwm14yI9/vNIGdH5M4getAkMnkG8tNA60NPjtHUzyoZSpVYCUOmB30s5vx+4IBkPh8R4ynkJYyUxkl61/0h6y7A86qz4jNivxAKt2a0vQxk=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>
privatekey
<RSAKeyValue><Modulus>1oowM965L1r9NM10IruHI+4v4cF8cMrZ1PMaG/D1oNOww8YGEYjKiQ2iAjAtJi4OQX6sxI7BHJad/CGNKeE12ywplO18J8vL/YvEq38DMen22ungNAjSmC6zmIngvBrIiyW2Cyws/9JQKxT02I1tZlEQ9q4ZxCc3PLFazTD0sIk=</Modulus><Exponent>AQAB</Exponent><P>2K+KCTgEGJAvPzB6pYcDmE2n/gIIy6dOiaNQtTWRUrttC+DaU8ZlORlYH6+lWcekYhGnf+dVjfuGE3w45JVKxw==</P><Q>/Xb6T/4tizVbVpjLd47SN+c1yEcCubLhv7HHd/9E2K5olboWvOGxUbr53F4FOmTu9CWpybbCKLReJWPQxq5aLw==</Q><DP>eA1Ztx3X9xv7cVEUwpz5OurbhnnuEZdShiN71comB+Zb1lbv37Zt4qLOFlAklodr5gHOAalT12Rhtm3+v3aPhQ==</DP><DQ>5VjUNK+1PEKijGAjs+I627TN2JRQpgFz/gX6jN0hycM/BURmMLEzxtWeI0W8C1OrWKX/1XMWishya/i+wBihpw==</DQ><InverseQ>wE16uAx/ztTMObpArwC2eGhh+oCwXsnUPoFSQtLHeEbxx/Cf424wKr2ceV/Fe9YKQp5XLdOpJkCDDAF+2k4X1A==</InverseQ><D>0rF/yVEQeQtY5ERpq7qTa5v99i448eSlrVbZ61rnP3zmej29s/atQY/b7V422OoeIgAv2BGCYXshyH2CzwBYDAtGkz+qvaZtPvWIYPadTvgU5W/QgX8r/ozqFBHu17APSSBmJWulShxj6r9kOmgxW4HzwVQ/iQgyQ5Z+qgpf50k=</D></RSAKeyValue>
Binary file not shown.
Binary file not shown.