226 lines
8.3 KiB
C#
226 lines
8.3 KiB
C#
using System;
|
|
using System.Linq;
|
|
using BLL;
|
|
using BLL.OfficeCheck.Inspect;
|
|
namespace FineUIPro.Web.OfficeCheck.Inspect
|
|
{
|
|
public partial class SafetyInspectionRectify : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
private string InspectionItemId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["InspectionItemId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["InspectionItemId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 检查人
|
|
/// </summary>
|
|
public string InspectMan
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["InspectMan"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["InspectMan"] = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 类型
|
|
/// </summary>
|
|
public string type
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["type"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["type"] = value;
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
this.InspectionItemId = Request.QueryString["InspectionItemId"];
|
|
this.type = Request.QueryString["type"];
|
|
if (this.type == "1")
|
|
{
|
|
this.btnSave.Hidden = true;
|
|
}
|
|
if (!string.IsNullOrEmpty(this.InspectionItemId))
|
|
{
|
|
var registration = (from x in Funs.DB.Inspect_InspectionItem
|
|
join y in Funs.DB.Inspect_Inspection on x.InspectionId equals y.InspectionId into inspection
|
|
from inspectionJoin in inspection.DefaultIfEmpty()
|
|
where x.InspectionItemId == this.InspectionItemId
|
|
select new
|
|
{
|
|
//x.InspectionItemId,
|
|
//x.InspectionDescribe,
|
|
//x.PhotoUrl,
|
|
//x.VideoUrl,
|
|
//inspectionJoin.PersonResponsible,
|
|
//x.EvaluateResults,
|
|
//inspectionJoin.InspectMan,
|
|
//x.TimeLimited,
|
|
//x.RectificationDescription
|
|
}).FirstOrDefault();
|
|
//if (registration != null)
|
|
//{
|
|
// this.txtInspectionDescribe.Text = registration.InspectionDescribe;
|
|
// if (registration.InspectMan != null)
|
|
// {
|
|
// //查询用户名
|
|
// var user = (from x in Funs.DB.Sys_User
|
|
// where x.UserId == registration.InspectMan
|
|
// select new { x.UserName }).FirstOrDefault();
|
|
// if (user != null)
|
|
// {
|
|
// this.txtCheckManName.Text = user.UserName;
|
|
// }
|
|
// }
|
|
// this.txtEvaluateResults.Text = registration.EvaluateResults;
|
|
// if (registration.PersonResponsible != null)
|
|
// {
|
|
// //查询用户名
|
|
// var user = (from x in Funs.DB.Sys_User
|
|
// where x.UserId == registration.PersonResponsible
|
|
// select new { x.UserName }).FirstOrDefault();
|
|
// if (user != null)
|
|
// {
|
|
// this.txtResponsibleManName.Text = user.UserName;
|
|
// }
|
|
// }
|
|
// if (registration.TimeLimited != null)
|
|
// {
|
|
// this.txtTimeLimited.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", registration.TimeLimited);
|
|
// }
|
|
// this.txtRectificationDescription.Text = registration.RectificationDescription;
|
|
// this.InspectMan = registration.InspectMan;
|
|
//}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 保存
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(this.InspectMan) && this.InspectMan == this.CurrUser.UserId)
|
|
{
|
|
SaveData(true);
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您不是当前检查人,无法审批!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存数据
|
|
/// </summary>
|
|
/// <param name="p"></param>
|
|
private void SaveData(bool isClosed)
|
|
{
|
|
var register = Inspect_InspectionService.GetInspectItemsById(this.InspectionItemId);
|
|
if (register != null)
|
|
{
|
|
//获取ddlRectificationResults的值
|
|
var rectificationResults = this.ddlRectificationResults.SelectedValue;
|
|
//if (rectificationResults == "1") //同意
|
|
//{
|
|
// register.EvaluateResults = "合格";
|
|
// register.States = "5";
|
|
//}
|
|
//else if (rectificationResults == "2") //不同意
|
|
//{
|
|
// register.States = "2";
|
|
//}
|
|
//register.RectificationResults = rectificationResults;
|
|
//Inspect_InspectionService.UpdateInspectionItem(register);
|
|
if (isClosed)
|
|
{
|
|
if (string.IsNullOrEmpty(Request.Params["Main"]))
|
|
{
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
else
|
|
{
|
|
PageContext.RegisterStartupScript(String.Format("window.close();"));
|
|
// PageContext.RegisterStartupScript("openAndClose", "window.open('yourPageUrl', '_blank'); window.close();");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 附件查看
|
|
/// <summary>
|
|
/// 附件查看
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnPhotoUrl_Click(object sender, EventArgs e)
|
|
{
|
|
var itemId = this.InspectionItemId + "_1";
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
|
|
"../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/InspectionItem&menuId={1}", itemId,
|
|
BLL.Const.ProjectSafetyInspectionMenuId)));
|
|
}
|
|
protected void btnVideoUrl_Click(object sender, EventArgs e)
|
|
{
|
|
var itemId = this.InspectionItemId + "_2";
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
|
|
"../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/InspectionItem&menuId={1}", itemId,
|
|
BLL.Const.ProjectSafetyInspectionMenuId)));
|
|
}
|
|
#endregion
|
|
|
|
#region 附件上传
|
|
/// <summary>
|
|
/// 附件上传
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnAttachUrlR_Click(object sender, EventArgs e)
|
|
{
|
|
var itemId = this.InspectionItemId + "_3";
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format(
|
|
"../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/InspectionItem&menuId={1}", itemId,
|
|
BLL.Const.ProjectSafetyInspectionMenuId)));
|
|
}
|
|
#endregion
|
|
}
|
|
} |