private bool SetFlowEnable(int stageId) { bool flag = false; // string currentRole = string.Empty; // BaseDataUserBiz baseDataUserBiz = new BaseDataUserBiz(); // baseDataUserBiz.SelectBaseDataUser(LoginName, null)[0].Role; // string role = CurrentUser.Role; PmsCommonEnum.ProjectStage projectStage = (PmsCommonEnum.ProjectStage)System.Enum.Parse(typeof(PmsCommonEnum.ProjectStage), stageId.ToString()); switch (projectStage) { case PmsCommonEnum.ProjectStage.PES: if (CurrentUser.IsProjectPM || CurrentUser.IsOrgPMO) { flag = true; } break; case PmsCommonEnum.ProjectStage.AssignMember: if (CurrentUser.IsOrgPMO) { flag = true; } break; case PmsCommonEnum.ProjectStage.PIS_STP: if (CurrentUser.IsProjectSD) { flag = true; } break; case PmsCommonEnum.ProjectStage.Develop_Test: if (CurrentUser.IsProjectQA) { flag = true; } break; case PmsCommonEnum.ProjectStage.WaitingClosed: if (CurrentUser.IsProjectPM || CurrentUser.IsOrgPMO) { flag = true; } break; default: break; } return(flag); }
private void DrawControl(IList <string> stageNameList, int stage, bool isCurrentStageNormal) { TRFlow.Controls.Clear(); TRImage.Controls.Clear(); PmsCommonEnum.ProjectStage currentStage = (PmsCommonEnum.ProjectStage)System.Enum.Parse(typeof(PmsCommonEnum.ProjectStage), stage.ToString()); string currentStageName = currentStage.GetDescription(); //根据当前的stageNameList绘制控件 int count = 1; foreach (string stageName in stageNameList) { #region 绘制lable HtmlTableCell tc = new HtmlTableCell(); tc.Align = "center"; tc.NoWrap = true; Label lbl = new Label(); lbl.ID = "lbl" + stageName; if (count < stageNameList.Count) { lbl.Text = stageName + "-->"; } else { lbl.Text = stageName; } count++; tc.Controls.Add(lbl); TRFlow.Controls.Add(tc); #endregion #region 绘制TRImage if (currentStageName == stageName) { #region 绘制ImgButton HtmlTableCell tcimg = new HtmlTableCell(); tcimg.Align = "center"; // ImageButton img = new ImageButton(); //img.ID = "imgBtnPromote"; //如果isStageContains为true,则证明当前的stage是正常的stage, //否则则为其他异常的stage。 //SetFlowEnable(stage)检测当前用户是否具备点击按钮的资格。 if (isCurrentStageNormal && SetFlowEnable(stage)) { ImageButtonStage.ImageUrl = "~/SysFrame/images/right.JPG"; ImageButtonStage.Enabled = true; ImageButtonStageIsEnabled = true; // img.CommandArgument = stage.ToString(); //img.Attributes.Add("onclick", "CheckPromote();return false;"); // img.Click += new ImageClickEventHandler(Button_Click); //img.Attributes.Add("onclick", "Button_Click();return false;"); // img.Attributes.Add("OnClientClick", "ProjectProgressImg_OnClientClick();return false;"); // img.OnClientClick = "javascript:ProjectProgressImg_OnClientClick();return false;"; } else { ImageButtonStage.ImageUrl = "~/SysFrame/images/right2.JPG"; ImageButtonStage.Enabled = false; ImageButtonStageIsEnabled = false; } tcimg.Controls.Add(ImageButtonStage); TRImage.Controls.Add(tcimg); #endregion } else { #region 绘制一个普通的占位符 HtmlTableCell tcimg = new HtmlTableCell(); tcimg.Align = "center"; TRImage.Controls.Add(tcimg); #endregion } #endregion } }