153 lines
5.8 KiB
C#
153 lines
5.8 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.Customization.CNCEC4.ZHGL.Report
|
|
{
|
|
public partial class PersonnelAllocationInfoEdit : PageBase
|
|
{
|
|
#region 定义变量
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public string ReportId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ReportId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ReportId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 项目id
|
|
/// </summary>
|
|
public string ProjectId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ProjectId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ProjectId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 单位id
|
|
/// </summary>
|
|
public string UnitId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["UnitId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["UnitId"] = 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.ReportId = Request.Params["reportId"];
|
|
if (!string.IsNullOrEmpty(this.ReportId))
|
|
{
|
|
var report = BLL.PersonnelAllocationInfoService.GetReportById(this.ReportId);
|
|
if (report != null)
|
|
{
|
|
this.ProjectId = report.ProjectId;
|
|
this.UnitId = report.UnitId;
|
|
var project = BLL.ProjectService.GetProjectByProjectId(this.ProjectId);
|
|
if (project!=null)
|
|
{
|
|
this.txtProjectName.Text = project.ProjectName;
|
|
this.txtUnitName.Text = BLL.UnitService.GetUnitNameByUnitId(project.UnitId);
|
|
}
|
|
this.txtMonths.Text = string.Format("{0:yyyy-MM}", report.Months);
|
|
this.txtDuties.Text = report.Duties;
|
|
this.txtPersonName.Text = report.PersonName;
|
|
this.txtTelephone.Text = report.Telephone;
|
|
this.txtEmergentTel.Text = report.EmergentTel;
|
|
this.txtIdentityCard.Text = report.IdentityCard;
|
|
this.cblSex.SelectedValueArray = new string[] { report.Sex };
|
|
this.cblEducation.SelectedValueArray = new string[] { report.Education };
|
|
this.cblMajor.SelectedValueArray = new string[] { report.Major };
|
|
this.cblYearsOfService.SelectedValueArray = new string[] { report.YearsOfService };
|
|
this.cblQualification.SelectedValueArray = new string[] { report.Qualification };
|
|
this.cblPersonStates.SelectedValueArray = new string[] { report.PersonStates };
|
|
this.txtRemark.Text = report.Remark;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 保存、提交
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
SaveData(BLL.Const.BtnSave);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存方法
|
|
/// </summary>
|
|
/// <param name="type"></param>
|
|
private void SaveData(string type)
|
|
{
|
|
Model.Report_PersonnelAllocationInfo newReport = new Model.Report_PersonnelAllocationInfo();
|
|
newReport.Months = Convert.ToDateTime(this.txtMonths.Text);
|
|
newReport.ProjectId = this.ProjectId;
|
|
newReport.UnitId = BLL.ProjectService.GetProjectByProjectId(this.ProjectId).UnitId;
|
|
newReport.Duties = this.txtDuties.Text.Trim();
|
|
newReport.PersonName = this.txtPersonName.Text.Trim();
|
|
newReport.Telephone = this.txtTelephone.Text.Trim();
|
|
newReport.EmergentTel = this.txtEmergentTel.Text.Trim();
|
|
newReport.IdentityCard = this.txtIdentityCard.Text.Trim();
|
|
newReport.Sex = String.Join(",", this.cblSex.SelectedValueArray);
|
|
newReport.Education = String.Join(",", this.cblEducation.SelectedValueArray);
|
|
newReport.Major = String.Join(",", this.cblMajor.SelectedValueArray);
|
|
newReport.YearsOfService = String.Join(",", this.cblYearsOfService.SelectedValueArray);
|
|
newReport.Qualification = String.Join(",", this.cblQualification.SelectedValueArray);
|
|
newReport.PersonStates = String.Join(",", this.cblPersonStates.SelectedValueArray);
|
|
newReport.Remark = this.txtRemark.Text.Trim();
|
|
|
|
if (!string.IsNullOrEmpty(this.ReportId))
|
|
{
|
|
newReport.ReportId = this.ReportId;
|
|
BLL.PersonnelAllocationInfoService.UpdateReport(newReport);
|
|
}
|
|
else
|
|
{
|
|
newReport.ReportId = SQLHelper.GetNewID(typeof(Model.Report_PersonnelAllocationInfo));
|
|
BLL.PersonnelAllocationInfoService.AddReport(newReport);
|
|
}
|
|
ShowNotify("保存成功");
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
#endregion
|
|
}
|
|
} |