fix:初始化仓库
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class BasicDataService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取字典信息
|
||||
/// </summary>
|
||||
/// <param name="basicDataId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.RealName_BasicData GetBasicDataById(string basicDataId)
|
||||
{
|
||||
return Funs.DB.RealName_BasicData.FirstOrDefault(e => e.BasicDataId == basicDataId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加字典信息
|
||||
/// </summary>
|
||||
/// <param name="basicData"></param>
|
||||
public static void AddBasicData(Model.RealName_BasicData basicData)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.RealName_BasicData newBasicData = new Model.RealName_BasicData
|
||||
{
|
||||
BasicDataId = basicData.BasicDataId,
|
||||
DictTypeCode = basicData.DictTypeCode,
|
||||
DictCode = basicData.DictCode,
|
||||
DictName = basicData.DictName
|
||||
};
|
||||
db.RealName_BasicData.InsertOnSubmit(newBasicData);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改字典信息
|
||||
/// </summary>
|
||||
/// <param name="basicData"></param>
|
||||
public static void UpdateBasicData(Model.RealName_BasicData basicData)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.RealName_BasicData newBasicData = db.RealName_BasicData.FirstOrDefault(e => e.BasicDataId == basicData.BasicDataId);
|
||||
if (newBasicData != null)
|
||||
{
|
||||
newBasicData.DictTypeCode = basicData.DictTypeCode;
|
||||
newBasicData.DictCode = basicData.DictCode;
|
||||
newBasicData.DictName = basicData.DictName;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除字典信息
|
||||
/// </summary>
|
||||
/// <param name="basicDataId"></param>
|
||||
public static void DeleteBasicDataById(string basicDataId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.RealName_BasicData basicData = db.RealName_BasicData.FirstOrDefault(e => e.BasicDataId == basicDataId);
|
||||
if (basicData != null)
|
||||
{
|
||||
db.RealName_BasicData.DeleteOnSubmit(basicData);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据字典类型Id获取字典下拉选择项
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.RealName_BasicData> GetBasicDataListByDictTypeCode(string dictTypeCode)
|
||||
{
|
||||
return (from x in Funs.DB.RealName_BasicData where x.DictTypeCode == dictTypeCode orderby x.DictCode select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据字典类型Id获取字典下拉选择项
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ListItem[] GetBasicDataCodeAndNameListByDictTypeCode(string dictTypeCode)
|
||||
{
|
||||
var q= (from x in Funs.DB.RealName_BasicData where x.DictTypeCode == dictTypeCode orderby x.DictCode select x).ToList();
|
||||
ListItem[] lis = new ListItem[q.Count];
|
||||
for (int i = 0; i < q.Count; i++)
|
||||
{
|
||||
lis[i] = new ListItem(q[i].DictCode + "(" + q[i].DictName + ")", q[i].DictCode);
|
||||
}
|
||||
return lis;
|
||||
}
|
||||
|
||||
#region 表下拉框
|
||||
/// <summary>
|
||||
/// 表下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitBasicDataProjectUnitDropDownList(FineUIPro.DropDownList dropName, string dictTypeCode, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "DictCode";
|
||||
dropName.DataTextField = "DictName";
|
||||
dropName.DataSource = GetBasicDataListByDictTypeCode(dictTypeCode);
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitBasicDataCodeAndNameDropDownList(FineUIPro.DropDownList dropName, string dictTypeCode, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "Value";
|
||||
dropName.DataTextField = "Text";
|
||||
dropName.DataSource = GetBasicDataCodeAndNameListByDictTypeCode(dictTypeCode);
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 获取字典名称
|
||||
/// </summary>
|
||||
/// <param name="UnitId"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetDictNameByDictCode(string DictCode)
|
||||
{
|
||||
string name = string.Empty;
|
||||
var BasicData = Funs.DB.RealName_BasicData.FirstOrDefault(x => x.DictCode == DictCode);
|
||||
if (BasicData != null)
|
||||
{
|
||||
name = BasicData.DictName;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class CityService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取国家信息
|
||||
/// </summary>
|
||||
/// <param name="cityId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.RealName_City GetCityById(string cityId)
|
||||
{
|
||||
return Funs.DB.RealName_City.FirstOrDefault(e => e.ID == cityId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加国家信息
|
||||
/// </summary>
|
||||
/// <param name="city"></param>
|
||||
public static void AddCity(Model.RealName_City city)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.RealName_City newCity = new Model.RealName_City
|
||||
{
|
||||
ID = city.ID,
|
||||
ProvinceCode = city.ProvinceCode,
|
||||
CityCode = city.CityCode,
|
||||
Cname = city.Cname,
|
||||
CnShortName = city.CnShortName,
|
||||
Name = city.Name,
|
||||
CountryId = city.CountryId
|
||||
};
|
||||
db.RealName_City.InsertOnSubmit(newCity);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改国家信息
|
||||
/// </summary>
|
||||
/// <param name="city"></param>
|
||||
public static void UpdateCity(Model.RealName_City city)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.RealName_City newCity = db.RealName_City.FirstOrDefault(e => e.ID == city.ID);
|
||||
if (newCity != null)
|
||||
{
|
||||
newCity.ProvinceCode = city.ProvinceCode;
|
||||
newCity.CityCode = city.CityCode;
|
||||
newCity.Cname = city.Cname;
|
||||
newCity.CnShortName = city.CnShortName;
|
||||
newCity.Name = city.Name;
|
||||
newCity.CountryId = city.CountryId;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除国家信息
|
||||
/// </summary>
|
||||
/// <param name="cityId"></param>
|
||||
public static void DeleteCityById(string cityId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.RealName_City city = db.RealName_City.FirstOrDefault(e => e.ID == cityId);
|
||||
if (city != null)
|
||||
{
|
||||
db.RealName_City.DeleteOnSubmit(city);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据国家类型Id获取国家下拉选择项
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.RealName_City> GetCityList(string countryId)
|
||||
{
|
||||
return (from x in Funs.DB.RealName_City where x.CountryId == countryId orderby x.Cname select x).ToList();
|
||||
}
|
||||
|
||||
#region 表下拉框
|
||||
/// <summary>
|
||||
/// 表下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitCityDropDownList(FineUIPro.DropDownList dropName, string countryId, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "ProvinceCode";
|
||||
dropName.DataTextField = "Cname";
|
||||
dropName.DataSource = GetCityList(countryId);
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 获取国家名称
|
||||
/// </summary>
|
||||
/// <param name="UnitId"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetCNameByProvinceCode(string ProvinceCode)
|
||||
{
|
||||
string name = string.Empty;
|
||||
var City = Funs.DB.RealName_City.FirstOrDefault(x => x.ProvinceCode == ProvinceCode);
|
||||
if (City != null)
|
||||
{
|
||||
name = City.Cname;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class CountryService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取国家信息
|
||||
/// </summary>
|
||||
/// <param name="countryId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.RealName_Country GetCountryById(string id)
|
||||
{
|
||||
return Funs.DB.RealName_Country.FirstOrDefault(e => e.ID == id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据国家类型Id获取国家下拉选择项
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.RealName_Country> GetCountryList()
|
||||
{
|
||||
return (from x in Funs.DB.RealName_Country orderby x.Cname select x).ToList();
|
||||
}
|
||||
|
||||
#region 表下拉框
|
||||
/// <summary>
|
||||
/// 表下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitCountryDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "CountryId";
|
||||
dropName.DataTextField = "Cname";
|
||||
dropName.DataSource = GetCountryList();
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 获取国家名称
|
||||
/// </summary>
|
||||
/// <param name="UnitId"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetCNameByCountryId(string countryId)
|
||||
{
|
||||
string name = string.Empty;
|
||||
var Country = Funs.DB.RealName_Country.FirstOrDefault(x => x.CountryId == countryId);
|
||||
if (Country != null)
|
||||
{
|
||||
name = Country.Cname;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
using FineUIPro;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class OnPostService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
#region 获取列表
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
/// </summary>
|
||||
public static int count
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 定义变量
|
||||
/// </summary>
|
||||
private static IQueryable<Model.SitePerson_Person> getDataLists = from x in db.SitePerson_Person
|
||||
where x.IsUsed == true
|
||||
select x;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="personName"></param>
|
||||
/// <param name="identityCard"></param>
|
||||
/// <param name="Grid1"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable getListData(string projectId, string personName, string identityCard, string rblStates, string rbInfo, string rbIDCardNo, string rbRealName,
|
||||
Grid Grid1)
|
||||
{
|
||||
IQueryable<Model.SitePerson_Person> getDataList = getDataLists;
|
||||
if (projectId != Const._Null && !string.IsNullOrEmpty(projectId))
|
||||
{
|
||||
getDataList = getDataList.Where(x => x.ProjectId == projectId);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(personName))
|
||||
{
|
||||
getDataList = getDataList.Where(x => x.PersonName.Contains(personName));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(identityCard))
|
||||
{
|
||||
getDataList = getDataList.Where(x => x.IdentityCard.Contains(identityCard));
|
||||
}
|
||||
if (rblStates == "1")
|
||||
{
|
||||
getDataList = getDataList.Where(x => !x.OutTime.HasValue);
|
||||
}
|
||||
if (rblStates == "0")
|
||||
{
|
||||
getDataList = getDataList.Where(x => x.OutTime.HasValue);
|
||||
}
|
||||
if (rbInfo == "1")
|
||||
{
|
||||
getDataList = getDataList.Where(x => x.HeadImage != null && x.IsCardNoOK ==true);
|
||||
}
|
||||
if (rbInfo == "0")
|
||||
{
|
||||
getDataList = getDataList.Where(x => x.HeadImage == null || x.IsCardNoOK ==false);
|
||||
}
|
||||
if (rbIDCardNo == "1")
|
||||
{
|
||||
getDataList = getDataList.Where(x => x.IsCardNoOK == true);
|
||||
}
|
||||
if (rbIDCardNo == "0")
|
||||
{
|
||||
getDataList = getDataList.Where(x =>x.IsCardNoOK == false);
|
||||
}
|
||||
if (rbRealName == "1")
|
||||
{
|
||||
getDataList = getDataList.Where(x => x.RealNameAddTime.HasValue);
|
||||
}
|
||||
if (rbRealName == "0")
|
||||
{
|
||||
getDataList = getDataList.Where(x => !x.RealNameAddTime.HasValue);
|
||||
}
|
||||
count = getDataList.Count();
|
||||
if (count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return from x in getDataList
|
||||
select new
|
||||
{
|
||||
x.PersonId,
|
||||
x.IdentityCard,
|
||||
x.PersonName,
|
||||
x.ProjectId,
|
||||
//db.Base_Project.First(y => x.ProjectId == y.ProjectId).ShortName,
|
||||
SexName = x.Sex == "1" ? "男" : "女",
|
||||
x.InTime,
|
||||
x.OutTime,
|
||||
x.Birthday,
|
||||
x.CountryCode,
|
||||
x.ProvinceCode,
|
||||
x.TeamGroupId,
|
||||
db.Base_Unit.First(y=>y.UnitId==x.UnitId).UnitName,
|
||||
db.ProjectData_TeamGroup.First(z => x.TeamGroupId == z.TeamGroupId).TeamGroupName,
|
||||
x.WorkPostId,
|
||||
db.Base_WorkPost.First(z => x.WorkPostId == z.WorkPostId).WorkPostName,
|
||||
IsPostName = x.OutTime.HasValue ? "是" : "否",
|
||||
x.Telephone,
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
using System.Linq;
|
||||
using System.Timers;
|
||||
using System.Configuration;
|
||||
using System;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class RealNameMonitorService
|
||||
{
|
||||
#region 启动监视器 系统启动5分钟
|
||||
/// <summary>
|
||||
/// 监视组件
|
||||
/// </summary>
|
||||
private static Timer messageTimer;
|
||||
|
||||
/// <summary>
|
||||
/// 启动监视器,不一定能成功,根据系统设置决定对监视器执行的操作 系统启动5分钟
|
||||
/// </summary>
|
||||
public static void StartMonitor()
|
||||
{
|
||||
int adTimeJ = Funs.GetNewInt(ConfigurationManager.AppSettings["Intervaltime"]) ?? 30;
|
||||
//var getSynchroSet = Funs.DB.RealName_SynchroSet.FirstOrDefault();
|
||||
//if (getSynchroSet != null && getSynchroSet.Intervaltime.HasValue)
|
||||
//{
|
||||
// adTimeJ = getSynchroSet.Intervaltime.Value;
|
||||
//}
|
||||
if (messageTimer != null)
|
||||
{
|
||||
messageTimer.Stop();
|
||||
messageTimer.Dispose();
|
||||
messageTimer = null;
|
||||
}
|
||||
if (adTimeJ > 0)
|
||||
{
|
||||
messageTimer = new Timer
|
||||
{
|
||||
AutoReset = true
|
||||
};
|
||||
messageTimer.Elapsed += new ElapsedEventHandler(AdUserInProcess);
|
||||
messageTimer.Interval = 1000 * 60 * adTimeJ;// 60分钟 60000 * adTimeJ;
|
||||
messageTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 流程确认 定时执行 系统启动5分钟
|
||||
/// </summary>
|
||||
/// <param name="sender">Timer组件</param>
|
||||
/// <param name="e">事件参数</param>
|
||||
private static void AdUserInProcess(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
PushData();
|
||||
}
|
||||
|
||||
public static void PushData()
|
||||
{
|
||||
try
|
||||
{
|
||||
SynchroSetService.InsertRealNamePushLog(null, null, "定时同步启动", "成功", "1", "考勤自动推送开始", null, null);
|
||||
SynchroSetService.PushCollCompany();
|
||||
var getRProjects = from x in Funs.DB.RealName_Project
|
||||
select x;
|
||||
if (getRProjects.Count() > 0)
|
||||
{
|
||||
foreach (var item in getRProjects)
|
||||
{
|
||||
var getSynchroSet = Funs.DB.RealName_SynchroSet.FirstOrDefault(x => x.ProCode == item.ProCode);
|
||||
if (getSynchroSet != null && !string.IsNullOrEmpty(item.ProCode))
|
||||
{
|
||||
SynchroSetService.PushProCollCompany(item.ProCode);
|
||||
//SynchroSetService.PushCollTeam(item.ProCode);
|
||||
//SynchroSetService.getCollTeam(item.ProCode);
|
||||
SynchroSetService.PushPersons(Const.BtnAdd, item.ProCode, null);
|
||||
SynchroSetService.PushPersons(Const.BtnModify, item.ProCode, null);
|
||||
SynchroSetService.PushAttendance(item.ProCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
SynchroSetService.InsertRealNamePushLog(null, null, "定时同步启动", "成功", "1", "考勤自动推送结束", null, null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StartMonitor();
|
||||
ErrLogInfo.WriteLog(ex, "数据接口定时器", "RealNameMonitorService.AdUserInProcess");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 启动监视器 系统启动5分钟-实名制出入记录去重
|
||||
/// <summary>
|
||||
/// 监视组件
|
||||
/// </summary>
|
||||
private static Timer InOutmessageTimer;
|
||||
|
||||
/// <summary>
|
||||
/// 启动监视器,不一定能成功,根据系统设置决定对监视器执行的操作 系统启动5分钟
|
||||
/// </summary>
|
||||
public static void StartInOutMonitor()
|
||||
{
|
||||
if (InOutmessageTimer != null)
|
||||
{
|
||||
InOutmessageTimer.Stop();
|
||||
InOutmessageTimer.Dispose();
|
||||
InOutmessageTimer = null;
|
||||
}
|
||||
|
||||
InOutmessageTimer = new Timer
|
||||
{
|
||||
AutoReset = true
|
||||
};
|
||||
InOutmessageTimer.Elapsed += new ElapsedEventHandler(PersonInOutProcess);
|
||||
InOutmessageTimer.Interval = 1000 * 60 * 30;// 60分钟 60000 * adTimeJ;
|
||||
InOutmessageTimer.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 流程确认 定时执行 系统启动5分钟
|
||||
/// </summary>
|
||||
/// <param name="sender">Timer组件</param>
|
||||
/// <param name="e">事件参数</param>
|
||||
private static void PersonInOutProcess(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
int delCount = 0;
|
||||
try
|
||||
{
|
||||
var result = (from x in Funs.DB.RealName_PersonInOutNow
|
||||
select new
|
||||
{
|
||||
x.ProjectId,
|
||||
date = x.ChangeTime.Value.Date,
|
||||
x.IdcardNumber,
|
||||
x.IsIn
|
||||
}).Distinct();
|
||||
foreach (var item in result)
|
||||
{
|
||||
var getDateRecords = from x in Funs.DB.RealName_PersonInOutNow
|
||||
where x.ProjectId == item.ProjectId && x.ChangeTime.Value >= item.date.Date && x.ChangeTime.Value < item.date.Date.AddDays(1)
|
||||
&& x.IdcardNumber == item.IdcardNumber
|
||||
select x;
|
||||
|
||||
var getInRecords = getDateRecords.Where(x => x.IsIn == true);
|
||||
if (getInRecords.Count() > 1)
|
||||
{
|
||||
DateTime? minChangeTime = getInRecords.Min(x => x.ChangeTime);
|
||||
var getDeleteInR = from x in getInRecords
|
||||
where x.ChangeTime != minChangeTime
|
||||
select x;
|
||||
if (getDeleteInR.Count() > 0)
|
||||
{
|
||||
delCount += getDeleteInR.Count();
|
||||
Funs.DB.RealName_PersonInOutNow.DeleteAllOnSubmit(getDeleteInR);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
var getOutRecords = getDateRecords.Where(x => x.IsIn == false);
|
||||
if (getOutRecords.Count() > 1)
|
||||
{
|
||||
DateTime? maxChangeTime = getOutRecords.Max(x => x.ChangeTime);
|
||||
var getDeleteOutR = from x in getOutRecords
|
||||
where x.ChangeTime != maxChangeTime
|
||||
select x;
|
||||
if (getDeleteOutR.Count() > 0)
|
||||
{
|
||||
delCount += getDeleteOutR.Count();
|
||||
Funs.DB.RealName_PersonInOutNow.DeleteAllOnSubmit(getDeleteOutR);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
if (delCount >= 10000)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (BLL.Funs.DBList.ContainsKey(System.Threading.Thread.CurrentThread.ManagedThreadId))
|
||||
{
|
||||
BLL.Funs.DBList.Remove(System.Threading.Thread.CurrentThread.ManagedThreadId);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class RealName_ProjectService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.RealName_Project> GetRealName_ProjectList()
|
||||
{
|
||||
return (from x in Funs.DB.RealName_Project orderby x.ProCode select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="proCode"></param>
|
||||
/// <returns></returns>
|
||||
public static string GeJTproCodeByproCode(string proCode)
|
||||
{
|
||||
string code = string.Empty;
|
||||
var project = Funs.DB.RealName_Project.FirstOrDefault(e => e.ProCode == proCode);
|
||||
if (project != null)
|
||||
{
|
||||
code = project.JTproCode;
|
||||
if (string.IsNullOrEmpty(code))
|
||||
{
|
||||
code = project.ProCode;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user