356 lines
12 KiB
C#
356 lines
12 KiB
C#
|
using BLL;
|
|||
|
using Model;
|
|||
|
using Newtonsoft.Json.Linq;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
using System.Data.Linq.SqlClient;
|
|||
|
using System.Data.SqlClient;
|
|||
|
using System.Linq;
|
|||
|
using System.Reflection;
|
|||
|
|
|||
|
namespace FineUIPro.Web.Customization.CNCCG.ZHGL.Problem
|
|||
|
{
|
|||
|
public partial class ProblemReplyManagerEdit : PageBase
|
|||
|
{
|
|||
|
#region 定义项
|
|||
|
/// <summary>
|
|||
|
/// 主键
|
|||
|
/// </summary>
|
|||
|
public string ProNoticeId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["ProNoticeId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["ProNoticeId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///受检单位负责人签名附件路径
|
|||
|
/// </summary>
|
|||
|
public string SignatureUrl
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["SignatureUrl"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["SignatureUrl"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 检查组签名附件路径
|
|||
|
/// </summary>
|
|||
|
public string SignatureUrl1
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["SignatureUrl1"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["SignatureUrl1"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 复查人签名附件路径
|
|||
|
/// </summary>
|
|||
|
public string SignatureUrl2
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["SignatureUrl2"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["SignatureUrl2"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 分管领导签名附件路径
|
|||
|
/// </summary>
|
|||
|
public string SignatureUrl3
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["SignatureUrl3"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["SignatureUrl3"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 类型 1查看
|
|||
|
/// </summary>
|
|||
|
public string Types
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["Types"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["Types"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 定义集合
|
|||
|
/// </summary>
|
|||
|
private static List<ProblemNoticeItems> details = new List<ProblemNoticeItems>();
|
|||
|
#endregion
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|||
|
ProNoticeId = Request.Params["ProNoticeId"];
|
|||
|
Types = Request.Params["Type"];
|
|||
|
menuPower(ProNoticeId);
|
|||
|
if (!string.IsNullOrEmpty(ProNoticeId))
|
|||
|
{
|
|||
|
var model = Funs.DB.Problem_Notice.FirstOrDefault(x => x.ProNoticeId == ProNoticeId);
|
|||
|
if (model != null)
|
|||
|
{
|
|||
|
if (model.ProType == "2")
|
|||
|
{
|
|||
|
txtProjectName.Text = BLL.UnitService.GetUnitByUnitId(model.ProjectId).UnitName;
|
|||
|
}
|
|||
|
else {
|
|||
|
txtProjectName.Text = BLL.ProjectService.GetProjectByProjectId(model.ProjectId).ProjectName;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#region 加载检查项
|
|||
|
var strSql = @"select F.ProNoticeCId,F.QueDescribe,F.ReSituation,F.QueType as QueTypeName,F.RiskLevel as RiskLevelName
|
|||
|
,F.SortIndex from Problem_Notice_C F
|
|||
|
|
|||
|
where ProNoticeId='" + model.ProNoticeId + "' order by SortIndex";
|
|||
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|||
|
SqlParameter[] parameter = listStr.ToArray();
|
|||
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|||
|
|
|||
|
Grid1.RecordCount = tb.Rows.Count;
|
|||
|
|
|||
|
|
|||
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|||
|
|
|||
|
details = GetList<ProblemNoticeItems>(table);
|
|||
|
|
|||
|
Grid1.DataSource = table;
|
|||
|
Grid1.DataBind();
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 加载审批记录
|
|||
|
DataTable approveData = BLL.ProblemNoticeApprove.GetAllApproveData(ProNoticeId+"reply");
|
|||
|
Grid_ApproveLog.DataSource = approveData;
|
|||
|
Grid_ApproveLog.DataBind();
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
//if (Types == "1")
|
|||
|
//{
|
|||
|
// btnSave.Hidden = true;
|
|||
|
// btnSubmit.Hidden = true;
|
|||
|
|
|||
|
//}
|
|||
|
}
|
|||
|
}
|
|||
|
private void menuPower(string ProNoticeId)
|
|||
|
{
|
|||
|
if (string.IsNullOrEmpty(ProNoticeId))
|
|||
|
{
|
|||
|
Form_Approve.Hidden = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
var model = ProblemNoticeService.GetProblemNoticeById(ProNoticeId);
|
|||
|
var approvelist = ProblemNoticeApprove.GetProblem_NoticeApproveByParentId(ProNoticeId+"reply");
|
|||
|
var thisApprovemodel = approvelist?.Where(x => x.ApproveMan == this.CurrUser.UserId).FirstOrDefault();
|
|||
|
if (model.State == "0" && (model.CreateUser == this.CurrUser.UserId || this.CurrUser.UserId == Const.hfnbdId || this.CurrUser.UserId == Const.sysglyId))
|
|||
|
{
|
|||
|
Form_Approve.Hidden = true;
|
|||
|
|
|||
|
}
|
|||
|
else if (model.State == "2" && thisApprovemodel != null)
|
|||
|
{
|
|||
|
|
|||
|
btnSave.Hidden = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Form_Approve.Hidden = true;
|
|||
|
btnSave.Hidden = true;
|
|||
|
btnSubmit.Hidden = true;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#region datable转换list
|
|||
|
public class ProblemNoticeItems
|
|||
|
{
|
|||
|
public string ProNoticeCId { get; set; }
|
|||
|
public string QueDescribe { get; set; }
|
|||
|
public string Requirements { get; set; }
|
|||
|
public string QueTypeName { get; set; }
|
|||
|
public string RiskLevelName { get; set; }
|
|||
|
public DateTime? CheckDatetime { get; set; }
|
|||
|
public string ReDay { get; set; }
|
|||
|
|
|||
|
public int SortIndex { get; set; }
|
|||
|
}
|
|||
|
public List<T> GetList<T>(DataTable table)
|
|||
|
{
|
|||
|
List<T> list = new List<T>();
|
|||
|
T t = default(T);
|
|||
|
PropertyInfo[] propertypes = null;
|
|||
|
string tempName = string.Empty;
|
|||
|
foreach (DataRow row in table.Rows)
|
|||
|
{
|
|||
|
t = Activator.CreateInstance<T>();
|
|||
|
propertypes = t.GetType().GetProperties();
|
|||
|
foreach (PropertyInfo pro in propertypes)
|
|||
|
{
|
|||
|
tempName = pro.Name;
|
|||
|
if (table.Columns.Contains(tempName))
|
|||
|
{
|
|||
|
object value = row[tempName];
|
|||
|
if (!value.ToString().Equals(""))
|
|||
|
{
|
|||
|
pro.SetValue(t, value, null);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
list.Add(t);
|
|||
|
}
|
|||
|
return list.Count == 0 ? null : list;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region 检查项
|
|||
|
|
|||
|
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
|||
|
{
|
|||
|
string itemId = Grid1.DataKeys[e.RowIndex][0].ToString();
|
|||
|
|
|||
|
if (e.CommandName == "attchUrlSee")
|
|||
|
{
|
|||
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Problem&menuId={1}&type=-1", itemId, BLL.Const.ProblemNoticeManagerMenuId)));
|
|||
|
}
|
|||
|
else if (e.CommandName == "attchUrl")
|
|||
|
{
|
|||
|
if (Types == "1")
|
|||
|
{
|
|||
|
//整改后照片编辑
|
|||
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Problem&menuId={1}&type=-1", itemId + "ZGH", BLL.Const.ProblemNoticeManagerMenuId)));
|
|||
|
}
|
|||
|
else {
|
|||
|
//整改后照片编辑
|
|||
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Problem&menuId={1}&type=0", itemId + "ZGH", BLL.Const.ProblemNoticeManagerMenuId)));
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 保存
|
|||
|
/// <summary>
|
|||
|
/// 保存
|
|||
|
/// </summary>
|
|||
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.SaveData(Const.BtnSave);
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 提交
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnSubmit_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.SaveData(Const.BtnSubmit);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 保存提交方法
|
|||
|
/// </summary>
|
|||
|
/// <param name="type"></param>
|
|||
|
private void SaveData(string type)
|
|||
|
{
|
|||
|
// 取出对应的数据库实体对象
|
|||
|
var newModel = Funs.DB.Problem_Notice.FirstOrDefault(x => x.ProNoticeId == ProNoticeId);
|
|||
|
|
|||
|
// 如果实体对象为空,说明数据有误
|
|||
|
if (newModel == null)
|
|||
|
{
|
|||
|
ShowNotify("数据有误,请刷新页面", MessageBoxIcon.Error);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
this.SaveDetail();
|
|||
|
|
|||
|
if (type == Const.BtnSubmit)
|
|||
|
{
|
|||
|
ProblemNoticeService.ReplyApprove(ProNoticeId, this.CurrUser.UserId, Boolean.Parse(rblIsAgree.SelectedValue), txtApproveIdea.Text);
|
|||
|
BLL.LogService.AddSys_Log(this.CurrUser, newModel.ProCode, newModel.ProNoticeId, BLL.Const.ProblemReplyManagerMenuId, BLL.Const.BtnModify);
|
|||
|
ShowNotify("回复成功。", MessageBoxIcon.Success);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ShowNotify("保存成功。", MessageBoxIcon.Success);
|
|||
|
}
|
|||
|
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 保存明细项
|
|||
|
/// </summary>
|
|||
|
private void SaveDetail()
|
|||
|
{
|
|||
|
JArray teamGroupData = Grid1.GetMergedData();
|
|||
|
foreach (JObject teamGroupRow in teamGroupData)
|
|||
|
{
|
|||
|
JObject values = teamGroupRow.Value<JObject>("values");
|
|||
|
int rowIndex = teamGroupRow.Value<int>("index");
|
|||
|
Model.Problem_Notice_C newDetail = new Model.Problem_Notice_C
|
|||
|
{
|
|||
|
//整改情况
|
|||
|
ReSituation = values.Value<string>("ReSituation"),
|
|||
|
ReSituationTime = DateTime.Now
|
|||
|
};
|
|||
|
if (Grid1.Rows[rowIndex].DataKeys.Length > 0)
|
|||
|
{
|
|||
|
newDetail.ProNoticeCId = Grid1.Rows[rowIndex].DataKeys[0].ToString();
|
|||
|
}
|
|||
|
//循环修改明细
|
|||
|
BLL.ProblemNoticeService.UpdateDetail(newDetail);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|