2022-09-05 16:36:31 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
|
using Model;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.Person
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class PersonLib : PageBase
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 加载页面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
Funs.DropDownPageSize(this.ddlPageSize);
|
|
|
|
|
|
////权限按钮方法
|
|
|
|
|
|
this.GetButtonPower();
|
|
|
|
|
|
this.btnNew.OnClientClick = Window1.GetShowReference("PersonEdit.aspx") + "return false;";
|
|
|
|
|
|
UnitService.InitUnitDropDownList(this.drpUnit, string.Empty, false);
|
|
|
|
|
|
Funs.FineUIPleaseSelect(drpUnit, "按单位查询");
|
|
|
|
|
|
this.drpUnit.SelectedValue = this.CurrUser.UnitId ?? Const.UnitId_SEDIN;
|
|
|
|
|
|
DepartService.InitDepartDropDownList(this.drpDepart, false);
|
|
|
|
|
|
Funs.FineUIPleaseSelect(drpDepart, "按部门查询");
|
|
|
|
|
|
ProjectService.InitAllProjectDropDownList(this.drpProject, false);
|
|
|
|
|
|
Funs.FineUIPleaseSelect(drpProject, "按项目查询");
|
|
|
|
|
|
DropListService.InitConstDropDownList(this.drpIsPost, DropListService.Group_IsPost, true);
|
|
|
|
|
|
this.drpIsPost.SelectedValue = Const._True;
|
|
|
|
|
|
DropListService.InitConstDropDownList(this.drpPersonType, DropListService.Group_PersonType, false);
|
|
|
|
|
|
Funs.FineUIPleaseSelect(drpPersonType, "按员工类别查询");
|
|
|
|
|
|
// 绑定表格
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 绑定数据
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 绑定数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
|
{
|
|
|
|
|
|
var getData = Person_PersonsService.getListData(this.drpUnit.SelectedValue, this.drpDepart.SelectedValue, this.drpProject.SelectedValue,
|
2023-08-25 16:19:07 +08:00
|
|
|
|
this.txtPersonName.Text.Trim(), this.txtIdCard.Text.Trim(), this.drpIsPost.SelectedValue, this.drpPersonType.SelectedValue, this.txtAccount.Text.Trim(),null, Grid1);
|
2022-09-05 16:36:31 +08:00
|
|
|
|
Grid1.RecordCount = Person_PersonsService.count;
|
|
|
|
|
|
Grid1.DataSource = getData;
|
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 查询
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btSearch_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
2022-10-19 10:25:17 +08:00
|
|
|
|
|
|
|
|
|
|
protected void ckIsTemp_CheckedChanged(object sender, CheckedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 获取按钮权限
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取按钮权限
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="button"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private void GetButtonPower()
|
|
|
|
|
|
{
|
|
|
|
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.PersonLibMenuId);
|
|
|
|
|
|
if (buttonList.Count() > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnAdd))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnNew.Hidden = false;
|
|
|
|
|
|
this.btnImport.Hidden = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnModify))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnMenuEdit.Hidden = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnDelete))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnMenuDelete.Hidden = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-20 11:47:25 +08:00
|
|
|
|
if (this.CurrUser.PersonId == Const.hfnbdId || this.CurrUser.PersonId == Const.sysglyId)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
|
|
|
|
|
this.btnIDCard.Hidden = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 删除数据
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 右键删除事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.DeleteData();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 删除方法
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void DeleteData()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
string strShowNotify = Person_PersonsService.DeletePersons(Grid1.SelectedRowIDArray, this.CurrUser);
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strShowNotify))
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop(strShowNotify, MessageBoxIcon.Warning);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 分页
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 分页
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 分页显示条数下拉框
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Grid行双击事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.EditData();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 右键编辑事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.EditData();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 编辑数据方法
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void EditData()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
string Id = Grid1.SelectedRowID;
|
|
|
|
|
|
if (this.btnMenuEdit.Hidden)
|
|
|
|
|
|
{
|
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PersonView.aspx?PersonId={0}", Grid1.SelectedRowID, "查看 - ")));
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PersonEdit.aspx?PersonId={0}", Id, "编辑 - ")));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 导入
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 导入按钮
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnImport_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("UserIn.aspx", "导入 - ")));
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
protected void ckbAll_CheckedChanged(object sender, CheckedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 查看人员详细信息
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查看人员详细信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnSee_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInParent("请选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PersonView.aspx?PersonId={0}", Grid1.SelectedRowID, "查看 - ")));
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
///
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnIDCard_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
int countRecod = 0;
|
2022-09-20 11:47:25 +08:00
|
|
|
|
int pCountRecod = 0;
|
|
|
|
|
|
string info=string.Empty;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
var getPerson = (from x in Funs.DB.Person_Persons
|
|
|
|
|
|
where x.IdentityCard != null && x.IdentityCard.Length > 1 && !x.Birthday.HasValue && x.IsCardNoOK.Value
|
|
|
|
|
|
select x).Take(1000);
|
|
|
|
|
|
foreach (var item in getPerson)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(item.QRCodeAttachUrl))
|
|
|
|
|
|
{
|
|
|
|
|
|
///生成二维码
|
|
|
|
|
|
string qrUrl = BLL.CreateQRCodeService.CreateCode_Simple("person$" + item.IdentityCard);
|
|
|
|
|
|
item.QRCodeAttachUrl = ("~/" + qrUrl);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DateTime? birth = IDCardValid.getBirthByIDCard(item.IdentityCard);
|
|
|
|
|
|
if (birth.HasValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
item.Birthday = birth.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Funs.DB.SubmitChanges();
|
|
|
|
|
|
countRecod++;
|
|
|
|
|
|
}
|
2022-09-20 11:47:25 +08:00
|
|
|
|
info = "操作完成,共处理人员按身份证设置年龄" + countRecod.ToString() + "条。";
|
|
|
|
|
|
|
2022-11-19 16:17:11 +08:00
|
|
|
|
//var getPPersons = (from x in Funs.DB.SitePerson_Person
|
|
|
|
|
|
// join y in Funs.DB.Person_Persons on x.PersonId equals y.PersonId
|
|
|
|
|
|
// where x.States == Const.ProjectPersonStates_1 && y.CurrentProjectId == null
|
|
|
|
|
|
// select x).Take(1000);
|
|
|
|
|
|
//foreach (var pitem in getPPersons)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// SitePerson_PersonItemService.SetPersonItemInOut(pitem);
|
|
|
|
|
|
// pCountRecod++;
|
|
|
|
|
|
//}
|
2022-09-20 11:47:25 +08:00
|
|
|
|
|
2022-11-19 16:17:11 +08:00
|
|
|
|
//if (pCountRecod == 0)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// var getPPersons2 = (from x in Funs.DB.SitePerson_Person
|
|
|
|
|
|
// join y in Funs.DB.Person_Persons on x.PersonId equals y.PersonId
|
|
|
|
|
|
// where x.States == Const.ProjectPersonStates_0 && y.CurrentProjectId == null
|
|
|
|
|
|
// select x).Take(1000);
|
|
|
|
|
|
// foreach (var pitem2 in getPPersons2)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// var getPersons = Funs.DB.Person_Persons.FirstOrDefault(x => x.PersonId == pitem2.PersonId);
|
|
|
|
|
|
// if (getPersons != null)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// getPersons.CurrentProjectId = pitem2.ProjectId;
|
|
|
|
|
|
// getPersons.CurrentProjectRoleId = pitem2.RoleIds;
|
|
|
|
|
|
// getPersons.CurrentProjectWorkPostId = pitem2.WorkPostId;
|
|
|
|
|
|
// Funs.DB.SubmitChanges();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// pCountRecod++;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
2022-10-08 16:25:50 +08:00
|
|
|
|
|
2022-11-19 16:17:11 +08:00
|
|
|
|
//info += "共处理人员所在当前项目取值" + pCountRecod.ToString() + "条。";
|
2022-10-08 16:25:50 +08:00
|
|
|
|
Alert.ShowInParent(info, MessageBoxIcon.Information);
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|