127 lines
4.3 KiB
C#
127 lines
4.3 KiB
C#
|
using BLL;
|
|||
|
using Model.APIItem.SYHSE;
|
|||
|
using Newtonsoft.Json;
|
|||
|
using System;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Configuration;
|
|||
|
using System.Data;
|
|||
|
using System.Linq;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Web;
|
|||
|
using System.Web.UI;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
|
|||
|
namespace FineUIPro.Web.SYHSE
|
|||
|
{
|
|||
|
public partial class Data_RiskEdit : PageBase
|
|||
|
{
|
|||
|
#region 公共字段
|
|||
|
/// <summary>
|
|||
|
/// 主键
|
|||
|
/// </summary>
|
|||
|
public string Id
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["Id"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["Id"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 把状态转换代号为文字形式
|
|||
|
/// </summary>
|
|||
|
/// <param name="state"></param>
|
|||
|
/// <returns></returns>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
Id = Request.Params["Id"];
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(Id))
|
|||
|
{
|
|||
|
|
|||
|
var risk = Funs.DB.SYHSEData_Risk.FirstOrDefault(x => x.Id == Id);
|
|||
|
if (risk != null)
|
|||
|
{
|
|||
|
if (risk.ReportDate.HasValue)
|
|||
|
{
|
|||
|
this.txtReportDate.Text = risk.ReportDate.Value.ToString("yyyy-MM-dd");
|
|||
|
}
|
|||
|
this.txtControlObject.Text = risk.ControlObject;
|
|||
|
this.txtRespDepartment.Text = risk.RespDepartment;
|
|||
|
this.txtRespPerson.Text = risk.RespPerson;
|
|||
|
this.txtAnalysisUnit.Text = risk.AnalysisUnit;
|
|||
|
this.txtRiskEvent.Text = risk.RiskEvent;
|
|||
|
this.txtRiskLevel.Text = risk.RiskLevel;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
//string projectId, string userId, string menuId, string buttonName)
|
|||
|
if (BLL.CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.SYHSE_PromiseMenuId, BLL.Const.BtnSave, "shiye"))
|
|||
|
{
|
|||
|
Model.SYHSEData_Risk risk = Funs.DB.SYHSEData_Risk.FirstOrDefault(x => x.Id == Id);
|
|||
|
if (risk == null)
|
|||
|
{
|
|||
|
risk = new Model.SYHSEData_Risk();
|
|||
|
risk.Id = Guid.NewGuid().ToString();
|
|||
|
Funs.DB.SYHSEData_Risk.InsertOnSubmit(risk);
|
|||
|
}
|
|||
|
risk.ReportDate = this.txtReportDate.SelectedDate;
|
|||
|
risk.ProjectId = this.CurrUser.LoginProjectId;
|
|||
|
risk.CreateMan = this.CurrUser.UserId;
|
|||
|
risk.CreateDate = DateTime.Now;
|
|||
|
risk.ControlObject = this.txtControlObject.Text;
|
|||
|
risk.RespDepartment = this.txtRespDepartment.Text;
|
|||
|
risk.RespPerson = this.txtRespPerson.Text;
|
|||
|
risk.AnalysisUnit = this.txtAnalysisUnit.Text;
|
|||
|
risk.RiskEvent = this.txtRiskEvent.Text;
|
|||
|
risk.RiskLevel = this.txtRiskLevel.Text;
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
DataRiskItem newItem = new DataRiskItem();
|
|||
|
newItem.Id = risk.Id;
|
|||
|
newItem.ProjectId = risk.ProjectId;
|
|||
|
newItem.UnitId = risk.UnitId;
|
|||
|
newItem.ControlObject = risk.ControlObject;
|
|||
|
newItem.ReportDate = risk.ReportDate;
|
|||
|
newItem.RespDepartment = risk.RespDepartment;
|
|||
|
newItem.RespPerson = risk.RespPerson;
|
|||
|
newItem.AnalysisUnit = risk.AnalysisUnit;
|
|||
|
newItem.RiskEvent = risk.RiskEvent;
|
|||
|
newItem.RiskLevel = risk.RiskLevel;
|
|||
|
newItem.CreateMan = risk.CreateMan;
|
|||
|
newItem.CreateDate = risk.CreateDate;
|
|||
|
string contenttype = "application/json;charset=utf-8";
|
|||
|
string url = ConfigurationManager.AppSettings["QHSE_URL"] + "api/SYHSEData/SaveRisk";
|
|||
|
string messages = APIGetHttpService.Http(url, "POST", contenttype, null, JsonConvert.SerializeObject(newItem));
|
|||
|
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|