SGGL_SHJ/SGGL/FineUIPro.Web/CQMS/Plan/SubPlanView.aspx.cs

148 lines
5.9 KiB
C#

using BLL;
using System;
using System.Collections.Generic;
namespace FineUIPro.Web.CQMS.Plan
{
public partial class SubPlanView : PageBase
{
public string SubPlanId
{
get
{
return (string)ViewState["SubPlanId"];
}
set
{
ViewState["SubPlanId"] = value;
}
}
protected void imgBtnFile_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/Solution&menuId={2}",
-1, SubPlanId, Const.SubPlanMenuId)));
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SubPlanId = Request.Params["SubPlanId"];
if (!string.IsNullOrWhiteSpace(SubPlanId))
{
txtProjectName.Text = ProjectService.GetProjectByProjectId(CurrUser.LoginProjectId).ProjectName;
Model.Plan_SubPlan SubPlan = CQMS_SubPlanService.GetSubPlanBySubPlanId(SubPlanId);
txtCode.Text = SubPlan.Code;
if (!string.IsNullOrEmpty(SubPlan.UnitId))
{
drpUnit.Text = UnitService.GetUnitNameByUnitId(SubPlan.UnitId);
}
if (SubPlan.CompileDate != null)
{
txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", SubPlan.CompileDate);
}
txtPlanName.Text = SubPlan.PlanName;
if (!string.IsNullOrWhiteSpace(SubPlan.UnitWorkIds))
{
txtUnitWork.Text = UnitWorkService.GetUnitWorkName(SubPlan.UnitWorkIds);
}
if (!string.IsNullOrWhiteSpace(SubPlan.CNProfessionalCodes))
{
txtCNProfessional.Text = CQMS_SubPlanService.GetProfessionalName(SubPlan.CNProfessionalCodes);
}
if (SubPlan.Edition != null)
{
txtEdition.Text = SubPlan.Edition.ToString();
}
bindApprove();
CQMS_SubPlanService.setRoleTree(trOne, this.CurrUser.LoginProjectId, "专业工程师", Const.ProjectUnitType_1, Const.ZBCNEngineer);
CQMS_SubPlanService.setRoleTree(trTwo, this.CurrUser.LoginProjectId, "质量组", Const.ProjectUnitType_1, Const.QAManager + "," + Const.CQEngineer);
CQMS_SubPlanService.setRoleTree(trFive, this.CurrUser.LoginProjectId, "施工经理", Const.ProjectUnitType_1, Const.ConstructionManager + "," + Const.ConstructionAssistantManager);
var zyUserIds = CQMS_SubPlanApproveService.GetUserIdsApprovesBySignType(SubPlanId, "ZY");
if (zyUserIds.Count > 0)
{
SetCheck(trOne, zyUserIds);
}
var zlUserIds = CQMS_SubPlanApproveService.GetUserIdsApprovesBySignType(SubPlanId, "ZL");
if (zlUserIds.Count > 0)
{
SetCheck(trTwo, zlUserIds);
}
var sgUserIds = CQMS_SubPlanApproveService.GetUserIdsApprovesBySignType(SubPlanId, "SG");
if (sgUserIds.Count > 0)
{
SetCheck(trFive, sgUserIds);
}
if (!string.IsNullOrEmpty(Request.Params["see"]))
{
Model.Plan_SubPlanApprove approve = BLL.CQMS_SubPlanApproveService.GetSee(SubPlanId, this.CurrUser.PersonId);
if (approve != null)
{
approve.ApproveDate = DateTime.Now;
BLL.CQMS_SubPlanApproveService.UpdateSubPlanApprove(approve);
}
}
}
}
}
#region
/// <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
/// <summary>
/// 审批列表
/// </summary>
private void bindApprove()
{
var list = CQMS_SubPlanApproveService.getListData(SubPlanId);
//var user = Person_PersonsService.GetAllUserList(CurrUser.LoginProjectId);
gvApprove.DataSource = list;
gvApprove.DataBind();
}
public string man(Object man)
{
string appman = string.Empty;
if (Person_PersonsService.GetPerson_PersonsById(man.ToString()) != null)
{
appman = Person_PersonsService.GetPersonsNameById(man.ToString());
}
return appman;
}
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/Solution&menuId={2}",
-1, fileId, Const.SubPlanMenuId)));
}
}
}