SGGL_SHJ/SGGL/FineUIPro.Web/HSSE/ActionPlan/ActionPlanListView.aspx.cs

187 lines
8.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Web;
using BLL;
using System.Linq;
namespace FineUIPro.Web.HSSE.ActionPlan
{
public partial class ActionPlanListView : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
public string ActionPlanListId
{
get
{
return (string)ViewState["ActionPlanListId"];
}
set
{
ViewState["ActionPlanListId"] = 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();
var q = (from x in Funs.DB.Person_Persons where x.UnitId == Const.UnitId_SEDIN && x.DepartId == Const.Depart_constructionId && x.RoleIds != null && x.RoleIds != Const.NoOfficeRole select x).ToList();
this.drpReviewMan.DataTextField = "PersonName";
this.drpReviewMan.DataValueField = "PersonId";
this.drpReviewMan.DataSource = q;
this.drpReviewMan.DataBind();
Funs.FineUIPleaseSelect(this.drpReviewMan);
CQMSConstructSolutionService.setRoleTree(trOne, this.CurrUser.LoginProjectId, "专业工程师", Const.ProjectUnitType_1, Const.ZBCNEngineer);
CQMSConstructSolutionService.setRoleTree(trTwo, this.CurrUser.LoginProjectId, "质量组", Const.ProjectUnitType_1, Const.QAManager + "," + Const.CQEngineer);
CQMSConstructSolutionService.setRoleTree(trThree, this.CurrUser.LoginProjectId, "HSE组", Const.ProjectUnitType_1, Const.HSSEManager + "," + Const.HSSEEngineer);
CQMSConstructSolutionService.setRoleTree(trFour, this.CurrUser.LoginProjectId, "控制组", Const.ProjectUnitType_1, Const.ControlManager + "," + Const.KZEngineer);
CQMSConstructSolutionService.setRoleTree(trFive, this.CurrUser.LoginProjectId, "施工经理", Const.ProjectUnitType_1, Const.ConstructionManager + "," + Const.ConstructionAssistantManager);
CQMSConstructSolutionService.setRoleTree(trSixe, this.CurrUser.LoginProjectId, "项目经理", Const.ProjectUnitType_1, Const.ProjectManager);
this.ActionPlanListId = Request.Params["ActionPlanListId"];
if (!string.IsNullOrEmpty(this.ActionPlanListId))
{
Model.ActionPlan_ActionPlanList actionPlanList = BLL.ActionPlanListService.GetActionPlanListById(this.ActionPlanListId);
if (actionPlanList != null)
{
///读取编号
this.txtActionPlanListCode.Text = actionPlanList.ActionPlanListCode;
this.txtActionPlanListName.Text = actionPlanList.ActionPlanListName;
this.txtVersionNo.Text = actionPlanList.VersionNo;
this.drpProjectType.SelectedValue = actionPlanList.ProjectType;
this.drpCompileMan.Text = BLL.Person_PersonsService.GetPersonsNameById(actionPlanList.CompileMan);
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", actionPlanList.CompileDate);
if (actionPlanList.IsReview == true)
{
this.rblIsReview.SelectedValue = "True";
this.drpReviewMan.Hidden = false;
this.drpReviewMan.SelectedValue = actionPlanList.ReviewMan;
}
else
{
this.rblIsReview.SelectedValue = "False";
}
var list = ActionPlanListApproveService.getListData(ActionPlanListId);
gvApprove.DataSource = list;
gvApprove.DataBind();
var zyUserIds = ActionPlanListApproveService.GetUserIdsApprovesBySignType(ActionPlanListId, "ZY");
if (zyUserIds.Count > 0)
{
SetCheck(trOne, zyUserIds);
}
var zlUserIds = ActionPlanListApproveService.GetUserIdsApprovesBySignType(ActionPlanListId, "ZL");
if (zlUserIds.Count > 0)
{
SetCheck(trTwo, zlUserIds);
}
var aqUserIds = ActionPlanListApproveService.GetUserIdsApprovesBySignType(ActionPlanListId, "AQ");
if (aqUserIds.Count > 0)
{
SetCheck(trThree, aqUserIds);
}
var kzUserIds = ActionPlanListApproveService.GetUserIdsApprovesBySignType(ActionPlanListId, "KZ");
if (kzUserIds.Count > 0)
{
SetCheck(trFour, kzUserIds);
}
var sgUserIds = ActionPlanListApproveService.GetUserIdsApprovesBySignType(ActionPlanListId, "SG");
if (sgUserIds.Count > 0)
{
SetCheck(trFive, sgUserIds);
}
var xmUserIds = ActionPlanListApproveService.GetUserIdsApprovesBySignType(ActionPlanListId, "XM");
if (xmUserIds.Count > 0)
{
SetCheck(trSixe, xmUserIds);
}
WindowAtt_Close(null, null);
}
}
}
}
public string man(Object man)
{
string appman = string.Empty;
if (Person_PersonsService.GetPerson_PersonsById(man.ToString()) != null)
{
appman = Person_PersonsService.GetPerson_PersonsById(man.ToString()).PersonName;
}
return appman;
}
/// <summary>
/// 设置树的节点选择
/// </summary>
/// <param name="nodes"></param>
/// <param name="role"></param>
private void SetCheck(Tree tree, List<string> userIds)
{
foreach (TreeNode tn in tree.Nodes[0].Nodes)
{
if (userIds.Contains(tn.NodeID))
{
tn.Checked = true;
}
}
}
#endregion
#region
/// <summary>
/// 上传附件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAttachUrl_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.ActionPlanListId))
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ActionPlanListAttachUrl&menuId={1}&type=-1", this.ActionPlanListId, BLL.Const.ProjectActionPlanListMenuId)));
}
}
#endregion
protected void gvApprove_RowCommand(object sender, GridCommandEventArgs e)
{
object[] keys = gvApprove.DataKeys[e.RowIndex];
string fileId = string.Empty;
if (keys == null)
{
return;
}
else
{
fileId = keys[0].ToString();
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/ActionPlanListAttachUrl&menuId={2}",
-1, fileId, Const.ProjectActionPlanListMenuId)));
}
protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
{
this.divC.InnerHtml = string.Empty;
var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.ActionPlanListId);
if (getAtt != null)
{
this.divC.InnerHtml = UploadAttachmentService.ShowAttachment("../../", getAtt.AttachUrl);
}
else
{
this.trAtt.Hidden = true;
}
}
}
}