积分优化
This commit is contained in:
@@ -1,17 +1,12 @@
|
||||
namespace FineUIPro.Web
|
||||
{
|
||||
using BLL;
|
||||
using FineUIPro.Web.Score;
|
||||
using Model;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
public class Global : System.Web.HttpApplication
|
||||
{
|
||||
@@ -26,7 +21,7 @@
|
||||
try
|
||||
{
|
||||
Funs.RootPath = Server.MapPath("~/");
|
||||
|
||||
|
||||
// 日志文件所在目录
|
||||
ErrLogInfo.DefaultErrLogFullPath = Server.MapPath("~/ErrLog.txt");
|
||||
Funs.ConnString = ConfigurationManager.AppSettings["ConnectionString"];
|
||||
@@ -60,7 +55,7 @@
|
||||
//定义一个定时器,并开启和配置相关属性
|
||||
System.Timers.Timer Wtimer = new System.Timers.Timer();
|
||||
//执行任务的周期 ,60分钟
|
||||
Wtimer.Interval =1000 * 60 * 60; //120000;
|
||||
Wtimer.Interval = 1000 * 60 * 60; //120000;
|
||||
Wtimer.Enabled = true;
|
||||
Wtimer.Start();
|
||||
Wtimer.Elapsed += new System.Timers.ElapsedEventHandler(Wtimer_Elapsed);
|
||||
@@ -74,9 +69,10 @@
|
||||
void Wtimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
//考试大于等于80分通过,且没有加过分的记录,加分
|
||||
var testRecordList = (from x in Funs.DB.View_Training_TestRecord where x.TestScores >= 80
|
||||
&& !Funs.DB.ScoreFlowLog.Any(log => log.DataSourceId == x.TestRecordId)
|
||||
orderby x.TestStartTime select x).ToList();
|
||||
var testRecordList = (from x in Funs.DB.View_Training_TestRecord
|
||||
where x.TestScores >= 80 && !Funs.DB.ScoreFlowLog.Any(log => log.DataSourceId == x.TestRecordId)
|
||||
orderby x.TestStartTime
|
||||
select x).ToList();
|
||||
foreach (var item in testRecordList)
|
||||
{
|
||||
//查找最新一条积分记录
|
||||
@@ -137,6 +133,7 @@
|
||||
newlog.CurrentScore = 102;
|
||||
}
|
||||
}
|
||||
newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore;
|
||||
BLL.ScoreFlowLogService.AddScoreFlowLog(newlog);
|
||||
|
||||
//人员记分情况
|
||||
@@ -203,6 +200,7 @@
|
||||
newlog.CurrentScore = 102;
|
||||
}
|
||||
}
|
||||
newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore;
|
||||
BLL.ScoreFlowLogService.AddScoreFlowLog(newlog);
|
||||
|
||||
//人员记分情况
|
||||
@@ -257,6 +255,7 @@
|
||||
{
|
||||
newlog.CurrentScore = 102;
|
||||
}
|
||||
newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore;
|
||||
BLL.ScoreFlowLogService.AddScoreFlowLog(newlog);
|
||||
|
||||
//人员记分情况
|
||||
@@ -327,6 +326,7 @@
|
||||
newlog.CurrentScore = 102;
|
||||
}
|
||||
}
|
||||
newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore;
|
||||
BLL.ScoreFlowLogService.AddScoreFlowLog(newlog);
|
||||
|
||||
//人员记分情况
|
||||
@@ -393,6 +393,7 @@
|
||||
newlog.CurrentScore = 102;
|
||||
}
|
||||
}
|
||||
newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore;
|
||||
BLL.ScoreFlowLogService.AddScoreFlowLog(newlog);
|
||||
|
||||
//人员记分情况
|
||||
@@ -459,6 +460,7 @@
|
||||
newlog.CurrentScore = 102;
|
||||
}
|
||||
}
|
||||
newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore;
|
||||
BLL.ScoreFlowLogService.AddScoreFlowLog(newlog);
|
||||
|
||||
//人员记分情况
|
||||
@@ -512,6 +514,7 @@
|
||||
{
|
||||
newlog.CurrentScore = 102;
|
||||
}
|
||||
newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore;
|
||||
BLL.ScoreFlowLogService.AddScoreFlowLog(newlog);
|
||||
|
||||
//人员记分情况
|
||||
@@ -541,7 +544,7 @@
|
||||
}
|
||||
|
||||
protected void Application_BeginRequest(object sender, EventArgs e)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
protected void Application_AuthenticateRequest(object sender, EventArgs e)
|
||||
@@ -601,8 +604,8 @@
|
||||
{
|
||||
if (errLog != null)
|
||||
{
|
||||
db.Sys_ErrLogInfo.InsertOnSubmit(newErr);
|
||||
db.SubmitChanges();
|
||||
db.Sys_ErrLogInfo.InsertOnSubmit(newErr);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
ErrLogInfo.WriteLog(newErr.ErrLogId, ex, errLog == null ? null : errLog.ToString());
|
||||
|
||||
Reference in New Issue
Block a user