修改个人信息编辑页面,可编辑个人基本信息。
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
namespace FineUIPro.Web.Personal
|
||||
{
|
||||
using BLL;
|
||||
using FastReport.Utils;
|
||||
using Model;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
public partial class PersonalInfo : PageBase
|
||||
@@ -32,6 +35,12 @@
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpMaritalStatus, "MARITAL_STATUS", true);
|
||||
BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpNation, "MINZU_TYPE", true);
|
||||
BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpEduLevel, "EDU_LEVEL", true);
|
||||
PositionService.InitPositionDropDownList(this.drpPosition, true);
|
||||
PostTitleService.InitPostTitleDropDownList(this.drpPostTitle, true);
|
||||
|
||||
/// Tab1加载页面方法
|
||||
this.Tab1LoadData();
|
||||
if (this.CurrUser.PersonId == Const.hfnbdId)
|
||||
@@ -49,62 +58,180 @@
|
||||
/// </summary>
|
||||
private void Tab1LoadData()
|
||||
{
|
||||
var user = Person_PersonsService.GetPerson_PersonsById(this.CurrUser.PersonId);
|
||||
if (user != null)
|
||||
var getData = Person_PersonsService.GetPerson_PersonsById(this.CurrUser.PersonId);
|
||||
if (getData != null)
|
||||
{
|
||||
this.txtUserName.Text = user.PersonName;
|
||||
this.txtUserCode.Text = user.JobNum;
|
||||
var sexVules = BLL.ConstValue.drpConstItemList(ConstValue.Group_0002).FirstOrDefault(x => x.ConstValue == user.Sex);
|
||||
if (sexVules != null)
|
||||
this.txtUserName.Text = getData.PersonName;
|
||||
this.txtJobNum.Text = getData.JobNum;
|
||||
if (!string.IsNullOrEmpty(getData.Sex))
|
||||
{
|
||||
this.drpSex.Text = sexVules.ConstText;
|
||||
this.rblSex.SelectedValue = getData.Sex;
|
||||
}
|
||||
|
||||
this.dpBirthDay.Text = string.Format("{0:yyyy-MM-dd}", user.Birthday);
|
||||
var MarriageVules = BLL.ConstValue.drpConstItemList(ConstValue.Group_0003).FirstOrDefault(x => x.ConstValue == user.MaritalStatus);
|
||||
if (MarriageVules != null)
|
||||
{
|
||||
this.drpMarriage.Text = MarriageVules.ConstText;
|
||||
}
|
||||
this.txtBirthday.Text = string.Format("{0:yyyy-MM-dd}", getData.Birthday);
|
||||
this.drpMaritalStatus.SelectedValue = getData.MaritalStatus ?? Const._Null;
|
||||
this.drpNation.SelectedValue = getData.Nation;
|
||||
this.txtUnit.Text = UnitService.GetUnitNameByUnitId(getData.UnitId);
|
||||
this.txtAccount.Text = getData.Account;
|
||||
this.txtIdentityCard.Text = getData.IdentityCard;
|
||||
this.txtTelephone.Text = getData.Telephone;
|
||||
this.txtGraduate.Text = getData.Graduate;
|
||||
this.drpEduLevel.SelectedValue = getData.EduLevel ?? Const._Null;
|
||||
this.drpPosition.SelectedValue = getData.PositionId ?? Const._Null;
|
||||
this.drpPostTitle.SelectedValue = getData.PostTitleId ?? Const._Null;
|
||||
|
||||
var NationVules = BLL.ConstValue.drpConstItemList(ConstValue.Group_0005).FirstOrDefault(x => x.ConstValue == user.Nation);
|
||||
if (NationVules != null)
|
||||
if (!string.IsNullOrEmpty(getData.PhotoUrl))
|
||||
{
|
||||
this.drpNation.Text = NationVules.ConstText;
|
||||
}
|
||||
var units = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId == user.UnitId);
|
||||
if (units != null)
|
||||
{
|
||||
this.drpUnit.Text = units.UnitName;
|
||||
}
|
||||
this.txtAccount.Text = user.Account;
|
||||
this.txtIdentityCard.Text = user.IdentityCard;
|
||||
this.txtEmail.Text = user.Email;
|
||||
this.txtTelephone.Text = user.Telephone;
|
||||
var EducationVules = BLL.ConstValue.drpConstItemList(ConstValue.Group_0004).FirstOrDefault(x => x.ConstValue == user.EduLevel);
|
||||
if (EducationVules != null)
|
||||
{
|
||||
this.drpEducation.Text = EducationVules.ConstText;
|
||||
}
|
||||
this.txtHometown.Text = user.Address;
|
||||
//var position = BLL.PositionService.GetPositionById(user.PositionId);
|
||||
//if (position != null)
|
||||
//{
|
||||
// this.drpPosition.Text = position.PositionName;
|
||||
//}
|
||||
//this.txtPerformance.Text = user.Performance;
|
||||
if (!string.IsNullOrEmpty(user.PhotoUrl))
|
||||
{
|
||||
this.PhotoAttachUrl = user.PhotoUrl;
|
||||
this.Image1.ImageUrl = "~/" + this.PhotoAttachUrl;
|
||||
this.PhotoAttachUrl = getData.PhotoUrl;
|
||||
imgPhoto.ImageUrl = ("~/" + getData.PhotoUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void btnCustomQuery_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../SysManage/CustomQuery.aspx"), "查询"));
|
||||
}
|
||||
|
||||
/// <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 = "~/" + UploadFileService.PersonBaseInfoFilePath + DateTime.Now.Year + "-" + DateTime.Now.Month + "/";
|
||||
string fileMapPath = Server.MapPath(url + fileName);
|
||||
filePhoto.SaveAs(fileMapPath);
|
||||
if (File.Exists(fileMapPath))
|
||||
{
|
||||
FileInfo fileInfo = new FileInfo(fileMapPath);
|
||||
double size = Math.Ceiling(fileInfo.Length * 1.0 / 1024.0);
|
||||
if (size > 300)
|
||||
{
|
||||
Alert.ShowInTop("照片大小超过300KB,请重新上传!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
imgPhoto.ImageUrl = url + fileName;
|
||||
// 清空文件上传组件
|
||||
filePhoto.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 身份证变化
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void txtIdentityCard_Blur(object sender, EventArgs e)
|
||||
{
|
||||
bool isok = true;
|
||||
if (!string.IsNullOrEmpty(this.txtIdentityCard.Text))
|
||||
{
|
||||
string idCard = this.txtIdentityCard.Text.Trim();
|
||||
var q2 = Funs.DB.Person_Persons.FirstOrDefault(x => x.IdentityCard == idCard && x.PersonId != this.CurrUser.PersonId);
|
||||
if (q2 != null)
|
||||
{
|
||||
ShowNotify("输入的身份证号码已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (!IDCardValid.CheckIDCard(idCard))
|
||||
{
|
||||
isok = false;
|
||||
ShowNotify("输入的身份证号码有误!", MessageBoxIcon.Warning);
|
||||
}
|
||||
if (isok)
|
||||
{
|
||||
///生成二维码
|
||||
this.hdUrl.Text = BLL.CreateQRCodeService.CreateCode_Simple("person$" + idCard);
|
||||
DateTime? birth = IDCardValid.getBirthByIDCard(idCard);
|
||||
if (birth.HasValue)
|
||||
{
|
||||
this.txtBirthday.Text = string.Format("{0:yyyy-MM-dd}", birth.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
var getData = Person_PersonsService.GetPerson_PersonsById(this.CurrUser.PersonId);
|
||||
if (getData != null)
|
||||
{
|
||||
getData.JobNum = this.txtJobNum.Text.Trim();
|
||||
getData.Sex = this.rblSex.SelectedValue;
|
||||
getData.IdentityCard = this.txtIdentityCard.Text.Trim();
|
||||
getData.Birthday = IDCardValid.getBirthByIDCard(getData.IdentityCard);
|
||||
getData.Telephone = this.txtTelephone.Text.Trim();
|
||||
getData.Graduate = this.txtGraduate.Text.Trim();
|
||||
if (!string.IsNullOrEmpty(this.hdUrl.Text))
|
||||
{
|
||||
getData.QRCodeAttachUrl = this.hdUrl.Text;
|
||||
}
|
||||
if (this.drpMaritalStatus.SelectedValue != Const._Null && !string.IsNullOrEmpty(this.drpMaritalStatus.SelectedValue))
|
||||
{
|
||||
getData.MaritalStatus = this.drpMaritalStatus.SelectedValue;
|
||||
}
|
||||
if (this.drpNation.SelectedValue != Const._Null && !string.IsNullOrEmpty(this.drpNation.SelectedValue))
|
||||
{
|
||||
getData.Nation = this.drpNation.SelectedValue;
|
||||
}
|
||||
if (this.drpNation.SelectedValue != Const._Null && !string.IsNullOrEmpty(this.drpNation.SelectedValue))
|
||||
{
|
||||
getData.Nation = this.drpNation.SelectedValue;
|
||||
}
|
||||
if (this.drpEduLevel.SelectedValue != Const._Null && !string.IsNullOrEmpty(this.drpEduLevel.SelectedValue))
|
||||
{
|
||||
getData.EduLevel = this.drpEduLevel.SelectedValue;
|
||||
}
|
||||
if (this.drpPosition.SelectedValue != Const._Null && !string.IsNullOrEmpty(this.drpPosition.SelectedValue))
|
||||
{
|
||||
getData.PositionId = this.drpPosition.SelectedValue;
|
||||
}
|
||||
if (this.drpPostTitle.SelectedValue != Const._Null && !string.IsNullOrEmpty(this.drpPostTitle.SelectedValue))
|
||||
{
|
||||
getData.PostTitleId = this.drpPostTitle.SelectedValue;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(imgPhoto.ImageUrl) && imgPhoto.ImageUrl != "~/res/images/blank.png")
|
||||
{
|
||||
getData.PhotoUrl = imgPhoto.ImageUrl.Replace("~/", "");
|
||||
getData.HeadImage = AttachFileService.SetImageToByteArray(Funs.RootPath + getData.PhotoUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
getData.PhotoUrl = null;
|
||||
getData.HeadImage = null;
|
||||
}
|
||||
string info = Person_PersonsService.ValidPersonInfo(getData);
|
||||
if (string.IsNullOrEmpty(info))
|
||||
{
|
||||
Person_PersonsService.UpdatePerson(getData);
|
||||
LogService.AddSys_Log(this.CurrUser, getData.PersonName, getData.PersonId, BLL.Const.PersonalInfoMenuId, BLL.Const.BtnModify);
|
||||
Alert.ShowInParent("保存成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInParent(info, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user