239 lines
9.5 KiB
C#
239 lines
9.5 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using BLL;
|
||
|
||
namespace FineUIPro.Web.ThreeYearAction.ConstructionStandardization
|
||
{
|
||
public partial class SelfEvaluationEdit : PageBase
|
||
{
|
||
#region 定义项
|
||
|
||
/// <summary>
|
||
/// 主键
|
||
/// </summary>
|
||
private string PersonPerfomanceId
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["PersonPerfomanceId"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["PersonPerfomanceId"] = value;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 附件路径
|
||
/// </summary>
|
||
public string AttachUrl
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["AttachUrl"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["AttachUrl"] = value;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 项目主键
|
||
/// </summary>
|
||
public string ProjectId
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["ProjectId"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["ProjectId"] = value;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 加载
|
||
/// <summary>
|
||
/// 加载页面
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
this.ProjectId = this.CurrUser.LoginProjectId;
|
||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||
Funs.FineUIPleaseSelect(this.drpTeamGroupId);
|
||
this.InitDropDownList();
|
||
this.PersonPerfomanceId = Request.Params["PersonPerfomanceId"];
|
||
if (!string.IsNullOrEmpty(this.PersonPerfomanceId))
|
||
{
|
||
Model.Perfomance_PersonPerfomance personPerfomance = BLL.PersonPerfomanceService.GetPersonPerfomanceById(this.PersonPerfomanceId);
|
||
if (personPerfomance!=null)
|
||
{
|
||
this.ProjectId = personPerfomance.ProjectId;
|
||
if (this.ProjectId != this.CurrUser.LoginProjectId)
|
||
{
|
||
this.InitDropDownList();
|
||
}
|
||
this.txtPersonPerfomanceCode.Text = CodeRecordsService.ReturnCodeByDataId(this.PersonPerfomanceId);
|
||
if (!string.IsNullOrEmpty(personPerfomance.UnitId))
|
||
{
|
||
this.drpUnitId.SelectedValue = personPerfomance.UnitId;
|
||
|
||
BLL.TeamGroupService.InitTeamGroupProjectUnitDropDownList(this.drpTeamGroupId, this.ProjectId, this.drpUnitId.SelectedValue, true);
|
||
this.drpTeamGroupId.SelectedIndex = 0;
|
||
if (!string.IsNullOrEmpty(personPerfomance.TeamGroupId))
|
||
{
|
||
this.drpTeamGroupId.SelectedValue = personPerfomance.TeamGroupId;
|
||
}
|
||
}
|
||
this.txtEvaluationDef.Text = personPerfomance.EvaluationDef;
|
||
|
||
this.AttachUrl = personPerfomance.AttachUrl;
|
||
this.divFile1.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../", this.AttachUrl);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
////自动生成编码
|
||
this.txtPersonPerfomanceCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.SelfEvaluationMenuId, this.ProjectId, this.CurrUser.UnitId);
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 初始化下拉框
|
||
/// </summary>
|
||
private void InitDropDownList()
|
||
{
|
||
BLL.UnitService.InitUnitDropDownList(this.drpUnitId, this.ProjectId, false);
|
||
//BLL.ConstValue.InitConstValueDropDownList(this.drpRewardOrPunish, BLL.ConstValue.Group_RewardOrPunish, true);
|
||
}
|
||
|
||
#region 保存
|
||
/// <summary>
|
||
/// 保存按钮
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnSave_Click(object sender, EventArgs e)
|
||
{
|
||
this.SaveData(BLL.Const.BtnSave);
|
||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||
}
|
||
|
||
/// <summary>
|
||
/// 保存数据
|
||
/// </summary>
|
||
/// <param name="type"></param>
|
||
private void SaveData(string type)
|
||
{
|
||
if (this.drpUnitId.SelectedValue == BLL.Const._Null)
|
||
{
|
||
Alert.ShowInTop("请选择分包单位", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
|
||
Model.Perfomance_PersonPerfomance personPerfomance = new Model.Perfomance_PersonPerfomance
|
||
{
|
||
ProjectId = this.ProjectId,
|
||
EvaluationType = 1,//评价类型 0:个人绩效评价、1:自我评价
|
||
PersonPerfomanceCode = this.txtPersonPerfomanceCode.Text.Trim()
|
||
};
|
||
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
|
||
{
|
||
personPerfomance.UnitId = this.drpUnitId.SelectedValue;
|
||
}
|
||
if (this.drpTeamGroupId.SelectedValue != BLL.Const._Null)
|
||
{
|
||
personPerfomance.TeamGroupId = this.drpTeamGroupId.SelectedValue;
|
||
}
|
||
//personPerfomance.PersonId = this.CurrUser.UserId;
|
||
//personPerfomance.EvaluationDate = DateTime.Now;
|
||
personPerfomance.EvaluationDef = this.txtEvaluationDef.Text.Trim();
|
||
personPerfomance.SubContractNum = string.Empty;
|
||
personPerfomance.RPMoney = 0;
|
||
personPerfomance.AssessmentGroup = string.Empty;
|
||
personPerfomance.Behavior_1 = string.Empty;
|
||
personPerfomance.Behavior_2 = string.Empty;
|
||
personPerfomance.Behavior_3 = string.Empty;
|
||
personPerfomance.Behavior_4 = string.Empty;
|
||
personPerfomance.Behavior_5 = string.Empty;
|
||
personPerfomance.Behavior_6 = string.Empty;
|
||
personPerfomance.Behavior_7 = string.Empty;
|
||
personPerfomance.Behavior_8 = string.Empty;
|
||
personPerfomance.Behavior_9 = string.Empty;
|
||
personPerfomance.Behavior_10 = string.Empty;
|
||
personPerfomance.Score_1 = 0;
|
||
personPerfomance.Score_2 = 0;
|
||
personPerfomance.Score_3 = 0;
|
||
personPerfomance.Score_4 = 0;
|
||
personPerfomance.Score_5 = 0;
|
||
personPerfomance.Score_6 = 0;
|
||
personPerfomance.Score_7 = 0;
|
||
personPerfomance.Score_8 = 0;
|
||
personPerfomance.Score_9 = 0;
|
||
personPerfomance.Score_10 = 0;
|
||
personPerfomance.TotalJudging = string.Empty;
|
||
personPerfomance.TotalScore = 0;
|
||
personPerfomance.States = BLL.Const.State_2;
|
||
personPerfomance.CompileMan = this.CurrUser.UserId;
|
||
personPerfomance.AttachUrl = this.AttachUrl;
|
||
if (!string.IsNullOrEmpty(this.PersonPerfomanceId))
|
||
{
|
||
personPerfomance.PersonPerfomanceId = this.PersonPerfomanceId;
|
||
BLL.PersonPerfomanceService.UpdatePersonPerfomance(personPerfomance);
|
||
BLL.LogService.AddSys_Log(this.CurrUser, personPerfomance.PersonPerfomanceCode, personPerfomance.PersonPerfomanceId, BLL.Const.SelfEvaluationMenuId, BLL.Const.BtnModify);
|
||
}
|
||
else
|
||
{
|
||
this.PersonPerfomanceId = SQLHelper.GetNewID(typeof(Model.Perfomance_PersonPerfomance));
|
||
personPerfomance.PersonPerfomanceId = this.PersonPerfomanceId;
|
||
personPerfomance.EvaluationDate = DateTime.Now;
|
||
BLL.PersonPerfomanceService.AddSelfEvaluation(personPerfomance);
|
||
BLL.LogService.AddSys_Log(this.CurrUser, personPerfomance.PersonPerfomanceCode, personPerfomance.PersonPerfomanceId, BLL.Const.SelfEvaluationMenuId, BLL.Const.BtnAdd);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region DropDownList下拉选择事件
|
||
/// <summary>
|
||
/// 分包单位下拉选择事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void drpUnitId_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
BLL.TeamGroupService.InitTeamGroupProjectUnitDropDownList(this.drpTeamGroupId, this.ProjectId, this.drpUnitId.SelectedValue, true);
|
||
this.drpTeamGroupId.SelectedIndex = 0;
|
||
//BLL.PersonService.InitPersonByProjectUnitDropDownList(this.drpPersonId, this.ProjectId, this.drpUnitId.SelectedValue, true);
|
||
//this.drpPersonId.SelectedIndex = 0;
|
||
}
|
||
#endregion
|
||
|
||
#region 附件上传
|
||
/// <summary>
|
||
/// 附件上传
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnFile1_Click(object sender, EventArgs e)
|
||
{
|
||
if (btnFile1.HasFile)
|
||
{
|
||
this.AttachUrl = BLL.UploadFileService.UploadAttachment(BLL.Funs.RootPath, this.btnFile1, this.AttachUrl, UploadFileService.SelfEvaluationFilePath);
|
||
this.divFile1.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../", this.AttachUrl);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
}
|
||
} |