20210430
This commit is contained in:
@@ -0,0 +1,197 @@
|
||||
using BLL;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.HSSE.Hazard
|
||||
{
|
||||
public partial class ProjectSuperviseCheckRectifyEdit : PageBase
|
||||
{
|
||||
#region 定义变量
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string SuperviseCheckRectifyId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["SuperviseCheckRectifyId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["SuperviseCheckRectifyId"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 定义集合
|
||||
/// </summary>
|
||||
private static List<Model.View_Supervise_SuperviseCheckRectifyItem> superviseCheckRectifyItems = new List<Model.View_Supervise_SuperviseCheckRectifyItem>();
|
||||
#endregion
|
||||
|
||||
#region 加载页面
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
////权限按钮方法
|
||||
this.GetButtonPower();
|
||||
this.SuperviseCheckRectifyId = Request.Params["SuperviseCheckRectifyId"];
|
||||
if (!string.IsNullOrEmpty(this.SuperviseCheckRectifyId))
|
||||
{
|
||||
var rectify = Funs.DB.View_Supervise_SuperviseCheckRectify.FirstOrDefault(x => x.SuperviseCheckRectifyId == this.SuperviseCheckRectifyId);
|
||||
if (rectify != null)
|
||||
{
|
||||
this.lbUnitName.Text = rectify.UnitName;
|
||||
this.lbProjectName.Text = rectify.ProjectName;
|
||||
this.lbSuperviseCheckRectifyCode.Text = rectify.SuperviseCheckRectifyCode;
|
||||
if (!string.IsNullOrEmpty(rectify.IssueMan))
|
||||
{
|
||||
this.txtIssueMan.Text = rectify.IssueMan;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.txtIssueMan.Text = this.CurrUser.UserName;
|
||||
}
|
||||
if (rectify.IssueDate != null)
|
||||
{
|
||||
this.txtIssueDate.Text = string.Format("{0:yyyy-MM-dd}", rectify.IssueDate);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.txtIssueDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||||
}
|
||||
|
||||
superviseCheckRectifyItems = (from x in Funs.DB.View_Supervise_SuperviseCheckRectifyItem where x.SuperviseCheckRectifyId == this.SuperviseCheckRectifyId orderby x.RectifyCode select x).ToList();
|
||||
Grid1.DataSource = superviseCheckRectifyItems;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
Save("add");
|
||||
}
|
||||
|
||||
//protected void btnUpdata_Click(object sender, EventArgs e)
|
||||
//{
|
||||
// Save("updata");
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 保存
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
private void Save(string type)
|
||||
{
|
||||
Model.Supervise_SuperviseCheckRectify superviseCheckRectify = BLL.SuperviseCheckRectifyService.GetSuperviseCheckRectifyById(Request.Params["SuperviseCheckRectifyId"]);
|
||||
superviseCheckRectify.IssueMan = this.txtIssueMan.Text.Trim();
|
||||
if (!string.IsNullOrEmpty(this.txtIssueDate.Text.Trim()))
|
||||
{
|
||||
superviseCheckRectify.IssueDate = Convert.ToDateTime(this.txtIssueDate.Text.Trim());
|
||||
}
|
||||
BLL.SuperviseCheckRectifyItemService.DeleteSuperviseCheckRectifyItemBySuperviseCheckRectifyId(Request.Params["SuperviseCheckRectifyId"]);
|
||||
jerqueSaveList();
|
||||
bool result = true;
|
||||
foreach (var item in superviseCheckRectifyItems)
|
||||
{
|
||||
Model.Supervise_SuperviseCheckRectifyItem newSuperviseCheckRectifyItem = new Model.Supervise_SuperviseCheckRectifyItem
|
||||
{
|
||||
SuperviseCheckRectifyItemId = item.SuperviseCheckRectifyItemId,
|
||||
SuperviseCheckRectifyId = item.SuperviseCheckRectifyId,
|
||||
RectifyItemId = item.RectifyItemId,
|
||||
ConfirmMan = item.ConfirmMan,
|
||||
ConfirmDate = item.ConfirmDate,
|
||||
OrderEndDate = item.OrderEndDate,
|
||||
OrderEndPerson = item.OrderEndPerson,
|
||||
RealEndDate = item.RealEndDate,
|
||||
AttachUrl = item.AttachUrl
|
||||
};
|
||||
if (item.RealEndDate == null)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
BLL.SuperviseCheckRectifyItemService.AddSuperviseCheckRectifyItem(newSuperviseCheckRectifyItem);
|
||||
}
|
||||
if (result) //已全部确认完成
|
||||
{
|
||||
superviseCheckRectify.HandleState = "3"; //已完成
|
||||
}
|
||||
else
|
||||
{
|
||||
superviseCheckRectify.HandleState = "2"; //已签发但未完成
|
||||
}
|
||||
BLL.SuperviseCheckRectifyService.UpdateSuperviseCheckRectify(superviseCheckRectify);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, superviseCheckRectify.SuperviseCheckRectifyCode, superviseCheckRectify.SuperviseCheckRectifyId, BLL.Const.SuperviseCheckRectifyMenuId, BLL.Const.BtnModify);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存集合
|
||||
/// <summary>
|
||||
/// 保存集合
|
||||
/// </summary>
|
||||
private void jerqueSaveList()
|
||||
{
|
||||
JArray mergedData = Grid1.GetMergedData();
|
||||
foreach (JObject mergedRow in mergedData)
|
||||
{
|
||||
string status = mergedRow.Value<string>("status");
|
||||
JObject values = mergedRow.Value<JObject>("values");
|
||||
var item = superviseCheckRectifyItems.FirstOrDefault(e => e.SuperviseCheckRectifyItemId == values.Value<string>("SuperviseCheckRectifyItemId"));
|
||||
item.ConfirmMan = values.Value<string>("ConfirmMan");
|
||||
item.ConfirmDate = Funs.GetNewDateTime(values.Value<string>("ConfirmDate"));
|
||||
item.OrderEndDate = Funs.GetNewDateTime(values.Value<string>("OrderEndDate"));
|
||||
item.OrderEndPerson = values.Value<string>("OrderEndPerson");
|
||||
item.RealEndDate = Funs.GetNewDateTime(values.Value<string>("RealEndDate"));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取按钮权限
|
||||
/// <summary>
|
||||
/// 获取按钮权限
|
||||
/// </summary>
|
||||
/// <param name="button"></param>
|
||||
/// <returns></returns>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
if (Request.Params["value"] == "0")
|
||||
{
|
||||
return;
|
||||
}
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectSuperviseCheckRectifyMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
|
||||
if (buttonList.Contains(BLL.Const.BtnSave))
|
||||
{
|
||||
this.btnSave.Hidden = false;
|
||||
}
|
||||
//if (buttonList.Contains(BLL.Const.BtnSaveUp))
|
||||
//{
|
||||
// this.btnUpdata.Hidden = false;
|
||||
//}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user