1
This commit is contained in:
@@ -0,0 +1,183 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Web;
|
||||
|
||||
namespace FineUIPro.Web.HSSE.Examine
|
||||
{
|
||||
public partial class MinusScoreSituationEdit : PageBase
|
||||
{
|
||||
#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))
|
||||
{
|
||||
Model.Examine_MinusScoreSituation model = BLL.MinusScoreSituationService.GetMinusScoreSituationById(this.Id);
|
||||
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;
|
||||
this.txtDateTime.Text = string.Format("{0:yyyy-MM-dd}", model.DateTime);
|
||||
if (!string.IsNullOrEmpty(model.UserId))
|
||||
{
|
||||
this.drpUser.SelectedValue = model.UserId;
|
||||
}
|
||||
this.drpLevel.SelectedValue = model.Level;
|
||||
this.txtScore.Text = model.Score.ToString();
|
||||
this.txtRemark.Text = model.Remark;
|
||||
this.txtContent.Text = model.Content;
|
||||
//this.txtContent.Text = HttpUtility.HtmlDecode(model.Content);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
////自动生成编码
|
||||
this.txtCode.Text = SQLHelper.RunProcNewId2("SpGetNewCode3ByProjectId", "dbo.Examine_MinusScoreSituation", "Code", CurrUser.LoginProjectId);
|
||||
//////自动生成编码
|
||||
//this.txtCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.MinusScoreSituationMenuId, this.ProjectId, this.CurrUser.UnitId);
|
||||
this.drpUser.SelectedValue = this.CurrUser.UserId;
|
||||
this.txtDateTime.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化下拉框
|
||||
/// </summary>
|
||||
private void InitDropDownList()
|
||||
{
|
||||
BLL.UserService.InitUserDropDownList(this.drpUser, this.ProjectId, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 级别下拉加载
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void drpLevel_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
var level = drpLevel.SelectedValue;
|
||||
this.txtScore.Text = drpLevel.SelectedValue;
|
||||
}
|
||||
|
||||
|
||||
#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)
|
||||
{
|
||||
Model.Examine_MinusScoreSituation newModel = new Model.Examine_MinusScoreSituation
|
||||
{
|
||||
ProjectId = this.ProjectId,
|
||||
Code = this.txtCode.Text.Trim(),
|
||||
CompileDate = DateTime.Now,
|
||||
CompileMan = this.CurrUser.UserId
|
||||
};
|
||||
if (this.drpUser.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
newModel.UserId = this.drpUser.SelectedValue;
|
||||
}
|
||||
|
||||
newModel.DateTime = Funs.GetNewDateTime(this.txtDateTime.Text.Trim());
|
||||
newModel.Name = this.txtName.Text.Trim();
|
||||
newModel.Level = drpLevel.SelectedValue;
|
||||
newModel.LevelName = drpLevel.SelectedText;
|
||||
newModel.Score = int.Parse(drpLevel.SelectedValue);
|
||||
newModel.Remark = this.txtRemark.Text.Trim();
|
||||
newModel.Content = this.txtContent.Text.Trim();
|
||||
|
||||
if (!string.IsNullOrEmpty(this.Id))
|
||||
{
|
||||
newModel.Id = this.Id;
|
||||
BLL.MinusScoreSituationService.UpdateMinusScoreSituation(newModel);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, newModel.Code, newModel.Id, BLL.Const.MinusScoreSituationMenuId, BLL.Const.BtnModify);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Id = SQLHelper.GetNewID(typeof(Model.Examine_MinusScoreSituation));
|
||||
newModel.Id = this.Id;
|
||||
BLL.MinusScoreSituationService.AddMinusScoreSituation(newModel);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, newModel.Code, newModel.Id, BLL.Const.MinusScoreSituationMenuId, BLL.Const.BtnAdd);
|
||||
}
|
||||
}
|
||||
#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);
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Examine/MinusScoreSituation&menuId={1}", Id, BLL.Const.MinusScoreSituationMenuId)));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user