升级
This commit is contained in:
@@ -1,44 +1,67 @@
|
||||
using BLL;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.HSSE.OccupationHealth
|
||||
{
|
||||
public partial class PhysicalExaminationEdit : PageBase
|
||||
{
|
||||
#region 定义项
|
||||
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string FileId
|
||||
public string PersonId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["FileId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["FileId"] = value;
|
||||
}
|
||||
get { return (string)ViewState["PersonId"]; }
|
||||
set { ViewState["PersonId"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 项目主键
|
||||
/// 二维码路径id
|
||||
/// </summary>
|
||||
public string QRCodeAttachUrl
|
||||
{
|
||||
get { return (string)ViewState["QRCodeAttachUrl"]; }
|
||||
set { ViewState["QRCodeAttachUrl"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 项目ID
|
||||
/// </summary>
|
||||
public string ProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["ProjectId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
get { return (string)ViewState["ProjectId"]; }
|
||||
set { ViewState["ProjectId"] = value; }
|
||||
}
|
||||
|
||||
public string UnitId
|
||||
{
|
||||
get { return (string)ViewState["UnitId"]; }
|
||||
set { ViewState["UnitId"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 公司级编辑
|
||||
/// </summary>
|
||||
public string CompanyEdit
|
||||
{
|
||||
get { return (string)ViewState["CompanyEdit"]; }
|
||||
set { ViewState["CompanyEdit"] = value; }
|
||||
}
|
||||
|
||||
public string Type
|
||||
{
|
||||
get { return (string)ViewState["Type"]; }
|
||||
set { ViewState["Type"] = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 加载
|
||||
#region 加载页面
|
||||
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
@@ -47,40 +70,174 @@ namespace FineUIPro.Web.HSSE.OccupationHealth
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
BLL.UserService.InitUserDropDownList(this.drpCompileMan, this.CurrUser.LoginProjectId, true);
|
||||
this.ProjectId = this.CurrUser.LoginProjectId;
|
||||
this.FileId = Request.Params["FileId"];
|
||||
if (!string.IsNullOrEmpty(this.FileId))
|
||||
{
|
||||
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
////权限按钮方法
|
||||
if (Request.Params["type"] != "-1")
|
||||
{
|
||||
Model.OccupationHealth_PhysicalExamination PhysicalExamination = BLL.PhysicalExaminationService.GetPhysicalExaminationById(this.FileId);
|
||||
if (PhysicalExamination != null)
|
||||
this.GetButtonPower();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Request.Params["Company"]))
|
||||
{
|
||||
this.btnSave.Hidden = true;
|
||||
}
|
||||
|
||||
this.ProjectId = Request.Params["ProjectId"];
|
||||
this.UnitId = Request.Params["UnitId"];
|
||||
this.PersonId = Request.Params["PersonId"];
|
||||
this.Type = Request.Params["Type"];
|
||||
CompanyEdit = Request.Params["CompanyEdit"];
|
||||
this.InitDropDownList();
|
||||
this.drpIdcardType.SelectedValue = "SHENFEN_ZHENGJIAN";
|
||||
if (!string.IsNullOrEmpty(this.PersonId))
|
||||
{
|
||||
var person = BLL.PersonService.GetPersonById(this.PersonId);
|
||||
if (person != null)
|
||||
{
|
||||
this.ProjectId = PhysicalExamination.ProjectId;
|
||||
this.txtFileCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.FileId);
|
||||
this.txtFileName.Text = PhysicalExamination.FileName;
|
||||
if (!string.IsNullOrEmpty(PhysicalExamination.CompileMan))
|
||||
this.ProjectId = person.ProjectId;
|
||||
if (!string.IsNullOrEmpty(person.Sex))
|
||||
{
|
||||
this.drpCompileMan.SelectedValue = PhysicalExamination.CompileMan;
|
||||
this.rblSex.SelectedValue = person.Sex;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(person.UnitId))
|
||||
{
|
||||
var unit = BLL.UnitService.GetUnitByUnitId(person.UnitId);
|
||||
if (unit != null)
|
||||
{
|
||||
this.drpUnitId.SelectedValue = unit.UnitId;
|
||||
drpUnitId_OnSelectedIndexChanged(null, null);
|
||||
this.UnitId = person.UnitId;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(person.WorkAreaId))
|
||||
{
|
||||
txtWorkArea.Values = person.WorkAreaId.Split(',');
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(person.WorkPostId))
|
||||
{
|
||||
this.drpPost.SelectedValue = person.WorkPostId;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(person.PostTitleId))
|
||||
{
|
||||
this.drpTitle.SelectedValue = person.PostTitleId;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(person.TeamGroupId))
|
||||
{
|
||||
this.drpTeamGroup.SelectedValue = person.TeamGroupId;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(person.EduLevel))
|
||||
{
|
||||
this.drpEduLevel.SelectedValue = person.EduLevel;
|
||||
}
|
||||
|
||||
this.rblIsUsed.SelectedValue = person.IsUsed ? "True" : "False";
|
||||
this.txtCardNo.Text = person.CardNo;
|
||||
this.txtPersonName.Text = person.PersonName;
|
||||
this.txtIdentityCard.Text = person.IdentityCard;
|
||||
this.txtTelephone.Text = person.Telephone;
|
||||
this.txtMajor.Text = person.Major;
|
||||
if (person.InTime.HasValue)
|
||||
{
|
||||
this.txtInTime.Text = string.Format("{0:yyyy-MM-dd}", person.InTime);
|
||||
}
|
||||
|
||||
if (person.OutTime.HasValue)
|
||||
{
|
||||
this.txtOutTime.Text = string.Format("{0:yyyy-MM-dd}", person.OutTime);
|
||||
}
|
||||
|
||||
if (person.Birthday.HasValue)
|
||||
{
|
||||
this.txtBirthday.Text = string.Format("{0:yyyy-MM-dd}", person.Birthday);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(person.PhotoUrl))
|
||||
{
|
||||
imgPhoto.ImageUrl = ("~/" + person.PhotoUrl);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(person.IdcardType))
|
||||
{
|
||||
this.drpIdcardType.SelectedValue = person.IdcardType;
|
||||
}
|
||||
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", PhysicalExamination.CompileDate);
|
||||
this.txtFileContent.Text = HttpUtility.HtmlDecode(PhysicalExamination.FileContent);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
////自动生成编码
|
||||
this.txtFileCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.PhysicalExaminationMenuId, this.ProjectId, this.CurrUser.UnitId);
|
||||
this.drpCompileMan.SelectedValue = this.CurrUser.UserId;
|
||||
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||||
this.txtFileName.Text = this.SimpleForm1.Title;
|
||||
var unit = BLL.UnitService.GetUnitByUnitId(this.UnitId);
|
||||
if (unit != null)
|
||||
{
|
||||
this.drpUnitId.SelectedValue = unit.UnitId;
|
||||
this.txtCardNo.Text = string.Empty;
|
||||
}
|
||||
|
||||
this.txtInTime.Text = string.Format("{0:yyyy-MM-dd}", System.DateTime.Now);
|
||||
this.rblIsUsed.SelectedValue = "True";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 初始化下拉框
|
||||
/// </summary>
|
||||
private void InitDropDownList()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(CompanyEdit))
|
||||
{
|
||||
txtWorkArea.ShowRedStar = false;
|
||||
txtWorkArea.Required = false;
|
||||
gvWorkArea.DataSource = BLL.UnitWorkService.GetUnitWorkLists(this.ProjectId);
|
||||
gvWorkArea.DataBind(); //单位工程
|
||||
UnitService.InitBranchUnitDropDownList(this.drpUnitId, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
gvWorkArea.DataSource = BLL.UnitWorkService.GetUnitWorkLists(this.ProjectId);
|
||||
gvWorkArea.DataBind(); //单位工程
|
||||
UnitService.InitProjectUnitDropDownList(this.drpUnitId, this.ProjectId, false);
|
||||
}
|
||||
|
||||
if (Type == "0") //专职安全人员
|
||||
{
|
||||
drpPost.DataValueField = "WorkPostId";
|
||||
drpPost.DataTextField = "WorkPostName";
|
||||
drpPost.DataSource = BLL.WorkPostService.GetWorkPostList().Where(x => x.IsHsse == true);
|
||||
drpPost.DataBind();
|
||||
}
|
||||
else if (Type == "1") //特种作业管理人员
|
||||
{
|
||||
drpPost.DataValueField = "WorkPostId";
|
||||
drpPost.DataTextField = "WorkPostName";
|
||||
drpPost.DataSource = BLL.WorkPostService.GetWorkPostList()
|
||||
.Where(x => x.PostType == "2" || x.PostType == "4");
|
||||
drpPost.DataBind();
|
||||
}
|
||||
else if (Type == "3") //其他人员
|
||||
{
|
||||
drpPost.DataValueField = "WorkPostId";
|
||||
drpPost.DataTextField = "WorkPostName";
|
||||
drpPost.DataSource = BLL.WorkPostService.GetWorkPostList()
|
||||
.Where(x => x.IsHsse != true && x.PostType != "2" || x.PostType != "4");
|
||||
drpPost.DataBind();
|
||||
}
|
||||
|
||||
PostTitleService.InitPostTitleDropDownList(this.drpTitle, false);
|
||||
BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpEduLevel, "EDU_LEVEL", false);
|
||||
BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpIdcardType, "ZHENGJIAN_TYPE", true);
|
||||
}
|
||||
|
||||
#region 保存
|
||||
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
@@ -88,61 +245,415 @@ namespace FineUIPro.Web.HSSE.OccupationHealth
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.SaveData(BLL.Const.BtnSave);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
if (string.IsNullOrEmpty(this.txtPersonName.Text))
|
||||
{
|
||||
ShowNotify("人员姓名不能为空!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.drpIdcardType.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
ShowNotify("请选择证件类型!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(this.txtIdentityCard.Text))
|
||||
{
|
||||
ShowNotify("证件号码不能为空!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.drpUnitId.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
ShowNotify("请选择所属单位!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (this.drpPost.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
ShowNotify("请选择所属岗位!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(this.txtInTime.Text))
|
||||
{
|
||||
ShowNotify("入场时间不能为空!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
SaveData();
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存数据
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
private void SaveData(string type)
|
||||
protected void SaveData()
|
||||
{
|
||||
Model.OccupationHealth_PhysicalExamination PhysicalExamination = new Model.OccupationHealth_PhysicalExamination
|
||||
Model.SitePerson_Person person = new Model.SitePerson_Person
|
||||
{
|
||||
FileCode = this.txtFileCode.Text.Trim(),
|
||||
FileName = this.txtFileName.Text.Trim()
|
||||
Sex = this.rblSex.SelectedValue,
|
||||
ProjectId = this.ProjectId
|
||||
};
|
||||
if (this.drpCompileMan.SelectedValue != BLL.Const._Null)
|
||||
//如果是公司级编辑
|
||||
if (!string.IsNullOrEmpty(CompanyEdit))
|
||||
{
|
||||
PhysicalExamination.CompileMan = this.drpCompileMan.SelectedValue;
|
||||
person.ProjectId = null;
|
||||
}
|
||||
PhysicalExamination.CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text.Trim());
|
||||
PhysicalExamination.FileContent = HttpUtility.HtmlEncode(this.txtFileContent.Text);
|
||||
////单据状态
|
||||
PhysicalExamination.States = BLL.Const.State_2;
|
||||
if (!string.IsNullOrEmpty(this.FileId))
|
||||
|
||||
if (!string.IsNullOrEmpty(this.drpUnitId.SelectedValue))
|
||||
{
|
||||
PhysicalExamination.FileId = this.FileId;
|
||||
BLL.PhysicalExaminationService.UpdatePhysicalExamination(PhysicalExamination);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, PhysicalExamination.FileCode, PhysicalExamination.FileId, BLL.Const.PhysicalExaminationMenuId, BLL.Const.BtnModify);
|
||||
person.UnitId = this.drpUnitId.SelectedValue;
|
||||
}
|
||||
|
||||
if (this.drpIdcardType.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
person.IdcardType = this.drpIdcardType.SelectedValue;
|
||||
}
|
||||
|
||||
if (this.drpTeamGroup.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
person.TeamGroupId = this.drpTeamGroup.SelectedValue;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(String.Join(",", this.txtWorkArea.Values)))
|
||||
{
|
||||
person.WorkAreaId = string.Join(",", txtWorkArea.Values);
|
||||
}
|
||||
|
||||
if (this.drpPost.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
person.WorkPostId = this.drpPost.SelectedValue;
|
||||
}
|
||||
|
||||
if (this.drpTitle.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
person.PostTitleId = this.drpTitle.SelectedValue;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.rblIsUsed.SelectedValue))
|
||||
{
|
||||
person.IsUsed = Convert.ToBoolean(this.rblIsUsed.SelectedValue);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtCardNo.Text.Trim()))
|
||||
{
|
||||
person.CardNo = this.txtCardNo.Text.Trim();
|
||||
}
|
||||
|
||||
person.PersonName = this.txtPersonName.Text.Trim();
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtIdentityCard.Text))
|
||||
{
|
||||
person.IdentityCard = this.txtIdentityCard.Text.Trim();
|
||||
}
|
||||
|
||||
|
||||
if (this.drpEduLevel.SelectedValue != Const._Null)
|
||||
{
|
||||
person.EduLevel = this.drpEduLevel.SelectedValue;
|
||||
}
|
||||
|
||||
person.Telephone = this.txtTelephone.Text.Trim();
|
||||
person.Major = this.txtMajor.Text.Trim();
|
||||
if (!string.IsNullOrEmpty(this.txtInTime.Text.Trim()))
|
||||
{
|
||||
person.InTime = Convert.ToDateTime(this.txtInTime.Text.Trim());
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtOutTime.Text.Trim()))
|
||||
{
|
||||
person.OutTime = Convert.ToDateTime(this.txtOutTime.Text.Trim());
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtBirthday.Text.Trim()))
|
||||
{
|
||||
person.Birthday = Convert.ToDateTime(this.txtBirthday.Text.Trim());
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(imgPhoto.ImageUrl) && imgPhoto.ImageUrl != "~/res/images/blank_150.png")
|
||||
{
|
||||
person.PhotoUrl = imgPhoto.ImageUrl.Replace("~/", "");
|
||||
person.HeadImage = AttachFileService.SetImageToByteArray(Funs.RootPath + person.PhotoUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.FileId = SQLHelper.GetNewID(typeof(Model.OccupationHealth_PhysicalExamination));
|
||||
PhysicalExamination.FileId = this.FileId;
|
||||
PhysicalExamination.ProjectId = this.ProjectId;
|
||||
BLL.PhysicalExaminationService.AddPhysicalExamination(PhysicalExamination);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, PhysicalExamination.FileCode, PhysicalExamination.FileId, BLL.Const.PhysicalExaminationMenuId, BLL.Const.BtnAdd);
|
||||
}
|
||||
person.PhotoUrl = null;
|
||||
person.HeadImage = null;
|
||||
}
|
||||
if (string.IsNullOrEmpty(PersonId))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.txtCardNo.Text.Trim()))
|
||||
{
|
||||
int cardNoCount =
|
||||
BLL.PersonService.GetPersonCountByCardNo(this.ProjectId, this.txtCardNo.Text.Trim());
|
||||
|
||||
if (cardNoCount > 0)
|
||||
{
|
||||
ShowNotify("此卡号已存在,不能重复!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtIdentityCard.Text))
|
||||
{
|
||||
person.IdentityCard = this.txtIdentityCard.Text.Trim();
|
||||
var identityCardCount = PersonService.GetPersonCountByIdentityCard(this.txtIdentityCard.Text.Trim(),
|
||||
this.CurrUser.LoginProjectId);
|
||||
if (identityCardCount != null)
|
||||
{
|
||||
ShowNotify("此身份证号已存在,不能重复!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.PersonId = SQLHelper.GetNewID(typeof(Model.SitePerson_Person));
|
||||
person.PersonId = this.PersonId;
|
||||
BLL.PersonService.AddPerson(person);
|
||||
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, person.PersonName, person.PersonId, BLL.Const.PersonListMenuId,
|
||||
BLL.Const.BtnAdd);
|
||||
}
|
||||
else
|
||||
{
|
||||
var getPerson = BLL.PersonService.GetPersonById(PersonId);
|
||||
if (getPerson != null)
|
||||
{
|
||||
person.FromPersonId = getPerson.FromPersonId;
|
||||
}
|
||||
|
||||
person.PersonId = PersonId;
|
||||
BLL.PersonService.UpdatePerson(person);
|
||||
//判断并更新项目用户的主副专业信息
|
||||
var projectUser =
|
||||
BLL.ProjectUserService.GetProjectUserByProjectIdAndIdentityCard(this.ProjectId,
|
||||
person.IdentityCard);
|
||||
if (projectUser != null)
|
||||
{
|
||||
projectUser.MainCNProfessionalId = person.MainCNProfessionalId;
|
||||
projectUser.ViceCNProfessionalId = person.ViceCNProfessionalId;
|
||||
BLL.ProjectUserService.UpdateProjectUser(projectUser);
|
||||
}
|
||||
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, person.PersonName, person.PersonId, BLL.Const.PersonListMenuId,
|
||||
BLL.Const.BtnModify);
|
||||
}
|
||||
///上传人脸库
|
||||
var getProject = ProjectService.GetProjectByProjectId(person.ProjectId);
|
||||
if (!string.IsNullOrEmpty(person.PhotoUrl) && getProject != null && getProject.IsFace == true)
|
||||
{
|
||||
Alert.ShowInParent(APIPersonService.PersonFace(person), MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 上传照片
|
||||
|
||||
/// <summary>
|
||||
/// 上传照片
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void filePhoto_FileSelected(object sender, EventArgs e)
|
||||
{
|
||||
if (filePhoto.HasFile)
|
||||
{
|
||||
string fileName = filePhoto.ShortFileName;
|
||||
if (!ValidateFileType(fileName))
|
||||
{
|
||||
ShowNotify("无效的文件类型!");
|
||||
return;
|
||||
}
|
||||
|
||||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||||
string url = "~/FileUpload/PersonBaseInfo/" + DateTime.Now.Year + "-" + DateTime.Now.Month + "/";
|
||||
filePhoto.SaveAs(Server.MapPath(url + fileName));
|
||||
imgPhoto.ImageUrl = url + fileName;
|
||||
// 清空文件上传组件
|
||||
filePhoto.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#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.PersonId || (this.PersonId == null && x.PersonId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
ShowNotify("输入的卡号已存在!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtIdentityCard.Text))
|
||||
{
|
||||
var q2 = Funs.DB.SitePerson_Person.FirstOrDefault(x =>
|
||||
x.ProjectId == this.CurrUser.LoginProjectId && x.IdentityCard == this.txtIdentityCard.Text.Trim() &&
|
||||
(x.PersonId != this.PersonId || (this.PersonId == null && x.PersonId != null)));
|
||||
if (q2 != null)
|
||||
{
|
||||
ShowNotify("输入的身份证号码已存在!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 判断按钮权限
|
||||
|
||||
/// <summary>
|
||||
/// 判断按钮权限
|
||||
/// </summary>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
if (Request.Params["value"] == "0")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId,
|
||||
BLL.Const.PersonListMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnSave))
|
||||
{
|
||||
this.btnSave.Hidden = false;
|
||||
this.filePhoto.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnQR_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.txtIdentityCard.Text.Trim()))
|
||||
{
|
||||
Alert.ShowInTop("身份证号码不能为空!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(this.txtPersonName.Text))
|
||||
{
|
||||
ShowNotify("人员姓名不能为空!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(this.txtInTime.Text))
|
||||
{
|
||||
ShowNotify("入场时间不能为空!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(this.PersonId))
|
||||
{
|
||||
this.SaveData();
|
||||
}
|
||||
|
||||
string strCode = "person$" + this.txtIdentityCard.Text.Trim();
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(
|
||||
String.Format("~/Controls/SeeQRImage.aspx?PersonId={0}&strCode={1}", this.PersonId, strCode), "二维码查看",
|
||||
400, 400));
|
||||
}
|
||||
|
||||
#region 附件上传
|
||||
|
||||
/// <summary>
|
||||
/// 上传附件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
||||
protected void btnAttachUrl3_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.FileId))
|
||||
if (string.IsNullOrEmpty(this.PersonId))
|
||||
{
|
||||
SaveData(BLL.Const.BtnSave);
|
||||
SaveData();
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/PhysicalExaminationAttachUrl&menuId={1}", FileId, BLL.Const.PhysicalExaminationMenuId)));
|
||||
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
|
||||
"~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/PersonBaseInfo&menuId={1}&strParam=3&type=0",
|
||||
this.PersonId, BLL.Const.PersonListMenuId)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected void txtIdentityCard_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
bool isok = true;
|
||||
if (!string.IsNullOrEmpty(this.txtIdentityCard.Text))
|
||||
{
|
||||
string idCard = this.txtIdentityCard.Text.Trim();
|
||||
var q2 = Funs.DB.SitePerson_Person.FirstOrDefault(x =>
|
||||
x.ProjectId == this.CurrUser.LoginProjectId && x.IdentityCard == idCard &&
|
||||
(x.PersonId != this.PersonId || (this.PersonId == null && x.PersonId != null)));
|
||||
if (q2 != null)
|
||||
{
|
||||
isok = false;
|
||||
ShowNotify("输入的身份证号码已存在!", MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
if (this.drpIdcardType.SelectedValue == "SHENFEN_ZHENGJIAN")
|
||||
{
|
||||
if (!IDCardValid.CheckIDCard(idCard))
|
||||
{
|
||||
isok = false;
|
||||
ShowNotify("输入的身份证号码有误!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
if (isok)
|
||||
{
|
||||
string birthDateStr = "";
|
||||
if (idCard.Length == 18) //如果是新的二代身份证,直接取中间8位日期
|
||||
{
|
||||
birthDateStr = idCard.Substring(6, 8);
|
||||
}
|
||||
else if (idCard.Length == 15) //如果是老的一代身份证,取中间6位日期
|
||||
{
|
||||
birthDateStr = "19" + idCard.Substring(6, 6);
|
||||
}
|
||||
|
||||
var Birthday = DateTime.ParseExact(birthDateStr, "yyyyMMdd", null);
|
||||
this.txtBirthday.SelectedDate = Birthday;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void drpUnitId_OnSelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
TeamGroupService.InitTeamGroupProjectUnitDropDownList(this.drpTeamGroup, this.ProjectId,
|
||||
this.drpUnitId.SelectedValue, true);
|
||||
}
|
||||
|
||||
protected void txtPersonName_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
var model = (from x in Funs.DB.Sys_User where x.UserName == txtPersonName.Text.Trim() select x)
|
||||
.FirstOrDefault();
|
||||
if (model != null)
|
||||
{
|
||||
txtPersonName.Text = model.UserName;
|
||||
txtTelephone.Text = model.Telephone;
|
||||
txtIdentityCard.Text = model.IdentityCard;
|
||||
txtIdentityCard_TextChanged(null, null);
|
||||
rblSex.SelectedValue = model.Sex == "1" ? "1" : "2";
|
||||
txtRemark.Text = model.Remark;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user