积分优化
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Model;
|
||||
using NPOI.SS.UserModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -20,7 +19,6 @@ namespace BLL
|
||||
{
|
||||
return Funs.DB.ScoreUser.FirstOrDefault(e => e.Id == Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据证件号码获取人员今年上一条得分记录
|
||||
/// </summary>
|
||||
@@ -55,17 +53,27 @@ namespace BLL
|
||||
/// <param name="model">人员得分实体</param>
|
||||
public static void AddScoreUser(Model.ScoreUser model)
|
||||
{
|
||||
Model.ScoreUser newModel = new Model.ScoreUser();
|
||||
newModel.Id = model.Id;
|
||||
newModel.Year = model.Year;
|
||||
newModel.IdentityCard = model.IdentityCard;
|
||||
newModel.UserName = model.UserName;
|
||||
newModel.Score = model.Score;
|
||||
newModel.CompileDate = model.CompileDate;
|
||||
newModel.DataSourceId = model.DataSourceId;
|
||||
newModel.CheckDate = model.CheckDate;
|
||||
Funs.DB.ScoreUser.InsertOnSubmit(newModel);
|
||||
Funs.DB.SubmitChanges();
|
||||
var su = Funs.DB.ScoreUser.FirstOrDefault(e => e.IdentityCard == model.IdentityCard && e.Year == model.Year);
|
||||
if (su != null)
|
||||
{//已存在,修改人员今年得分值
|
||||
su.Score = model.Score;
|
||||
su.CompileDate = model.CompileDate;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.ScoreUser newModel = new Model.ScoreUser();
|
||||
newModel.Id = model.Id;
|
||||
newModel.Year = model.Year;
|
||||
newModel.IdentityCard = model.IdentityCard;
|
||||
newModel.UserName = model.UserName;
|
||||
newModel.Score = model.Score;
|
||||
newModel.CompileDate = model.CompileDate;
|
||||
newModel.DataSourceId = model.DataSourceId;
|
||||
newModel.CheckDate = model.CheckDate;
|
||||
Funs.DB.ScoreUser.InsertOnSubmit(newModel);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user