20230708修改本部项目下拉框只读问题,考勤二次写入方法优化

This commit is contained in:
2023-07-08 09:58:44 +08:00
parent 70a51ab125
commit a322a2fa62
4 changed files with 44 additions and 70 deletions
@@ -1,6 +1,9 @@
using BLL;
using FineUIPro.Web.DataShow;
using Model;
using System;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using AspNet = System.Web.UI.WebControls;
@@ -327,15 +330,48 @@ namespace FineUIPro.Web.HSSE.SitePerson
protected void btnInRealName_Click(object sender, EventArgs e)
{
foreach (var item in Grid1.Rows)
int count = 0;
IQueryable<Model.SitePerson_PersonInOut> getDataList = Funs.DB.SitePerson_PersonInOut.Where(x => x.ProjectId == this.CurrUser.LoginProjectId);
if (this.rbInOutWay.SelectedValue != "0")
{
var getInOut = Funs.DB.SitePerson_PersonInOut.FirstOrDefault(x => x.PersonInOutId == item.RowID);
getDataList = getDataList.Where(x => x.InOutWay == this.rbInOutWay.SelectedValue);
}
if (!string.IsNullOrEmpty(this.drpUnit.SelectedValue) && this.drpUnit.SelectedValue != Const._Null)
{
getDataList = getDataList.Where(x => x.UnitId == this.drpUnit.SelectedValue);
}
if (!string.IsNullOrEmpty(this.txtPersonName.Text))
{
getDataList = getDataList.Where(x => x.PersonName.Contains(this.txtPersonName.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.txtIdCard.Text))
{
getDataList = getDataList.Where(x => x.IdentityCard.Contains(this.txtIdCard.Text.Trim()));
}
DateTime? startDate = Funs.GetNewDateTime(this.txtStartDate.Text);
DateTime? endDate = Funs.GetNewDateTime(this.txtEndDate.Text);
if (startDate.HasValue)
{
getDataList = getDataList.Where(x => x.ChangeTime >= startDate);
}
if (endDate.HasValue)
{
getDataList = getDataList.Where(x => x.ChangeTime <= endDate);
}
foreach (var item in getDataList)
{
var getInOut = Funs.DB.SitePerson_PersonInOut.FirstOrDefault(x => x.PersonInOutId == item.PersonInOutId);
if (getInOut != null)
{
getInOut.PersonInOutId = SQLHelper.GetNewID();
item.PersonInOutId = SQLHelper.GetNewID();
PersonInOutService.InsertPersonInOutNowNow(getInOut);
count++;
}
}
Alert.ShowInTop("写入考勤" + count.ToString() + "条。", MessageBoxIcon.Success);
}
}
}