1、优化考勤记录导入,优化出入记录写实名制推送记录表。2、优化考试答题,交卷接口方法。3、优化写入培训记录。

This commit is contained in:
2022-06-16 17:34:24 +08:00
parent b913f49cd8
commit 85a8b510ac
29 changed files with 488 additions and 534 deletions
+15 -10
View File
@@ -17,19 +17,20 @@ namespace BLL
/// <param name="changeTime">进出方式</param>
public static void SaveDoorInOutRecord(string projectId, string idCard, int isIn, DateTime changeTime, string Intype)
{
Model.SitePerson_Person getPerson = new Model.SitePerson_Person();
int maxId = 0;
string name = string.Empty;
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
int maxId = 0;
string name = string.Empty;
var getPersonByIdCard = db.SitePerson_Person.Where(x => x.IdentityCard == idCard).OrderByDescending(x=>x.InTime).FirstOrDefault();
if (getPersonByIdCard != null)
getPerson = db.SitePerson_Person.Where(x => x.IdentityCard == idCard).OrderByDescending(x => x.InTime).FirstOrDefault();
if (getPerson != null)
{
name = getPersonByIdCard.PersonName;
projectId = getPersonByIdCard.ProjectId;
name = getPerson.PersonName;
projectId = getPerson.ProjectId;
}
else
{
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == idCard && x.ProjectId == projectId);
getPerson = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == idCard && x.ProjectId == projectId);
if (getPerson != null)
{
name = getPerson.PersonName;
@@ -41,7 +42,7 @@ namespace BLL
{
maxId = getmax.Max() + 1;
}
Model.T_d_facerecord newFacerecord = new Model.T_d_facerecord()
{
NewID = SQLHelper.GetNewID(),
@@ -56,7 +57,10 @@ namespace BLL
};
db.T_d_facerecord.InsertOnSubmit(newFacerecord);
db.SubmitChanges();
}
if (getPerson != null)
{
///// 根据出入记录 写入考勤记录
Model.t_d_facerecordItem facerecord = new Model.t_d_facerecordItem
{
@@ -70,9 +74,10 @@ namespace BLL
RecordDes = Intype,
InOrOut = (isIn == 1 ? "进门" : "出门"),
};
DoorServerService.InsertEmployInOutRecord(facerecord);
DoorServerService.InsertEmployInOutRecord(facerecord, getPerson);
APIPersonService.getPersonInOut(getPerson, isIn, changeTime);
}
APIPersonService.getPersonInOut(projectId, idCard, isIn, changeTime);
}
}
}
+6 -7
View File
@@ -1046,13 +1046,12 @@ namespace BLL
/// <param name="idCard"></param>
/// <param name="isIn"></param>
/// <param name="changeTime"></param>
public static void getPersonInOut(string projectId, string idCard, int isIn, DateTime changeTime)
public static void getPersonInOut(Model.SitePerson_Person getPerson, int isIn, DateTime changeTime)
{
if (!string.IsNullOrEmpty(idCard))
if (!string.IsNullOrEmpty(getPerson.IdentityCard))
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.ProjectId == projectId && x.IdentityCard == idCard);
{
if (getPerson != null)
{
string postType = null;
@@ -1061,13 +1060,13 @@ namespace BLL
{
postType = getWokPost.PostType;
}
var getPersonInOut = db.SitePerson_PersonInOut.FirstOrDefault(x => x.PersonId == getPerson.PersonId && x.ProjectId == projectId && x.ChangeTime == changeTime);
var getPersonInOut = db.SitePerson_PersonInOut.FirstOrDefault(x => x.PersonId == getPerson.PersonId && x.ProjectId == getPerson.ProjectId && x.ChangeTime == changeTime);
if (getPersonInOut == null)
{
Model.SitePerson_PersonInOut newInOut = new Model.SitePerson_PersonInOut
{
PersonInOutId = SQLHelper.GetNewID(),
ProjectId = projectId,
ProjectId = getPerson.ProjectId,
UnitId = getPerson.UnitId,
PersonId = getPerson.PersonId,
IsIn = isIn == 1 ? true : false,
@@ -1079,7 +1078,7 @@ namespace BLL
db.SitePerson_PersonInOut.InsertOnSubmit(newInOut);
db.SubmitChanges();
string proCode = ProjectService.GetJTProjectCodeByProjectId(projectId);
string proCode = ProjectService.GetJTProjectCodeByProjectId(getPerson.ProjectId);
Model.SitePerson_PersonInOutNow newNow = new Model.SitePerson_PersonInOutNow
{
PersonInOutId = newInOut.PersonInOutId,
+8
View File
@@ -245,6 +245,14 @@ namespace BLL
TestType = item.TestType,
Duration = newTestPlan.Duration,
};
if (string.IsNullOrEmpty(newTrainDetail.TestType))
{
var getTrainTypeName = db.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == newTrainDetail.TestPlanId);
if (getTrainTypeName != null)
{
newTrainDetail.TestType = getTrainTypeName.PlanName;
}
}
db.Training_TestRecord.InsertOnSubmit(newTrainDetail);
db.SubmitChanges();
}
+6 -53
View File
@@ -21,7 +21,6 @@ namespace BLL
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getDataLists = (from x in db.Training_TestRecord
join y in db.SitePerson_Person on x.TestManId equals y.PersonId
where x.TestPlanId == testPlanId
orderby x.TestStartTime descending
select new Model.TestRecordItem
@@ -30,7 +29,7 @@ namespace BLL
ProjectId = x.ProjectId,
TestPlanId = x.TestPlanId,
TestManId = x.TestManId,
TestManName = y.PersonName,
//TestManName = db.SitePerson_Person.First(p=>x.TestManId ==p.PersonId).PersonName,
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
TestScores = x.TestScores ?? 0,
@@ -100,21 +99,20 @@ namespace BLL
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getDataLists = from x in db.Training_TestRecord
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
var getDataLists = from x in db.Training_TestRecord
where x.TestRecordId == testRecordId
select new Model.TestRecordItem
{
TestRecordId = x.TestRecordId,
ProjectId = x.ProjectId,
TestPlanId = x.TestPlanId,
TestPlanName = y.PlanName,
TestPlanName = x.TestType,
TestManId = x.TestManId,
TestManName = db.SitePerson_Person.First(u => u.PersonId == x.TestManId).PersonName,
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
TestPlanEndTime = x.TestStartTime.HasValue ? string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime.Value.AddMinutes(x.Duration)) : "",
Duration = y.Duration,
Duration = x.Duration,
TestScores = x.TestScores ?? 0,
TestType = x.TestType,
TemporaryUser = x.TemporaryUser,
@@ -572,62 +570,17 @@ namespace BLL
var getRItem = db.Training_TestRecordItem.Where(x => x.TestRecordId == getTestRecord.TestRecordId);
if (getRItem.Count() > 0)
{
getTestRecord.TestScores = getRItem.Sum(x => x.SubjectScore);
getTestRecord.TestScores = getRItem.Sum(x => x.SubjectScore ?? 0);
}
db.SubmitChanges();
getCode = getTestRecord.TestScores ?? 0;
}
}
return getCode;
}
#endregion
/// <summary>
///
/// </summary>
/// <param name="testPlanId"></param>
public static void updateAll(string testPlanId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
//// 获取考试计划
var getTestPlan = db.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == testPlanId);
if (getTestPlan != null)
{
//// 获取参加考试 记录
var getAllTestRecords = db.Training_TestRecord.Where(x => x.TestPlanId == getTestPlan.TestPlanId);
if (getAllTestRecords.Count() > 0)
{
/// 参加考试人数
int testManCout = getAllTestRecords.Select(x => x.TestManId).Distinct().Count();
//// 获取培训计划人员
var getAllTrainingTasks = db.Training_Task.Where(x => x.PlanId == getTestPlan.PlanId);
//// 考试人数大于等于 培训人数
if (testManCout >= getAllTrainingTasks.Count())
{
////所有人员 都交卷时 考试计划结束 状态置为3
var getAllTestRecord = getAllTestRecords.FirstOrDefault(x => !x.TestEndTime.HasValue);
if (getAllTestRecord == null)
{
var getTrainingTasks = getAllTrainingTasks.Where(x => x.States != "2" || x.States == null);
foreach (var item in getTrainingTasks)
{
item.States = "2";
db.SubmitChanges();
}
getTestPlan.States = "3";
db.SubmitChanges();
////TODO 讲培训计划 考试记录 写入到培训记录
APITrainRecordService.InsertTrainRecord(getTestPlan);
}
}
}
}
}
}
#region 根据TestRecord生成一条补考记录
/// <summary>
/// 根据TestRecord生成一条补考记录
-1
View File
@@ -412,7 +412,6 @@ namespace BLL
catch
{
return null;
}
}
#endregion
+1
View File
@@ -42,6 +42,7 @@ namespace BLL
///删除文件柜A中数据
// BLL.FileCabinetAItemService.DeleteFileCabinetAItemByID(dataId);
Funs.DB.Sys_CodeRecords.DeleteOnSubmit(codeRecords);
Funs.DB.SubmitChanges();
}
}
+29 -35
View File
@@ -305,49 +305,43 @@ namespace BLL
/// <param name="toKeyId"></param>
public static void SaveAttachUrl(string source, string attachUrl,string menuId,string toKeyId)
{
string rootUrl = ConfigurationManager.AppSettings["localRoot"];
if (string.IsNullOrEmpty(rootUrl))
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
rootUrl = Funs.RootPath;
}
List<Model.AttachFile> sour = (from x in Funs.DB.AttachFile
where x.MenuId == menuId && x.ToKeyId == toKeyId
select x).ToList();
if (sour.Count() == 0)
{
Model.AttachFile att = new Model.AttachFile
string rootUrl = ConfigurationManager.AppSettings["localRoot"];
if (string.IsNullOrEmpty(rootUrl))
{
AttachFileId = SQLHelper.GetNewID(),
ToKeyId = toKeyId,
AttachSource = source.ToString(),
AttachUrl = attachUrl,
MenuId = menuId,
//ImageByte= imageByte,
//AttachPath= attachPath,
};
if (menuId == Const.PersonListMenuId)
{
att.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]);
rootUrl = Funs.RootPath;
}
Funs.DB.AttachFile.InsertOnSubmit(att);
Funs.DB.SubmitChanges();
}
else
{
Model.AttachFile att = Funs.DB.AttachFile.FirstOrDefault(x => x.MenuId == menuId && x.AttachFileId == sour.First().AttachFileId);
if (att != null)
var sour = db.AttachFile.FirstOrDefault(x => x.MenuId == menuId && x.ToKeyId == toKeyId);
if (sour == null)
{
att.ToKeyId = toKeyId;
att.AttachSource = source.ToString();
att.AttachUrl = attachUrl;
att.MenuId = menuId;
Model.AttachFile att = new Model.AttachFile
{
AttachFileId = SQLHelper.GetNewID(),
ToKeyId = toKeyId,
AttachSource = source.ToString(),
AttachUrl = attachUrl,
MenuId = menuId,
//ImageByte= imageByte,
//AttachPath= attachPath,
};
if (menuId == Const.PersonListMenuId)
{
att.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]);
}
Funs.DB.SubmitChanges();
db.AttachFile.InsertOnSubmit(att);
db.SubmitChanges();
}
else
{
sour.AttachSource = source.ToString();
sour.AttachUrl = attachUrl;
if (menuId == Const.PersonListMenuId)
{
sour.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]);
}
db.SubmitChanges();
}
}
}
+13 -18
View File
@@ -27,7 +27,7 @@ namespace BLL
/// <summary>
/// 根据出入记录 写入考勤记录
/// </summary>
public static void InsertEmployInOutRecord(Model.t_d_facerecordItem drecord)
public static void InsertEmployInOutRecord(Model.t_d_facerecordItem drecord,Model.SitePerson_Person getPerson)
{
if (drecord.DateTimeRecord.HasValue)
{
@@ -41,24 +41,19 @@ namespace BLL
RecordDate = drecord.DateTimeRecord.Value.Date,
IDCardNo = drecord.IDCardNo,
};
////获取人员
var getPserson = PersonService.GetPersonByIdentityCard(drecord.ProjectId, drecord.IDCardNo);
if (getPserson == null)
////获取人员
if (getPerson != null)
{
getPserson = PersonService.GetPersonByName(drecord.ProjectId, drecord.EmployName);
}
if (getPserson != null)
{
newInOutRecord.UnitId = getPserson.UnitId;
newInOutRecord.UnitName = UnitService.GetUnitNameByUnitId(getPserson.UnitId);
newInOutRecord.DepartmentID = getPserson.TeamGroupId;
newInOutRecord.DepartName = TeamGroupService.GetTeamGroupNameByTeamGroupId(getPserson.TeamGroupId);
newInOutRecord.EmployNO = getPserson.CardNo;
newInOutRecord.EmployName = getPserson.PersonName;
newInOutRecord.Nation = getPserson.Nation;
newInOutRecord.NationName = BasicDataService.GetDictNameByDictCode(getPserson.Nation);
newInOutRecord.PostId = getPserson.WorkPostId;
newInOutRecord.PostName = WorkPostService.getWorkPostNameById(getPserson.WorkPostId);
newInOutRecord.UnitId = getPerson.UnitId;
newInOutRecord.UnitName = UnitService.GetUnitNameByUnitId(getPerson.UnitId);
newInOutRecord.DepartmentID = getPerson.TeamGroupId;
newInOutRecord.DepartName = TeamGroupService.GetTeamGroupNameByTeamGroupId(getPerson.TeamGroupId);
newInOutRecord.EmployNO = getPerson.CardNo;
newInOutRecord.EmployName = getPerson.PersonName;
newInOutRecord.Nation = getPerson.Nation;
newInOutRecord.NationName = BasicDataService.GetDictNameByDictCode(getPerson.Nation);
newInOutRecord.PostId = getPerson.WorkPostId;
newInOutRecord.PostName = WorkPostService.getWorkPostNameById(getPerson.WorkPostId);
}
else
{
@@ -59,11 +59,24 @@ namespace BLL
/// <param name="companyTrainingId"></param>
public static void DeleteCompanyTraining(string companyTrainingId)
{
Model.Training_CompanyTraining companyTraining = db.Training_CompanyTraining.FirstOrDefault(e => e.CompanyTrainingId == companyTrainingId);
if (companyTraining!=null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Training_CompanyTraining.DeleteOnSubmit(companyTraining);
db.SubmitChanges();
var companyTraining = db.Training_CompanyTraining.FirstOrDefault(e => e.CompanyTrainingId == companyTrainingId);
if (companyTraining != null)
{
var delItem = from x in db.Training_PlanItem where x.CompanyTrainingId == companyTrainingId select x;
if (delItem.Count() > 0)
{
db.Training_PlanItem.DeleteAllOnSubmit(delItem);
}
var delItemc = from x in db.Training_CompanyTrainingItem where x.CompanyTrainingId == companyTrainingId select x;
if (delItemc.Count() > 0)
{
db.Training_CompanyTrainingItem.DeleteAllOnSubmit(delItemc);
}
db.Training_CompanyTraining.DeleteOnSubmit(companyTraining);
db.SubmitChanges();
}
}
}
@@ -98,13 +98,12 @@ namespace BLL
/// </summary>
/// <param name="trainingId"></param>
public static void DeleteTrainDetailByTrainDetail(string trainDetailId)
{
Model.SGGLDB db = Funs.DB;
{
Model.EduTrain_TrainRecordDetail trainDetails = Funs.DB.EduTrain_TrainRecordDetail.FirstOrDefault(e => e.TrainDetailId == trainDetailId);
if (trainDetails != null)
{
db.EduTrain_TrainRecordDetail.DeleteOnSubmit(trainDetails);
db.SubmitChanges();
Funs.DB.EduTrain_TrainRecordDetail.DeleteOnSubmit(trainDetails);
Funs.DB.SubmitChanges();
var rainRecord = EduTrain_TrainRecordService.GetTrainingByTrainingId(trainDetails.TrainingId);
if (rainRecord != null)
@@ -77,8 +77,7 @@ namespace BLL
/// <param name="training">教育培训实体</param>
public static void UpdateTraining(Model.EduTrain_TrainRecord training)
{
Model.SGGLDB db = Funs.DB;
Model.EduTrain_TrainRecord newTraining = db.EduTrain_TrainRecord.FirstOrDefault(e => e.TrainingId == training.TrainingId);
Model.EduTrain_TrainRecord newTraining = Funs.DB.EduTrain_TrainRecord.FirstOrDefault(e => e.TrainingId == training.TrainingId);
if (newTraining != null)
{
newTraining.TrainingCode = training.TrainingCode;
@@ -107,7 +106,7 @@ namespace BLL
newTraining.TrainPersonNum = training.TrainPersonNum;
newTraining.FromRecordId = training.FromRecordId;
newTraining.WorkPostIds = training.WorkPostIds;
db.SubmitChanges();
Funs.DB.SubmitChanges();
}
}
+2 -7
View File
@@ -38,15 +38,10 @@ namespace BLL
if (string.IsNullOrEmpty(newTestRecord.TestType))
{
var getTrainTypeName = (from x in db.Training_TestPlan
join y in db.Training_Plan on x.PlanId equals y.PlanId
join z in db.Base_TrainType on y.TrainTypeId equals z.TrainTypeId
where x.TestPlanId == testRecord.TestPlanId
select z).FirstOrDefault();
var getTrainTypeName = db.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == testRecord.TestPlanId);
if (getTrainTypeName != null)
{
testRecord.TestType = getTrainTypeName.TrainTypeName;
newTestRecord.TestType = getTrainTypeName.PlanName;
}
}
+17 -9
View File
@@ -63,18 +63,26 @@ namespace BLL
/// <param name="TrainingId"></param>
public static void DeleteTestTrainingById(string TrainingId)
{
Model.SGGLDB db = Funs.DB;
Model.Training_TestTraining TestTraining = db.Training_TestTraining.FirstOrDefault(e => e.TrainingId == TrainingId);
if (TestTraining != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var TrainingItem = from x in db.Training_TestTrainingItem where x.TrainingId == TrainingId select x;
if (TrainingItem.Count() > 0)
var TestTraining = db.Training_TestTraining.FirstOrDefault(e => e.TrainingId == TrainingId);
if (TestTraining != null)
{
db.Training_TestTrainingItem.DeleteAllOnSubmit(TrainingItem);
}
var testPlanTraining = from x in db.Training_TestPlanTraining where x.TrainingId == TrainingId select x;
if (testPlanTraining.Count() > 0)
{
db.Training_TestPlanTraining.DeleteAllOnSubmit(testPlanTraining);
}
db.Training_TestTraining.DeleteOnSubmit(TestTraining);
db.SubmitChanges();
var TrainingItem = from x in db.Training_TestTrainingItem where x.TrainingId == TrainingId select x;
if (TrainingItem.Count() > 0)
{
db.Training_TestTrainingItem.DeleteAllOnSubmit(TrainingItem);
}
db.Training_TestTraining.DeleteOnSubmit(TestTraining);
db.SubmitChanges();
}
}
}
@@ -73,11 +73,11 @@ namespace BLL
/// <param name="taskId"></param>
public static void DeleteTaskById(string taskId)
{
Model.Training_Task task = db.Training_Task.FirstOrDefault(e => e.TaskId == taskId);
Model.Training_Task task = Funs.DB.Training_Task.FirstOrDefault(e => e.TaskId == taskId);
if (task != null)
{
db.Training_Task.DeleteOnSubmit(task);
db.SubmitChanges();
Funs.DB.Training_Task.DeleteOnSubmit(task);
Funs.DB.SubmitChanges();
}
}
@@ -86,18 +86,17 @@ namespace BLL
/// </summary>
/// <param name="planId"></param>
public static void DeleteTaskByPlanId(string planId)
{
Model.SGGLDB db = Funs.DB;
var tasks = from x in db.Training_Task where x.PlanId == planId select x;
{
var tasks = from x in Funs.DB.Training_Task where x.PlanId == planId select x;
if (tasks.Count() > 0)
{
var taskItems = from x in db.Training_TaskItem where x.PlanId == planId select x;
var taskItems = from x in Funs.DB.Training_TaskItem where x.PlanId == planId select x;
if (tasks.Count() > 0)
{
db.Training_TaskItem.DeleteAllOnSubmit(taskItems);
Funs.DB.Training_TaskItem.DeleteAllOnSubmit(taskItems);
}
db.Training_Task.DeleteAllOnSubmit(tasks);
Funs.DB.Training_Task.DeleteAllOnSubmit(tasks);
}
}
}
@@ -78,48 +78,50 @@ namespace BLL
/// <param name="hazardRegister">危险观察登记实体</param>
public static void UpdateHazardRegister(Model.HSSE_Hazard_HazardRegister hazardRegister)
{
Model.SGGLDB db = Funs.DB;
Model.HSSE_Hazard_HazardRegister newHazardRegister = db.HSSE_Hazard_HazardRegister.FirstOrDefault(e => e.HazardRegisterId == hazardRegister.HazardRegisterId);
if (newHazardRegister != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
newHazardRegister.HazardCode = hazardRegister.HazardCode;
newHazardRegister.RegisterDef = hazardRegister.RegisterDef;
newHazardRegister.Rectification = hazardRegister.Rectification;
newHazardRegister.Place = hazardRegister.Place;
newHazardRegister.ResponsibleUnit = hazardRegister.ResponsibleUnit;
newHazardRegister.Observer = hazardRegister.Observer;
newHazardRegister.RectifiedDate = hazardRegister.RectifiedDate;
newHazardRegister.AttachUrl = hazardRegister.AttachUrl;
newHazardRegister.ProjectId = hazardRegister.ProjectId;
newHazardRegister.States = hazardRegister.States;
newHazardRegister.Requirements = hazardRegister.Requirements;
newHazardRegister.IsEffective = hazardRegister.IsEffective;
newHazardRegister.ResponsibleMan = hazardRegister.ResponsibleMan;
newHazardRegister.CheckManId = hazardRegister.CheckManId;
//newHazardRegister.CheckTime = hazardRegister.CheckTime;
newHazardRegister.RectificationPeriod = hazardRegister.RectificationPeriod;
newHazardRegister.ImageUrl = hazardRegister.ImageUrl;
newHazardRegister.RectificationImageUrl = hazardRegister.RectificationImageUrl;
newHazardRegister.RectificationTime = hazardRegister.RectificationTime;
newHazardRegister.ConfirmMan = hazardRegister.ConfirmMan;
newHazardRegister.ConfirmDate = hazardRegister.ConfirmDate;
newHazardRegister.HandleIdea = hazardRegister.HandleIdea;
newHazardRegister.CutPayment = hazardRegister.CutPayment;
newHazardRegister.ProblemTypes = hazardRegister.ProblemTypes;
newHazardRegister.DIC_ID = hazardRegister.DIC_ID;
//把附件表的路径复制过来
Model.AttachFile file = BLL.AttachFileService.GetAttachFile(hazardRegister.HazardRegisterId, Const.HSSE_HiddenRectificationListMenuId);
if (file != null)
Model.HSSE_Hazard_HazardRegister newHazardRegister = db.HSSE_Hazard_HazardRegister.FirstOrDefault(e => e.HazardRegisterId == hazardRegister.HazardRegisterId);
if (newHazardRegister != null)
{
newHazardRegister.ImageUrl = file.AttachUrl;
}
Model.AttachFile fileR = BLL.AttachFileService.GetAttachFile(hazardRegister.HazardRegisterId + "-R", Const.HSSE_HiddenRectificationListMenuId);
if (fileR != null)
{
newHazardRegister.RectificationImageUrl = fileR.AttachUrl;
}
newHazardRegister.HazardCode = hazardRegister.HazardCode;
newHazardRegister.RegisterDef = hazardRegister.RegisterDef;
newHazardRegister.Rectification = hazardRegister.Rectification;
newHazardRegister.Place = hazardRegister.Place;
newHazardRegister.ResponsibleUnit = hazardRegister.ResponsibleUnit;
newHazardRegister.Observer = hazardRegister.Observer;
newHazardRegister.RectifiedDate = hazardRegister.RectifiedDate;
newHazardRegister.AttachUrl = hazardRegister.AttachUrl;
newHazardRegister.ProjectId = hazardRegister.ProjectId;
newHazardRegister.States = hazardRegister.States;
newHazardRegister.Requirements = hazardRegister.Requirements;
newHazardRegister.IsEffective = hazardRegister.IsEffective;
newHazardRegister.ResponsibleMan = hazardRegister.ResponsibleMan;
newHazardRegister.CheckManId = hazardRegister.CheckManId;
//newHazardRegister.CheckTime = hazardRegister.CheckTime;
newHazardRegister.RectificationPeriod = hazardRegister.RectificationPeriod;
newHazardRegister.ImageUrl = hazardRegister.ImageUrl;
newHazardRegister.RectificationImageUrl = hazardRegister.RectificationImageUrl;
newHazardRegister.RectificationTime = hazardRegister.RectificationTime;
newHazardRegister.ConfirmMan = hazardRegister.ConfirmMan;
newHazardRegister.ConfirmDate = hazardRegister.ConfirmDate;
newHazardRegister.HandleIdea = hazardRegister.HandleIdea;
newHazardRegister.CutPayment = hazardRegister.CutPayment;
newHazardRegister.ProblemTypes = hazardRegister.ProblemTypes;
newHazardRegister.DIC_ID = hazardRegister.DIC_ID;
//把附件表的路径复制过来
Model.AttachFile file = BLL.AttachFileService.GetAttachFile(hazardRegister.HazardRegisterId, Const.HSSE_HiddenRectificationListMenuId);
if (file != null)
{
newHazardRegister.ImageUrl = file.AttachUrl;
}
Model.AttachFile fileR = BLL.AttachFileService.GetAttachFile(hazardRegister.HazardRegisterId + "-R", Const.HSSE_HiddenRectificationListMenuId);
if (fileR != null)
{
newHazardRegister.RectificationImageUrl = fileR.AttachUrl;
}
db.SubmitChanges();
db.SubmitChanges();
}
}
}
@@ -129,8 +131,7 @@ namespace BLL
/// <param name="hazardRegisterId">危险观察登记主键</param>
public static void DeleteHazardRegisterByHazardRegisterId(string hazardRegisterId)
{
Model.SGGLDB db = Funs.DB;
var hazardRegister = db.HSSE_Hazard_HazardRegister.FirstOrDefault(e => e.HazardRegisterId == hazardRegisterId);
var hazardRegister = Funs.DB.HSSE_Hazard_HazardRegister.FirstOrDefault(e => e.HazardRegisterId == hazardRegisterId);
if (hazardRegister != null)
{
try
@@ -141,8 +142,8 @@ namespace BLL
catch (Exception)
{
}
db.HSSE_Hazard_HazardRegister.DeleteOnSubmit(hazardRegister);
db.SubmitChanges();
Funs.DB.HSSE_Hazard_HazardRegister.DeleteOnSubmit(hazardRegister);
Funs.DB.SubmitChanges();
}
}
+47 -44
View File
@@ -100,51 +100,54 @@ namespace BLL
/// <param name="updateHSSELog"></param>
public static void UpdateHSSELog(Model.Manager_HSSELog updateHSSELog)
{
Model.Manager_HSSELog newHSSELog = Funs.DB.Manager_HSSELog.FirstOrDefault(e => e.HSSELogId == updateHSSELog.HSSELogId);
if (newHSSELog != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
newHSSELog.CompileDate = updateHSSELog.CompileDate;
newHSSELog.CompileMan = updateHSSELog.CompileMan;
newHSSELog.Weather = updateHSSELog.Weather;
newHSSELog.IsVisible = updateHSSELog.IsVisible;
newHSSELog.Num11 = updateHSSELog.Num11;
newHSSELog.Contents12 = updateHSSELog.Contents12;
newHSSELog.Contents13 = updateHSSELog.Contents13;
newHSSELog.Contents21 = updateHSSELog.Contents21;
newHSSELog.Num21 = updateHSSELog.Num21;
newHSSELog.Contents22 = updateHSSELog.Contents22;
newHSSELog.Num22 = updateHSSELog.Num22;
newHSSELog.Contents23 = updateHSSELog.Contents23;
newHSSELog.Num23 = updateHSSELog.Num23;
newHSSELog.Contents24 = updateHSSELog.Contents24;
newHSSELog.Num24 = updateHSSELog.Num24;
newHSSELog.Contents25 = updateHSSELog.Contents25;
newHSSELog.Num25 = updateHSSELog.Num25;
newHSSELog.Contents26 = updateHSSELog.Contents26;
newHSSELog.Num26 = updateHSSELog.Num26;
newHSSELog.Contents27 = updateHSSELog.Contents27;
newHSSELog.Num27 = updateHSSELog.Num27;
newHSSELog.Contents28 = updateHSSELog.Contents28;
newHSSELog.Num28 = updateHSSELog.Num28;
newHSSELog.Contents29 = updateHSSELog.Contents29;
newHSSELog.Num29 = updateHSSELog.Num29;
newHSSELog.Contents210 = updateHSSELog.Contents210;
newHSSELog.Num210 = updateHSSELog.Num210;
newHSSELog.Num211 = updateHSSELog.Num211;
newHSSELog.Contents31 = updateHSSELog.Contents31;
newHSSELog.Num31 = updateHSSELog.Num31;
newHSSELog.Contents32 = updateHSSELog.Contents32;
newHSSELog.Num32 = updateHSSELog.Num32;
newHSSELog.Contents33 = updateHSSELog.Contents33;
newHSSELog.Num33 = updateHSSELog.Num33;
newHSSELog.Contents34 = updateHSSELog.Contents34;
newHSSELog.Num34 = updateHSSELog.Num34;
newHSSELog.Contents41 = updateHSSELog.Contents41;
newHSSELog.Contents42 = updateHSSELog.Contents42;
newHSSELog.Contents43 = updateHSSELog.Contents43;
newHSSELog.Contents51 = updateHSSELog.Contents51;
newHSSELog.Contents52 = updateHSSELog.Contents52;
Funs.DB.SubmitChanges();
Model.Manager_HSSELog newHSSELog =db.Manager_HSSELog.FirstOrDefault(e => e.HSSELogId == updateHSSELog.HSSELogId);
if (newHSSELog != null)
{
newHSSELog.CompileDate = updateHSSELog.CompileDate;
newHSSELog.CompileMan = updateHSSELog.CompileMan;
newHSSELog.Weather = updateHSSELog.Weather;
newHSSELog.IsVisible = updateHSSELog.IsVisible;
newHSSELog.Num11 = updateHSSELog.Num11;
newHSSELog.Contents12 = updateHSSELog.Contents12;
newHSSELog.Contents13 = updateHSSELog.Contents13;
newHSSELog.Contents21 = updateHSSELog.Contents21;
newHSSELog.Num21 = updateHSSELog.Num21;
newHSSELog.Contents22 = updateHSSELog.Contents22;
newHSSELog.Num22 = updateHSSELog.Num22;
newHSSELog.Contents23 = updateHSSELog.Contents23;
newHSSELog.Num23 = updateHSSELog.Num23;
newHSSELog.Contents24 = updateHSSELog.Contents24;
newHSSELog.Num24 = updateHSSELog.Num24;
newHSSELog.Contents25 = updateHSSELog.Contents25;
newHSSELog.Num25 = updateHSSELog.Num25;
newHSSELog.Contents26 = updateHSSELog.Contents26;
newHSSELog.Num26 = updateHSSELog.Num26;
newHSSELog.Contents27 = updateHSSELog.Contents27;
newHSSELog.Num27 = updateHSSELog.Num27;
newHSSELog.Contents28 = updateHSSELog.Contents28;
newHSSELog.Num28 = updateHSSELog.Num28;
newHSSELog.Contents29 = updateHSSELog.Contents29;
newHSSELog.Num29 = updateHSSELog.Num29;
newHSSELog.Contents210 = updateHSSELog.Contents210;
newHSSELog.Num210 = updateHSSELog.Num210;
newHSSELog.Num211 = updateHSSELog.Num211;
newHSSELog.Contents31 = updateHSSELog.Contents31;
newHSSELog.Num31 = updateHSSELog.Num31;
newHSSELog.Contents32 = updateHSSELog.Contents32;
newHSSELog.Num32 = updateHSSELog.Num32;
newHSSELog.Contents33 = updateHSSELog.Contents33;
newHSSELog.Num33 = updateHSSELog.Num33;
newHSSELog.Contents34 = updateHSSELog.Contents34;
newHSSELog.Num34 = updateHSSELog.Num34;
newHSSELog.Contents41 = updateHSSELog.Contents41;
newHSSELog.Contents42 = updateHSSELog.Contents42;
newHSSELog.Contents43 = updateHSSELog.Contents43;
newHSSELog.Contents51 = updateHSSELog.Contents51;
newHSSELog.Contents52 = updateHSSELog.Contents52;
db.SubmitChanges();
}
}
}
+69 -72
View File
@@ -40,67 +40,60 @@ namespace BLL
/// <param name="PersonInOut"></param>
public static void InsertPersonInOutNowNow(Model.SitePerson_PersonInOutNow PersonInOut)
{
Model.SGGLDB db = Funs.DB;
var getNow = db.SitePerson_PersonInOutNow.FirstOrDefault(x => x.PersonInOutId == PersonInOut.PersonInOutId);
if (getNow == null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.SitePerson_PersonInOutNow newPersonInOut = new Model.SitePerson_PersonInOutNow
var getNow = db.SitePerson_PersonInOutNow.FirstOrDefault(x => x.PersonInOutId == PersonInOut.PersonInOutId);
if (getNow == null)
{
PersonInOutId = PersonInOut.PersonInOutId,
ProjectId = PersonInOut.ProjectId,
UnitId = PersonInOut.UnitId,
PersonId = PersonInOut.PersonId,
IsIn = PersonInOut.IsIn,
ChangeTime = PersonInOut.ChangeTime,
WorkPostId = PersonInOut.WorkPostId,
PostType = PersonInOut.PostType,
ProCode = PersonInOut.ProCode,
Name = PersonInOut.Name,
IdcardType = PersonInOut.IdcardType ?? "SHENFEN_ZHENGJIAN",
IdcardNumber = PersonInOut.IdcardNumber,
CheckType = "ZHENGCHANG_KAOQINLEIBIE",
CheckWay = "FACE_FANGSHI",
};
db.SitePerson_PersonInOutNow.InsertOnSubmit(newPersonInOut);
db.SubmitChanges();
/// 监理 业主 不进入
var getPUnit = db.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == newPersonInOut.ProjectId && x.UnitId == newPersonInOut.UnitId);
if (getPUnit.IsSynchro == true)
{
var getRealNameP = db.RealName_Project.FirstOrDefault(x => x.ProCode == newPersonInOut.ProCode);
if (getRealNameP != null)
Model.SitePerson_PersonInOutNow newPersonInOut = new Model.SitePerson_PersonInOutNow
{
Model.RealName_PersonInOutNow newR = new Model.RealName_PersonInOutNow
PersonInOutId = PersonInOut.PersonInOutId,
ProjectId = PersonInOut.ProjectId,
UnitId = PersonInOut.UnitId,
PersonId = PersonInOut.PersonId,
IsIn = PersonInOut.IsIn,
ChangeTime = PersonInOut.ChangeTime,
WorkPostId = PersonInOut.WorkPostId,
PostType = PersonInOut.PostType,
ProCode = PersonInOut.ProCode,
Name = PersonInOut.Name,
IdcardType = PersonInOut.IdcardType ?? "SHENFEN_ZHENGJIAN",
IdcardNumber = PersonInOut.IdcardNumber,
CheckType = "ZHENGCHANG_KAOQINLEIBIE",
CheckWay = "FACE_FANGSHI",
};
db.SitePerson_PersonInOutNow.InsertOnSubmit(newPersonInOut);
db.SubmitChanges();
/// 监理 业主 不进入
var getPUnit = db.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == newPersonInOut.ProjectId && x.UnitId == newPersonInOut.UnitId);
if (getPUnit.IsSynchro == true)
{
var getRealNameP = db.RealName_Project.FirstOrDefault(x => x.ProCode == newPersonInOut.ProCode);
if (getRealNameP != null)
{
PersonInOutId = newPersonInOut.PersonInOutId,
ProjectId = newPersonInOut.ProjectId,
UnitId = newPersonInOut.UnitId,
PersonId = newPersonInOut.PersonId,
IsIn = newPersonInOut.IsIn,
ChangeTime = newPersonInOut.ChangeTime,
WorkPostId = newPersonInOut.WorkPostId,
PostType = newPersonInOut.PostType,
ProCode = newPersonInOut.ProCode,
Name = newPersonInOut.Name,
IdcardType = newPersonInOut.IdcardType ?? "SHENFEN_ZHENGJIAN",
IdcardNumber = newPersonInOut.IdcardNumber,
CheckType = "ZHENGCHANG_KAOQINLEIBIE",
CheckWay = "FACE_FANGSHI",
};
db.RealName_PersonInOutNow.InsertOnSubmit(newR);
db.SubmitChanges();
Model.RealName_PersonInOutNow newR = new Model.RealName_PersonInOutNow
{
PersonInOutId = newPersonInOut.PersonInOutId,
ProjectId = newPersonInOut.ProjectId,
UnitId = newPersonInOut.UnitId,
PersonId = newPersonInOut.PersonId,
IsIn = newPersonInOut.IsIn,
ChangeTime = newPersonInOut.ChangeTime,
WorkPostId = newPersonInOut.WorkPostId,
PostType = newPersonInOut.PostType,
ProCode = newPersonInOut.ProCode,
Name = newPersonInOut.Name,
IdcardType = newPersonInOut.IdcardType ?? "SHENFEN_ZHENGJIAN",
IdcardNumber = newPersonInOut.IdcardNumber,
CheckType = "ZHENGCHANG_KAOQINLEIBIE",
CheckWay = "FACE_FANGSHI",
};
db.RealName_PersonInOutNow.InsertOnSubmit(newR);
db.SubmitChanges();
}
}
}
}
var getLastList = from x in db.SitePerson_PersonInOutNow
where x.ChangeTime <= PersonInOut.ChangeTime.Value.AddHours(-48)
select x;
if (getLastList.Count() > 0)
{
db.SitePerson_PersonInOutNow.DeleteAllOnSubmit(getLastList);
db.SubmitChanges();
}
}
/// <summary>
@@ -109,18 +102,20 @@ namespace BLL
/// <param name="personId"></param>
public static void DeletePersonInOutByPersonId(string personId)
{
Model.SGGLDB db = Funs.DB;
var personInOut = from x in db.SitePerson_PersonInOut where x.PersonId == personId select x;
if (personInOut.Count() > 0)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.SitePerson_PersonInOut.DeleteAllOnSubmit(personInOut);
db.SubmitChanges();
}
var rpersonInOut = from x in db.RealName_PersonInOutNow where x.PersonId == personId select x;
if (rpersonInOut.Count() > 0)
{
db.RealName_PersonInOutNow.DeleteAllOnSubmit(rpersonInOut);
db.SubmitChanges();
var personInOut = from x in db.SitePerson_PersonInOut where x.PersonId == personId select x;
if (personInOut.Count() > 0)
{
db.SitePerson_PersonInOut.DeleteAllOnSubmit(personInOut);
db.SubmitChanges();
}
var rpersonInOut = from x in db.RealName_PersonInOutNow where x.PersonId == personId select x;
if (rpersonInOut.Count() > 0)
{
db.RealName_PersonInOutNow.DeleteAllOnSubmit(rpersonInOut);
db.SubmitChanges();
}
}
}
@@ -130,16 +125,18 @@ namespace BLL
/// <param name="personId"></param>
public static void UpdateRealNameInOut(string personId, string oldCardNo, string newIdCardNo)
{
Model.SGGLDB db = Funs.DB;
var personInOuts = from x in db.RealName_PersonInOutNow
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var personInOuts = from x in db.RealName_PersonInOutNow
where x.PersonId == personId && x.IdcardNumber == oldCardNo
select x;
if (personInOuts.Count() > 0)
{
foreach (var item in personInOuts)
if (personInOuts.Count() > 0)
{
item.IdcardNumber = newIdCardNo;
db.SubmitChanges();
foreach (var item in personInOuts)
{
item.IdcardNumber = newIdCardNo;
db.SubmitChanges();
}
}
}
}
@@ -93,27 +93,29 @@ namespace BLL
/// <param name="personInfo">人员考勤管理实体</param>
public static void AddPersonInfo(Model.SitePerson_Checking personInfo)
{
Model.SGGLDB db = Funs.DB;
Model.SitePerson_Checking newPersonInfo = new Model.SitePerson_Checking
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
CheckingId = personInfo.CheckingId,
ProjectId = personInfo.ProjectId,
UnitId = personInfo.UnitId,
UnitName = personInfo.UnitName,
PersonId = personInfo.PersonId,
PersonName = personInfo.PersonName,
IdentityCard = personInfo.IdentityCard,
CardNo = personInfo.CardNo,
WorkAreaId = personInfo.WorkAreaId,
WorkAreaName = personInfo.WorkAreaName,
IntoOutTime = personInfo.IntoOutTime,
IntoOut = personInfo.IntoOut,
Address = personInfo.Address,
States = BLL.Const.State_2
};
Model.SitePerson_Checking newPersonInfo = new Model.SitePerson_Checking
{
CheckingId = personInfo.CheckingId,
ProjectId = personInfo.ProjectId,
UnitId = personInfo.UnitId,
UnitName = personInfo.UnitName,
PersonId = personInfo.PersonId,
PersonName = personInfo.PersonName,
IdentityCard = personInfo.IdentityCard,
CardNo = personInfo.CardNo,
WorkAreaId = personInfo.WorkAreaId,
WorkAreaName = personInfo.WorkAreaName,
IntoOutTime = personInfo.IntoOutTime,
IntoOut = personInfo.IntoOut,
Address = personInfo.Address,
States = BLL.Const.State_2
};
db.SitePerson_Checking.InsertOnSubmit(newPersonInfo);
db.SubmitChanges();
db.SitePerson_Checking.InsertOnSubmit(newPersonInfo);
db.SubmitChanges();
}
if (!string.IsNullOrEmpty(personInfo.ProjectId) && !string.IsNullOrEmpty(personInfo.IdentityCard) && personInfo.IntoOutTime.HasValue)
{
@@ -280,80 +280,97 @@ namespace BLL
{
try
{
/// 清理出入记录
var getRecords = from x in Funs.DB.T_d_facerecord where x.DateTimeRecord.Value.AddDays(1) < DateTime.Now select x;
if (getRecords.Count() > 0)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
foreach (var item in getRecords)
/// 清理实名制未同步历史数据
var getLastList = from x in db.SitePerson_PersonInOutNow
where x.ChangeTime <= DateTime.Now.AddHours(-48)
select x;
if (getLastList.Count() > 0)
{
if (item.InOrOut == "进门")
db.SitePerson_PersonInOutNow.DeleteAllOnSubmit(getLastList);
db.SubmitChanges();
}
}
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
/// 清理出入记录
var getRecords = from x in db.T_d_facerecord where x.DateTimeRecord.Value.AddDays(1) < DateTime.Now select x;
if (getRecords.Count() > 0)
{
foreach (var item in getRecords)
{
var getDelRecordsIn = from x in Funs.DB.T_d_facerecord
where x.ProjectId == item.ProjectId && x.EmployNO == item.EmployNO && x.InOrOut == item.InOrOut
&& x.DateTimeRecord.Value.Year == item.DateTimeRecord.Value.Year
&& x.DateTimeRecord.Value.Month == item.DateTimeRecord.Value.Month
&& x.DateTimeRecord.Value.Day == item.DateTimeRecord.Value.Day
&& x.DateTimeRecord > item.DateTimeRecord
select x;
if (getDelRecordsIn.Count() > 0)
if (item.InOrOut == "进门")
{
Funs.DB.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsIn);
Funs.DB.SubmitChanges();
var getDelRecordsIn = from x in db.T_d_facerecord
where x.ProjectId == item.ProjectId && x.EmployNO == item.EmployNO && x.InOrOut == item.InOrOut
&& x.DateTimeRecord.Value.Year == item.DateTimeRecord.Value.Year
&& x.DateTimeRecord.Value.Month == item.DateTimeRecord.Value.Month
&& x.DateTimeRecord.Value.Day == item.DateTimeRecord.Value.Day
&& x.DateTimeRecord > item.DateTimeRecord
select x;
if (getDelRecordsIn.Count() > 0)
{
db.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsIn);
db.SubmitChanges();
}
}
}
else
{
var getDelRecordsOut = from x in Funs.DB.T_d_facerecord
where x.ProjectId == item.ProjectId && x.EmployNO == item.EmployNO && x.InOrOut == item.InOrOut
&& x.DateTimeRecord.Value.Year == item.DateTimeRecord.Value.Year
&& x.DateTimeRecord.Value.Month == item.DateTimeRecord.Value.Month
&& x.DateTimeRecord.Value.Day == item.DateTimeRecord.Value.Day
&& x.DateTimeRecord < item.DateTimeRecord
select x;
if (getDelRecordsOut.Count() > 0)
else
{
Funs.DB.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsOut);
Funs.DB.SubmitChanges();
var getDelRecordsOut = from x in db.T_d_facerecord
where x.ProjectId == item.ProjectId && x.EmployNO == item.EmployNO && x.InOrOut == item.InOrOut
&& x.DateTimeRecord.Value.Year == item.DateTimeRecord.Value.Year
&& x.DateTimeRecord.Value.Month == item.DateTimeRecord.Value.Month
&& x.DateTimeRecord.Value.Day == item.DateTimeRecord.Value.Day
&& x.DateTimeRecord < item.DateTimeRecord
select x;
if (getDelRecordsOut.Count() > 0)
{
db.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsOut);
db.SubmitChanges();
}
}
}
}
}
var getVRecords = from x in Funs.DB.T_d_validcardevent
where x.RecordDateTime.Value.AddDays(1) < DateTime.Now
select x;
if (getVRecords.Count() > 0)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
foreach (var item in getVRecords)
var getVRecords = from x in db.T_d_validcardevent
where x.RecordDateTime.Value.AddDays(1) < DateTime.Now
select x;
if (getVRecords.Count() > 0)
{
if (item.InOrOut == 1)
foreach (var item in getVRecords)
{
var getDelVRecordsIn = from x in Funs.DB.T_d_validcardevent
where x.ProjectId == item.ProjectId && x.IDCardNo == item.IDCardNo && x.InOrOut == item.InOrOut
&& x.RecordDateTime.Value.Year == item.RecordDateTime.Value.Year
&& x.RecordDateTime.Value.Month == item.RecordDateTime.Value.Month
&& x.RecordDateTime.Value.Day == item.RecordDateTime.Value.Day
&& x.RecordDateTime > item.RecordDateTime
select x;
if (getDelVRecordsIn.Count() > 0)
if (item.InOrOut == 1)
{
Funs.DB.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsIn);
Funs.DB.SubmitChanges();
var getDelVRecordsIn = from x in db.T_d_validcardevent
where x.ProjectId == item.ProjectId && x.IDCardNo == item.IDCardNo && x.InOrOut == item.InOrOut
&& x.RecordDateTime.Value.Year == item.RecordDateTime.Value.Year
&& x.RecordDateTime.Value.Month == item.RecordDateTime.Value.Month
&& x.RecordDateTime.Value.Day == item.RecordDateTime.Value.Day
&& x.RecordDateTime > item.RecordDateTime
select x;
if (getDelVRecordsIn.Count() > 0)
{
db.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsIn);
db.SubmitChanges();
}
}
}
else
{
var getDelVRecordsOut = from x in Funs.DB.T_d_validcardevent
where x.ProjectId == item.ProjectId && x.IDCardNo == item.IDCardNo && x.InOrOut == item.InOrOut
&& x.RecordDateTime.Value.Year == item.RecordDateTime.Value.Year
&& x.RecordDateTime.Value.Month == item.RecordDateTime.Value.Month
&& x.RecordDateTime.Value.Day == item.RecordDateTime.Value.Day
&& x.RecordDateTime < item.RecordDateTime
select x;
if (getDelVRecordsOut.Count() > 0)
else
{
Funs.DB.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsOut);
Funs.DB.SubmitChanges();
var getDelVRecordsOut = from x in db.T_d_validcardevent
where x.ProjectId == item.ProjectId && x.IDCardNo == item.IDCardNo && x.InOrOut == item.InOrOut
&& x.RecordDateTime.Value.Year == item.RecordDateTime.Value.Year
&& x.RecordDateTime.Value.Month == item.RecordDateTime.Value.Month
&& x.RecordDateTime.Value.Day == item.RecordDateTime.Value.Day
&& x.RecordDateTime < item.RecordDateTime
select x;
if (getDelVRecordsOut.Count() > 0)
{
db.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsOut);
db.SubmitChanges();
}
}
}
}