xinjiang/SGGL/FineUIPro.Web/HSSE/Examine/BonusScoreSelfManagementEdi...

195 lines
7.4 KiB
C#
Raw Normal View History

2025-02-22 10:31:57 +08:00
using BLL;
using System;
namespace FineUIPro.Web.HSSE.Examine
{
2025-03-04 18:12:07 +08:00
public partial class BonusScoreSelfManagementEdit : PageBase
2025-02-22 10:31:57 +08:00
{
#region
/// <summary>
/// 主键
/// </summary>
public string Id
{
get
{
return (string)ViewState["Id"];
}
set
{
ViewState["Id"] = 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();
this.InitDropDownList();
this.Id = Request.Params["Id"];
if (!string.IsNullOrEmpty(this.Id))
{
2025-03-04 18:12:07 +08:00
Model.Examine_BonusScoreSelfManagement model = BLL.BonusScoreSelfManagementService.GetBonusScoreSelfManagementById(this.Id);
2025-02-22 10:31:57 +08:00
if (model != null)
{
this.ProjectId = model.ProjectId;
if (this.ProjectId != this.CurrUser.LoginProjectId)
{
this.InitDropDownList();
}
this.txtCode.Text = model.Code;
this.txtName.Text = model.Name;
2025-03-04 18:12:07 +08:00
this.txtScore.Text = model.Score.ToString();
//this.txtDateTime.Text = string.Format("{0:yyyy-MM-dd}", model.DateTime);
if (!string.IsNullOrEmpty(model.PersonId))
2025-02-22 10:31:57 +08:00
{
2025-03-04 18:12:07 +08:00
this.drpPerson.SelectedValue = model.PersonId;
2025-02-22 10:31:57 +08:00
}
2025-03-04 18:12:07 +08:00
if (!string.IsNullOrEmpty(model.BonusScoreTypeId))
{
this.drpBonusScoreType.SelectedValue = model.BonusScoreTypeId;
}
this.txtScore.Text = model.Score.ToString();
2025-02-22 10:31:57 +08:00
this.txtRemark.Text = model.Remark;
this.txtContent.Text = model.Content;
//this.txtContent.Text = HttpUtility.HtmlDecode(model.Content);
}
}
else
{
////自动生成编码
2025-03-04 18:12:07 +08:00
this.txtCode.Text = SQLHelper.RunProcNewId2("SpGetNewCode3ByProjectId", "dbo.Examine_BonusScoreSelfManagement", "Code", CurrUser.LoginProjectId);
2025-02-22 10:31:57 +08:00
//////自动生成编码
2025-03-04 18:12:07 +08:00
//this.txtCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.BonusScoreSelfManagementMenuId, this.ProjectId, this.CurrUser.UnitId);
//this.drpPerson.SelectedValue = this.CurrUser.UserId;
//this.txtDateTime.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
2025-02-22 10:31:57 +08:00
}
}
}
/// <summary>
/// 初始化下拉框
/// </summary>
private void InitDropDownList()
{
2025-03-04 18:12:07 +08:00
BonusScoreTypeService.InitBonusScoreTypeDropDownList(this.drpBonusScoreType, false);
PersonService.InitPersonByProjectUnitDropDownList(this.drpPerson, this.CurrUser.LoginProjectId, "", false);
}
/// <summary>
/// 加分类型下拉加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpBonusScoreType_SelectedIndexChanged(object sender, EventArgs e)
{
int score = 0;
string typeId = drpBonusScoreType.SelectedValue;
if (!string.IsNullOrWhiteSpace(typeId))
{
var bonusScoreType = BLL.BonusScoreTypeService.GetBonusScoreTypeById(typeId);
score = bonusScoreType.Score;
}
this.txtScore.Text = score.ToString();
2025-02-22 10:31:57 +08:00
}
#endregion
#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)
{
2025-03-04 18:12:07 +08:00
Model.Examine_BonusScoreSelfManagement newModel = new Model.Examine_BonusScoreSelfManagement
2025-02-22 10:31:57 +08:00
{
ProjectId = this.ProjectId,
Code = this.txtCode.Text.Trim(),
CompileDate = DateTime.Now,
CompileMan = this.CurrUser.UserId
};
2025-03-04 18:12:07 +08:00
if (this.drpPerson.SelectedValue != BLL.Const._Null)
{
newModel.PersonId = this.drpPerson.SelectedValue;
}
if (this.drpBonusScoreType.SelectedValue != BLL.Const._Null)
2025-02-22 10:31:57 +08:00
{
2025-03-04 18:12:07 +08:00
newModel.BonusScoreTypeId = this.drpBonusScoreType.SelectedValue;
newModel.BonusScoreTypeName = this.drpBonusScoreType.SelectedText;
2025-02-22 10:31:57 +08:00
}
2025-03-04 18:12:07 +08:00
//newModel.DateTime = Funs.GetNewDateTime(this.txtDateTime.Text.Trim());
2025-02-22 10:31:57 +08:00
newModel.Name = this.txtName.Text.Trim();
2025-03-04 18:12:07 +08:00
newModel.Score = int.Parse(this.txtScore.Text.Trim());
2025-02-22 10:31:57 +08:00
newModel.Remark = this.txtRemark.Text.Trim();
newModel.Content = this.txtContent.Text.Trim();
if (!string.IsNullOrEmpty(this.Id))
{
newModel.Id = this.Id;
2025-03-04 18:12:07 +08:00
BLL.BonusScoreSelfManagementService.UpdateBonusScoreSelfManagement(newModel);
BLL.LogService.AddSys_Log(this.CurrUser, newModel.Code, newModel.Id, BLL.Const.BonusScoreSelfManagementMenuId, BLL.Const.BtnModify);
2025-02-22 10:31:57 +08:00
}
else
{
2025-03-04 18:12:07 +08:00
this.Id = SQLHelper.GetNewID(typeof(Model.Examine_BonusScoreSelfManagement));
2025-02-22 10:31:57 +08:00
newModel.Id = this.Id;
2025-03-04 18:12:07 +08:00
BLL.BonusScoreSelfManagementService.AddBonusScoreSelfManagement(newModel);
BLL.LogService.AddSys_Log(this.CurrUser, newModel.Code, newModel.Id, BLL.Const.BonusScoreSelfManagementMenuId, BLL.Const.BtnAdd);
2025-02-22 10:31:57 +08:00
}
}
#endregion
#region
/// <summary>
/// 上传附件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAttachUrl_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.Id))
{
SaveData(BLL.Const.BtnSave);
}
2025-03-04 18:12:07 +08:00
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Examine/BonusScoreSelfManagement&menuId={1}", Id, BLL.Const.BonusScoreSelfManagementMenuId)));
2025-02-22 10:31:57 +08:00
}
#endregion
}
}