20220906新增项目劳务人员查看页面、合同信息表、取用户接口修改
This commit is contained in:
@@ -0,0 +1,204 @@
|
||||
using BLL;
|
||||
using System;
|
||||
|
||||
namespace FineUIPro.Web.Person
|
||||
{
|
||||
public partial class PersonContractEdit : PageBase
|
||||
{
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// 人员主键
|
||||
/// </summary>
|
||||
private string PersonId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["PersonId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["PersonId"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
private string PersonContractId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["PersonContractId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["PersonContractId"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
this.PersonId = Request.Params["PersonId"];
|
||||
this.PersonContractId = Request.Params["PersonContractId"];
|
||||
ProjectService.InitAllProjectDropDownList(this.drpProject, true);
|
||||
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
||||
{
|
||||
this.drpProject.SelectedValue = this.CurrUser.LoginProjectId;
|
||||
}
|
||||
UnitService.InitUnitDropDownList(this.drpUnit, null, true);
|
||||
if (!string.IsNullOrEmpty(this.CurrUser.UnitId))
|
||||
{
|
||||
this.drpUnit.SelectedValue = this.CurrUser.UnitId;
|
||||
}
|
||||
Funs.FineUIPleaseSelect(this.drpLeadMan);
|
||||
DropListService.InitConstDropDownList(this.drpContractType, DropListService.Group_ContractType, false);
|
||||
|
||||
if (!string.IsNullOrEmpty(this.PersonContractId))
|
||||
{
|
||||
var getData = BLL.Person_PersonContractService.getDataById(this.PersonContractId);
|
||||
if (getData != null)
|
||||
{
|
||||
this.PersonId = getData.PersonId;
|
||||
this.drpUnit.SelectedValue = getData.UnitId;
|
||||
this.drpProject.SelectedValue = getData.ProjectId;
|
||||
this.txtTelephone.Text = getData.Telephone;
|
||||
this.drpContractType.SelectedValue = getData.ContractType;
|
||||
this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", getData.StartDate);
|
||||
this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", getData.EndDate);
|
||||
|
||||
Person_PersonsService.InitFlowOperateControlUserDropDownList(this.drpLeadMan, null, this.drpUnit.SelectedValue, true);
|
||||
this.drpLeadMan.SelectedValue = getData.LeadManId;
|
||||
}
|
||||
}
|
||||
|
||||
var person = BLL.Person_PersonsService.GetPerson_PersonsById(this.PersonId);
|
||||
if (person != null)
|
||||
{
|
||||
this.txtPersonName.Text = person.PersonName;
|
||||
this.txtIdentityCard.Text = person.IdentityCard;
|
||||
}
|
||||
|
||||
if (Request.Params["value"] == "0")
|
||||
{
|
||||
this.btnSave.Hidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存数据
|
||||
/// </summary>
|
||||
private void SaveData()
|
||||
{
|
||||
if (!String.IsNullOrEmpty(this.PersonId))
|
||||
{
|
||||
Model.Person_PersonContract newData = new Model.Person_PersonContract
|
||||
{
|
||||
PersonId = this.PersonId,
|
||||
PersonContractId = this.PersonContractId,
|
||||
StartDate = Funs.GetNewDateTime(this.txtStartDate.Text.Trim()),
|
||||
EndDate = Funs.GetNewDateTime(this.txtEndDate.Text.Trim()),
|
||||
Telephone=this.txtTelephone.Text.Trim(),
|
||||
};
|
||||
if (!string.IsNullOrEmpty(this.drpProject.SelectedValue) && this.drpProject.SelectedValue != Const._Null)
|
||||
{
|
||||
newData.ProjectId = this.drpProject.SelectedValue;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.drpUnit.SelectedValue) && this.drpUnit.SelectedValue != Const._Null)
|
||||
{
|
||||
newData.UnitId = this.drpUnit.SelectedValue;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.drpLeadMan.SelectedValue) && this.drpLeadMan.SelectedValue != Const._Null)
|
||||
{
|
||||
newData.LeadManId = this.drpLeadMan.SelectedValue;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.drpContractType.SelectedValue) && this.drpContractType.SelectedValue != Const._Null)
|
||||
{
|
||||
newData.ContractType = this.drpContractType.SelectedValue;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.PersonContractId))
|
||||
{
|
||||
BLL.Person_PersonContractService.UpdateData(newData);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, this.txtIdentityCard.Text, newData.PersonContractId, BLL.Const.ProjectPersonMenuId, BLL.Const.BtnModify);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.PersonContractId = SQLHelper.GetNewID();
|
||||
newData.PersonContractId = this.PersonContractId;
|
||||
BLL.Person_PersonContractService.AddData(newData);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, this.txtIdentityCard.Text, newData.PersonContractId, BLL.Const.ProjectPersonMenuId, BLL.Const.BtnAdd);
|
||||
}
|
||||
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 下拉框事件
|
||||
/// <summary>
|
||||
/// 单位下拉框事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void drpUnit_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
Person_PersonsService.InitFlowOperateControlUserDropDownList(this.drpLeadMan, null, this.drpUnit.SelectedValue, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 合同下拉框事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void drpContractType_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpContractType.SelectedValue == "1")
|
||||
{
|
||||
this.txtStartDate.Hidden = false;
|
||||
this.txtEndDate.Hidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.txtStartDate.Hidden = true;
|
||||
this.txtEndDate.Hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void drpLeadMan_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
var getPerson = Person_PersonsService.GetPerson_PersonsById(this.drpLeadMan.SelectedValue);
|
||||
if (getPerson != null)
|
||||
{
|
||||
this.txtTelephone.Text = getPerson.Telephone;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user