89 lines
2.8 KiB
C#
89 lines
2.8 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.HSSE.SitePerson
|
|
{
|
|
public partial class ReadWriteCard : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 人员Id
|
|
/// </summary>
|
|
public string StiePersonId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["StiePersonId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["StiePersonId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
this.StiePersonId = Request.Params["PersonId"];
|
|
if (!string.IsNullOrEmpty(this.StiePersonId))
|
|
{
|
|
var person = BLL.SitePerson_PersonService.GetSitePersonById(this.StiePersonId);
|
|
if (person != null)
|
|
{
|
|
this.txtPersonName.Text = person.PersonName;
|
|
this.txtUnitName.Text = BLL.UnitService.GetUnitNameByUnitId(person.UnitId);
|
|
this.txtCardNo.Text = person.CardNo;
|
|
}
|
|
}
|
|
}
|
|
//this.SetDefaltButton(this.txtCardNo, this.TextBox2);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 发卡
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSendCard_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
SitePerson_PersonService.SendCardNo(this.StiePersonId);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
catch
|
|
{
|
|
ShowNotify("发卡未成功!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
|
|
#region 验证卡号是否存在
|
|
/// <summary>
|
|
/// 验证卡号是否存在
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(this.txtCardNo.Text))
|
|
{
|
|
var q = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.CardNo == this.txtCardNo.Text.Trim() && (x.PersonId != this.StiePersonId || (this.StiePersonId == null && x.PersonId != null)));
|
|
if (q != null)
|
|
{
|
|
ShowNotify("输入的卡号已存在!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |