244 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			244 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			C#
		
	
	
	
| using BLL;
 | |
| using Model;
 | |
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Data;
 | |
| using System.Data.SqlClient;
 | |
| using System.Linq;
 | |
| using System.Web;
 | |
| using System.Web.UI;
 | |
| using System.Web.UI.WebControls;
 | |
| 
 | |
| namespace FineUIPro.Web.TestRun.BeforeTestRun
 | |
| {
 | |
|     public partial class FourDecisionResponsibilityConfirmEdit : PageBase
 | |
|     {
 | |
|         /// <summary>
 | |
|         /// 主键
 | |
|         /// </summary>
 | |
|         public string DecisionId
 | |
|         {
 | |
|             get { return (string)ViewState["DecisionId"]; }
 | |
|             set { ViewState["DecisionId"] = value; }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 是否查看
 | |
|         /// </summary>
 | |
|         public bool IsView
 | |
|         {
 | |
|             get { return (bool)ViewState["IsView"]; }
 | |
|             set { ViewState["IsView"] = value; }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 问题图片是否可编辑
 | |
|         /// </summary>
 | |
|         public int QuestionEditImg
 | |
|         {
 | |
|             get { return (int)ViewState["QuestionEditImg"]; }
 | |
|             set { ViewState["QuestionEditImg"] = value; }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 整改图片是否可编辑
 | |
|         /// </summary>
 | |
|         public int RectifyEditImg
 | |
|         {
 | |
|             get { return (int)ViewState["RectifyEditImg"]; }
 | |
|             set { ViewState["RectifyEditImg"] = value; }
 | |
|         }
 | |
| 
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             this.DecisionId = Request["DecisionId"];
 | |
|             //是否查看
 | |
|             this.IsView = string.IsNullOrWhiteSpace(Request["IsView"]) ? false : bool.Parse(Request["IsView"]);
 | |
|             //数据绑定
 | |
|             PageInit();
 | |
|             //提出人处理
 | |
|             gvDataBrid();
 | |
|             //判断是否查看
 | |
|             if (IsView)
 | |
|             {
 | |
|                 btnReturn.Hidden = true;
 | |
|                 btnPass.Hidden = true;
 | |
|                 QuestionEditImg = -1;
 | |
|                 RectifyEditImg = -1;
 | |
|                 lblResponsibilityUnit.Enabled = false;
 | |
|                 lblQuestionDesc.Enabled = false;
 | |
|                 lblRestrictCondition.Enabled = false;
 | |
|                 lblLevel.Enabled = false;
 | |
|                 lblSpeciality.Enabled = false;
 | |
|                 lblAskDestructionTime.Enabled = false;
 | |
|                 lblRealityDestructionTime.Enabled = false;
 | |
|                 lblResponsibilityUser.Enabled = false;
 | |
|                 lblProposeUser.Enabled = false;
 | |
|                 lblGeneraUser.Enabled = false;
 | |
|                 lblSupervisionUser.Enabled = false;
 | |
|                 lblOwnerUser.Enabled = false;
 | |
|                 lblDecisionIsClose.Enabled = false;
 | |
|                 txtConfirmDesc.Enabled = false;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 默认绑定
 | |
|         /// </summary>
 | |
|         public void PageInit()
 | |
|         {
 | |
|             QuestionEditImg = -1;
 | |
|             RectifyEditImg = 0;
 | |
|             var query = from a in Funs.DB.PreRun_SubThreeChecksFourDecision
 | |
|                         join b in Funs.DB.Base_Project on a.ProjectId equals b.ProjectId
 | |
|                         join c in Funs.DB.Base_Unit on a.ResponsibilityUnit equals c.UnitId
 | |
|                         join d in Funs.DB.Sys_User on a.ResponsibilityUser equals d.UserId
 | |
|                         join e in Funs.DB.Sys_User on a.ProposeUser equals e.UserId
 | |
|                         join f in Funs.DB.Sys_User on a.GeneraUser equals f.UserId
 | |
|                         join g in Funs.DB.Sys_User on a.SupervisionUser equals g.UserId
 | |
|                         join h in Funs.DB.Sys_User on a.OwnerUser equals h.UserId
 | |
|                         where a.DecisionId == this.DecisionId
 | |
|                         select new
 | |
|                         {
 | |
|                             a.DecisionId,
 | |
|                             a.ProjectId,
 | |
|                             b.ProjectName,
 | |
|                             a.ResponsibilityUnit,
 | |
|                             ResponsibilityUnitName = c.UnitName,
 | |
|                             a.ResponsibilityUser,
 | |
|                             ResponsibilityUserName = d.UserName,
 | |
|                             a.ProposeUser,
 | |
|                             ProposeUserName = e.UserName,
 | |
|                             a.GeneraUser,
 | |
|                             GeneraUserName = f.UserName,
 | |
|                             a.SupervisionUser,
 | |
|                             SupervisionUserName = g.UserName,
 | |
|                             a.OwnerUser,
 | |
|                             OwnerUserName = h.UserName,
 | |
|                             a.QuestionDesc,
 | |
|                             a.Level,
 | |
|                             a.Speciality,
 | |
|                             a.AskDestructionTime,
 | |
|                             a.RealityDestructionTime,
 | |
|                             a.RestrictCondition,
 | |
|                             a.DecisionIsClose,
 | |
|                             DecisionIsCloseName = a.DecisionIsClose == 1 ? "已关闭" : "未关闭"
 | |
|                         };
 | |
|             var model = query.FirstOrDefault();
 | |
|             if (model != null)
 | |
|             {
 | |
|                 lblProjectName.Text = model.ProjectName;
 | |
|                 lblResponsibilityUnit.Text = model.ResponsibilityUnitName;
 | |
|                 lblQuestionDesc.Text = model.QuestionDesc;
 | |
|                 lblRestrictCondition.Text = model.RestrictCondition;
 | |
|                 lblLevel.Text = model.Level;
 | |
|                 lblSpeciality.Text = model.Speciality;
 | |
|                 lblAskDestructionTime.Text = model.AskDestructionTime.Value != null ? model.AskDestructionTime.Value.ToString("yyyy-MM-dd") : string.Empty;
 | |
|                 lblRealityDestructionTime.Text = model.RealityDestructionTime != null ? model.RealityDestructionTime.Value.ToString("yyyy-MM-dd") : string.Empty;
 | |
|                 lblResponsibilityUser.Text = model.ResponsibilityUserName;
 | |
|                 lblProposeUser.Text = model.ProposeUserName;
 | |
|                 lblGeneraUser.Text = model.GeneraUserName;
 | |
|                 lblSupervisionUser.Text = model.SupervisionUserName;
 | |
|                 lblOwnerUser.Text = model.OwnerUserName;
 | |
|                 lblDecisionIsClose.Text = model.DecisionIsCloseName;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 提出人处理
 | |
|         /// </summary>
 | |
|         public void gvDataBrid()
 | |
|         {
 | |
|             string strSql = @"select a.ConfirmId,a.ProjectId,a.DecisionId,a.ConfirmDesc,a.ConfirmTime,a.ConfirmUser,b.UserName as ConfirmUserName,a.ConfirmType,(case a.ConfirmType when 1 then '提出人处理' when 2 then '责任人确认' when 3 then '提出人确认' when 4 then '总包确认' when 5 then '监理确认' when 6 then '业主确认' else '' end) as ConfirmTypeName,a.ConfirmState,(case a.ConfirmState when 1 then '处理通过' when 2 then '处理退回' else '' end) as ConfirmStateName,a.AddUser,a.AddTime from PreRun_DecisionConfirmRecords as a left join Sys_User as b on a.ConfirmUser=b.UserId where a.ProjectId=@ProjectId and a.DecisionId=@DecisionId and a.ConfirmType=1";
 | |
|             List<SqlParameter> listStr = new List<SqlParameter>();
 | |
|             listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
 | |
|             listStr.Add(new SqlParameter("@DecisionId", this.DecisionId));
 | |
|             strSql += " order by a.AddTime asc";
 | |
|             SqlParameter[] parameter = listStr.ToArray();
 | |
|             DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
 | |
|             gvTcrcl.DataSource = tb;
 | |
|             gvTcrcl.DataBind();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 问题图片查看
 | |
|         /// </summary>
 | |
|         protected void imgBtnQuestionFile_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/CheckControl&menuId={2}", QuestionEditImg, this.DecisionId + "q", Const.InspectTailTerm)));
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 整改图片上传
 | |
|         /// </summary>
 | |
|         protected void imgBtnRectifyFile_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/CheckControl&menuId={2}", RectifyEditImg, this.DecisionId + "h", Const.InspectTailTerm)));
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 退回
 | |
|         /// </summary>
 | |
|         protected void btnReturn_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             var decisionModel = Funs.DB.PreRun_SubThreeChecksFourDecision.FirstOrDefault(x => x.DecisionId == this.DecisionId);
 | |
|             if (decisionModel != null)
 | |
|             {
 | |
|                 decisionModel.ResponsibilityConfirm = 1;
 | |
|                 decisionModel.ResponsibilityProposeSatate = 4;
 | |
|                 var model = new PreRun_DecisionConfirmRecords();
 | |
|                 model.ConfirmId = Guid.NewGuid().ToString();
 | |
|                 model.ProjectId = this.CurrUser.LoginProjectId;
 | |
|                 model.DecisionId = this.DecisionId;
 | |
|                 model.ConfirmDesc = txtConfirmDesc.Text;
 | |
|                 model.ConfirmTime = DateTime.Now;
 | |
|                 model.ConfirmUser = this.CurrUser.UserId;
 | |
|                 model.ConfirmType = 2;
 | |
|                 model.ConfirmState = 2;
 | |
|                 model.AddUser = this.CurrUser.UserId;
 | |
|                 model.AddTime = DateTime.Now;
 | |
|                 Funs.DB.PreRun_DecisionConfirmRecords.InsertOnSubmit(model);
 | |
|                 Funs.DB.SubmitChanges();
 | |
|                 ShowNotify("退回成功!", MessageBoxIcon.Success);
 | |
|                 PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 销项完成
 | |
|         /// </summary>
 | |
|         protected void btnPass_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             var decisionModel = Funs.DB.PreRun_SubThreeChecksFourDecision.FirstOrDefault(x => x.DecisionId == this.DecisionId);
 | |
|             if (decisionModel != null)
 | |
|             {
 | |
|                 decisionModel.ResponsibilityProposeSatate = 5;
 | |
|                 decisionModel.ResponsibilityConfirm = 2;
 | |
|                 decisionModel.ResponsibilityConfirmData = DateTime.Now;
 | |
|                 var model = new PreRun_DecisionConfirmRecords();
 | |
|                 model.ConfirmId = Guid.NewGuid().ToString();
 | |
|                 model.ProjectId = this.CurrUser.LoginProjectId;
 | |
|                 model.DecisionId = this.DecisionId;
 | |
|                 model.ConfirmDesc = txtConfirmDesc.Text;
 | |
|                 model.ConfirmTime = DateTime.Now;
 | |
|                 model.ConfirmUser = this.CurrUser.UserId;
 | |
|                 model.ConfirmType = 2;
 | |
|                 model.ConfirmState = 1;
 | |
|                 model.AddUser = this.CurrUser.UserId;
 | |
|                 model.AddTime = DateTime.Now;
 | |
|                 Funs.DB.PreRun_DecisionConfirmRecords.InsertOnSubmit(model);
 | |
|                 Funs.DB.SubmitChanges();
 | |
|                 ShowNotify("确认通过成功!", MessageBoxIcon.Success);
 | |
|                 PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 关闭
 | |
|         /// </summary>
 | |
|         protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
 | |
|         {
 | |
| 
 | |
|         }
 | |
|     }
 | |
| } |