SGGL_SHJ/SGGL/FineUIPro.Web/Person/PersonView.aspx.cs

673 lines
24 KiB
C#
Raw Normal View History

2022-09-05 16:36:31 +08:00
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
2022-09-05 16:36:31 +08:00
namespace FineUIPro.Web.Person
{
public partial class PersonView : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
public string PersonId
{
get
{
return (string)ViewState["PersonId"];
}
set
{
ViewState["PersonId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.PersonId = Request.Params["PersonId"];
this.InitDropDownList();
if (!string.IsNullOrEmpty(this.PersonId))
{
var person = BLL.Person_PersonsService.GetPerson_PersonsById(this.PersonId);
if (person != null)
{
#region
this.txtPersonName.Text = person.PersonName;
this.txtJobNum.Text = person.JobNum;
this.drpUnit.SelectedValue = person.UnitId;
if (!string.IsNullOrEmpty(person.DepartId))
{
this.drpDepart.SelectedValue = person.DepartId;
}
this.txtAccount.Text = person.Account;
if (!string.IsNullOrEmpty(person.RoleIds))
{
this.drpRole.SelectedValueArray = person.RoleIds.Split(',');
}
if (!string.IsNullOrEmpty(person.WorkPostId))
{
this.drpWorkPost.SelectedValue = person.WorkPostId;
}
if (person.IsForeign.HasValue)
{
this.ckIsForeign.Checked = person.IsForeign.Value;
}
if (person.IsOffice.HasValue)
{
this.ckIsOffice.Checked = person.IsOffice.Value;
}
2022-09-05 16:36:31 +08:00
this.txtPersonType.Text = DropListService.getPersonTypeNameByValue(person.PersonType);
if (!string.IsNullOrEmpty(person.IdcardType))
{
this.drpIdcardType.SelectedValue = person.IdcardType;
}
this.txtIdentityCard.Text = person.IdentityCard;
this.txtIdcardAddress.Text = person.IdcardAddress;
if (!string.IsNullOrEmpty(person.IdcardForever))
{
this.rblIdcardForever.SelectedValue = person.IdcardForever;
if (person.IdcardForever == "Y")
{
this.txtIdcardEndDate.ShowRedStar = false;
this.txtIdcardEndDate.Required = false;
}
}
this.txtIdcardStartDate.Text = string.Format("{0:yyyy-MM-dd}", person.IdcardStartDate);
this.txtIdcardEndDate.Text = string.Format("{0:yyyy-MM-dd}", person.IdcardEndDate);
if (!string.IsNullOrEmpty(person.Sex))
{
this.rblSex.SelectedValue = person.Sex;
}
if (person.Birthday.HasValue)
{
this.txtBirthday.Text = string.Format("{0:yyyy-MM-dd}", person.Birthday);
this.txtAge.Text = IDCardValid.CalculateAgeCorrect(person.Birthday.Value).ToString();
}
this.txtTelephone.Text = person.Telephone;
if (!string.IsNullOrEmpty(person.PhotoUrl))
{
imgPhoto.ImageUrl = ("~/" + person.PhotoUrl);
}
if (!string.IsNullOrEmpty(person.QRCodeAttachUrl))
{
imgQR.ImageUrl = ("~/" + person.QRCodeAttachUrl);
}
if (!string.IsNullOrEmpty(person.IDCardUrl))
{
imgIDCard.ImageUrl = ("~/" + person.IDCardUrl);
}
if (!string.IsNullOrEmpty(person.IDCardBackUrl))
{
imgIDCardBack.ImageUrl = ("~/" + person.IDCardBackUrl);
}
#endregion
#region
this.txtIntoDate.Text = string.Format("{0:yyyy-MM-dd}", person.IntoDate);
this.txtWorkDate.Text = string.Format("{0:yyyy-MM-dd}", person.WorkDate);
this.txtRetirementDate.Text = string.Format("{0:yyyy-MM-dd}", person.RetirementDate);
this.txtValidityDate.Text = string.Format("{0:yyyy-MM-dd}", person.ValidityDate);
if (!string.IsNullOrEmpty(person.PositionId))
{
this.drpPosition.SelectedValue = person.PositionId;
}
if (!string.IsNullOrEmpty(person.PostTitleId))
{
this.drpPostTitle.SelectedValue = person.PostTitleId;
}
this.txtPostTitleDate.Text = string.Format("{0:yyyy-MM-dd}", person.PostTitleDate);
this.txtGraduate.Text = person.Graduate;
this.txtMajor.Text = person.Major;
this.txtForeignLanguage.Text = person.ForeignLanguage;
if (!string.IsNullOrEmpty(person.CountryCode))
{
this.drpCountryCode.SelectedValue = person.CountryCode;
CityService.InitCityDropDownList(this.drpProvinceCode, person.CountryCode, false);
}
if (!string.IsNullOrEmpty(person.ProvinceCode))
{
this.drpProvinceCode.SelectedValue = person.ProvinceCode;
}
if (!string.IsNullOrEmpty(person.Nation))
{
this.drpNation.SelectedValue = person.Nation;
}
if (!string.IsNullOrEmpty(person.PoliticsStatus))
{
this.drpPoliticsStatus.SelectedValue = person.PoliticsStatus;
}
if (!string.IsNullOrEmpty(person.EduLevel))
{
this.drpEduLevel.SelectedValue = person.EduLevel;
}
if (!string.IsNullOrEmpty(person.MaritalStatus))
{
this.drpMaritalStatus.SelectedValue = person.MaritalStatus;
}
this.txtRelativeName.Text = person.RelativeName;
this.txtRelativeTel.Text = person.RelativeTel;
this.txtAddress.Text = person.Address;
#endregion
}
}
getInitGridCertificate();
getInitGridTrain();
getInitGridDuty();
getInitGridInOut();
getInitGridQuarterCheck();
2022-09-05 16:36:31 +08:00
}
}
#endregion
#region
/// <summary>
/// 初始化下拉框
/// </summary>
private void InitDropDownList()
{
UnitService.InitUnitDropDownList(this.drpUnit, string.Empty, false);
this.drpUnit.SelectedValue = this.CurrUser.UnitId ?? Const.UnitId_SEDIN;
DepartService.InitDepartDropDownList(this.drpDepart, true);
RoleService.InitRoleDropDownList(this.drpRole, null, null, true);
WorkPostService.InitWorkPostDropDownList(this.drpWorkPost, true);
PositionService.InitPositionDropDownList(this.drpPosition, true);
PostTitleService.InitPostTitleDropDownList(this.drpPostTitle, true);
BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpEduLevel, "EDU_LEVEL", true);
BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpMaritalStatus, "MARITAL_STATUS", true);
BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpIdcardType, "ZHENGJIAN_TYPE", false);
this.drpIdcardType.SelectedValue = "SHENFEN_ZHENGJIAN";
BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpPoliticsStatus, "POLITICAL_LANDSCAPE", true);
BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpNation, "MINZU_TYPE", true);
SynchroSetService.InitCountryDropDownList(this.drpCountryCode, false);
this.drpCountryCode.SelectedValue = "101";
CityService.InitCityDropDownList(this.drpProvinceCode, this.drpCountryCode.SelectedValue, true);
PositionService.InitPositionDropDownList(this.drpPosition, true);
;
}
#endregion
#region
/// <summary>
///
/// </summary>
private void getInitGridCertificate()
{
Funs.DropDownPageSize(this.ddlPageSizeGridCertificate);
BindGridCertificate();
}
#region
/// <summary>
/// 绑定数据
/// </summary>
private void BindGridCertificate()
{
var getData = PersonQualityService.getListData(this.PersonId, GridCertificate);
GridCertificate.RecordCount = PersonQualityService.count;
GridCertificate.DataSource = getData;
GridCertificate.DataBind();
}
#endregion
#region
/// <summary>
/// 分页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridCertificate_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGridCertificate();
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSizeGridCertificate_SelectedIndexChanged(object sender, EventArgs e)
{
GridCertificate.PageSize = Convert.ToInt32(ddlPageSizeGridCertificate.SelectedValue);
BindGridCertificate();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridCertificate_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
BindGridCertificate();
}
#endregion
/// <summary>
/// 双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridCertificate_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
this.EditDataCertificate();
}
protected void btnCertificateEdit_Click(object sender, EventArgs e)
{
this.EditDataCertificate();
}
/// <summary>
/// 编辑数据方法
/// </summary>
private void EditDataCertificate()
{
if (GridCertificate.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../HSSE/QualityAudit/PersonQualityEdit.aspx?PersonQualityId={0}&value=0", GridCertificate.SelectedRowID, "编辑 - ")));
}
#endregion
#region
2022-09-05 16:36:31 +08:00
/// <summary>
///
/// </summary>
private void getInitGridTrain()
2022-09-05 16:36:31 +08:00
{
Funs.DropDownPageSize(this.ddlPageSizeGridTrain);
BindGridTrain();
2022-09-05 16:36:31 +08:00
}
#region
/// <summary>
/// 绑定数据
/// </summary>
private void BindGridTrain()
2022-09-05 16:36:31 +08:00
{
var getData = Person_PersonTrainService.getListData(this.PersonId, GridTrain);
GridTrain.RecordCount = Person_PersonTrainService.count;
GridTrain.DataSource = getData;
GridTrain.DataBind();
2022-09-05 16:36:31 +08:00
}
#endregion
#region
/// <summary>
/// 分页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridTrain_PageIndexChange(object sender, GridPageEventArgs e)
2022-09-05 16:36:31 +08:00
{
BindGridTrain();
2022-09-05 16:36:31 +08:00
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSizeGridTrain_SelectedIndexChanged(object sender, EventArgs e)
2022-09-05 16:36:31 +08:00
{
GridTrain.PageSize = Convert.ToInt32(ddlPageSizeGridTrain.SelectedValue);
BindGridTrain();
2022-09-05 16:36:31 +08:00
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridTrain_Sort(object sender, FineUIPro.GridSortEventArgs e)
2022-09-05 16:36:31 +08:00
{
BindGridTrain();
2022-09-05 16:36:31 +08:00
}
#endregion
/// <summary>
/// 双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridTrain_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
this.EditDataTrain();
}
protected void btnTrainEdit_Click(object sender, EventArgs e)
{
this.EditDataTrain();
}
/// <summary>
/// 编辑数据方法
/// </summary>
private void EditDataTrain()
{
if (GridTrain.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PersonTrainEdit.aspx?PersonTrainId={0}&value=0", GridTrain.SelectedRowID, "编辑 - ")));
}
2022-09-05 16:36:31 +08:00
#endregion
#region
/// <summary>
///
/// </summary>
private void getInitGridQuarterCheck()
{
Funs.DropDownPageSize(this.ddlPageSizeGridQuarterCheck);
BindGridQuarterCheck();
}
#region
/// <summary>
/// 绑定数据
/// </summary>
private void BindGridQuarterCheck()
{
string strSql = @"select QuarterCheckId, QuarterCheckName, C.UserId, C.ProjectId,
StartTime,EndTime,State,R.RoleName,P.ProjectName,(case when c.State ='1' then '' else '' end) as StateName
from [dbo].[Person_QuarterCheck] C
left join Sys_Role R on C.RoleId=R.RoleId
left join Base_Project P on C.ProjectId=P.ProjectId
where 1=1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
if (this.CurrUser.PersonId != BLL.Const.sysglyId && this.CurrUser.PersonId != BLL.Const.hfnbdId)
{
strSql += " AND C.UserId=@UserId ";
listStr.Add(new SqlParameter("@UserId", this.PersonId));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
GridQuarterCheck.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(GridQuarterCheck, tb);
GridQuarterCheck.DataSource = table;
GridQuarterCheck.DataBind();
}
#endregion
#region gv字段转换
/// <summary>
///
/// </summary>
/// <param name="QuarterCheckId"></param>
/// <returns></returns>
protected string ConvertGrade(object QuarterCheckId)
{
decimal grade = 0;
if (!string.IsNullOrEmpty(QuarterCheckId.ToString()))
{
var list = BLL.Person_QuarterCheckItemService.GetCheckItemListById(QuarterCheckId.ToString());
foreach (var item in list)
{
if (item.Grade != null)
{
grade += item.Grade.Value * item.StandardGrade.Value / 100;
}
}
}
return grade.ToString("0.##");
}
#endregion
#region
/// <summary>
/// 分页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridQuarterCheck_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGridQuarterCheck();
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSizeGridQuarterCheck_SelectedIndexChanged(object sender, EventArgs e)
{
GridQuarterCheck.PageSize = Convert.ToInt32(ddlPageSizeGridQuarterCheck.SelectedValue);
BindGridQuarterCheck();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridQuarterCheck_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
BindGridQuarterCheck();
}
#endregion
/// <summary>
/// 双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridQuarterCheck_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
this.EditDataQuarterCheck();
}
protected void btnQuarterCheckEdit_Click(object sender, EventArgs e)
{
this.EditDataQuarterCheck();
}
/// <summary>
/// 编辑数据方法
/// </summary>
private void EditDataQuarterCheck()
{
if (GridQuarterCheck.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DepartPersonCheckingView.aspx?QuarterCheckId={0}", GridQuarterCheck.SelectedRowID, "编辑 - ")));
}
#endregion
#region
2022-09-05 16:36:31 +08:00
/// <summary>
///
/// </summary>
private void getInitGridDuty()
2022-09-05 16:36:31 +08:00
{
Funs.DropDownPageSize(this.ddlPageSizeGridDuty);
BindGridDuty();
2022-09-05 16:36:31 +08:00
}
#region
/// <summary>
/// 绑定数据
/// </summary>
private void BindGridDuty()
2022-09-05 16:36:31 +08:00
{
var getData = Person_DutyService.getListData(this.PersonId, GridDuty);
GridDuty.RecordCount = Person_DutyService.count;
GridDuty.DataSource = getData;
GridDuty.DataBind();
2022-09-05 16:36:31 +08:00
}
#endregion
#region
/// <summary>
/// 分页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridDuty_PageIndexChange(object sender, GridPageEventArgs e)
2022-09-05 16:36:31 +08:00
{
BindGridDuty();
2022-09-05 16:36:31 +08:00
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSizeGridDuty_SelectedIndexChanged(object sender, EventArgs e)
2022-09-05 16:36:31 +08:00
{
GridDuty.PageSize = Convert.ToInt32(ddlPageSizeGridDuty.SelectedValue);
BindGridDuty();
2022-09-05 16:36:31 +08:00
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridDuty_Sort(object sender, FineUIPro.GridSortEventArgs e)
2022-09-05 16:36:31 +08:00
{
BindGridDuty();
2022-09-05 16:36:31 +08:00
}
#endregion
/// <summary>
/// 双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridDuty_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
this.EditDataDuty();
}
protected void btnDutyEdit_Click(object sender, EventArgs e)
{
this.EditDataDuty();
}
/// <summary>
/// 编辑数据方法
/// </summary>
private void EditDataDuty()
{
if (GridDuty.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DepartPersonDutyView.aspx?DutyId={0}", GridDuty.SelectedRowID, "编辑 - ")));
}
#endregion
#region
/// <summary>
///
/// </summary>
private void getInitGridInOut()
{
Funs.DropDownPageSize(this.ddlPageSizeGridInOut);
BindGridInOut();
}
#region
/// <summary>
/// 绑定数据
/// </summary>
private void BindGridInOut()
{
var getData = SitePerson_PersonItemService.getListData(null, null, this.PersonId, null, null, null, null, GridInOut);
GridInOut.RecordCount = Person_PersonsService.count;
GridInOut.DataSource = getData;
GridInOut.DataBind();
}
#endregion
#region
/// <summary>
/// 分页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridInOut_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGridInOut();
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSizeGridInOut_SelectedIndexChanged(object sender, EventArgs e)
{
GridInOut.PageSize = Convert.ToInt32(ddlPageSizeGridInOut.SelectedValue);
BindGridInOut();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridInOut_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
BindGridInOut();
}
2022-09-05 16:36:31 +08:00
#endregion
#region
/// <summary>
/// 双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridInOut_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
this.EditDataInOut();
}
protected void btnInOutEdit_Click(object sender, EventArgs e)
{
this.EditDataInOut();
}
/// <summary>
/// 编辑数据方法
/// </summary>
private void EditDataInOut()
{
if (GridInOut.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PersonItemEdit.aspx?PersonItemId={0}&value=0", GridInOut.SelectedRowID, "编辑 - ")));
}
#endregion
#endregion
2022-09-05 16:36:31 +08:00
}
}