コード例 #1
0
ファイル: ProjectProgress.ascx.cs プロジェクト: enamewang/pms
        private void GetStageNameList(int stage, string type, out IList <string> stageNameList, out bool isCurrentStageContains)
        {
            //获取当前的type类型对应的pmsFlow
            int intPending    = (int)PmsCommonEnum.ProjectStage.Pending;
            int intHardClosed = (int)PmsCommonEnum.ProjectStage.HardClosed;
            int intCancelled  = (int)PmsCommonEnum.ProjectStage.Cancelled;
            int intReactive   = (int)PmsCommonEnum.ProjectStage.Reactive;

            //注意要以order作为排序依据
            IList <int> stages = ProjectTypeStageList.Select(t => t)
                                 .Where(p => (p.Typeid == type &&
                                              p.Stageid != intPending &&
                                              p.Stageid != intHardClosed &&
                                              p.Stageid != intCancelled &&
                                              p.Stageid != intReactive))
                                 .OrderBy(m => m.Order)
                                 .Select(t => t.Stageid).Distinct().ToList();

            //判断是否包含当前的stage
            isCurrentStageContains = stages.Contains(stage);
            if (!isCurrentStageContains)
            {
                stages.Add(stage);
            }

            stageNameList = new List <string>();
            foreach (int i in stages)
            {
                string stageTemp = Enum.Parse(typeof(PmsCommonEnum.ProjectStage), i.ToString()).GetDescription();
                stageNameList.Add(stageTemp);
            }
        }
コード例 #2
0
ファイル: ProjectProgress.ascx.cs プロジェクト: enamewang/pms
        //Abel 注释掉 on 2014-01-22
        //private bool DevelopTestCheck(string type, out string message)
        //{
        //    message = "";
        //    try
        //    {
        //        IList<string> phaseList = m_ProjectProgressBiz.SelectSdpDetailTemplatePhase(type);

        //        foreach (string phase in phaseList)
        //        {
        //            int intPhase = int.Parse(phase.Trim());
        //            if (intPhase == (int)PmsCommonEnum.EnumSdpPhase.Design)
        //            {
        //                string designCompletedPercent = PageProjectsInformation.DesignCompletedPercent;
        //                if (designCompletedPercent != "100.0%")
        //                {
        //                    message = "Please finish the design phase of SDP!";
        //                    return false;
        //                }
        //            }

        //            if (intPhase == (int)PmsCommonEnum.EnumSdpPhase.Development)
        //            {
        //                string developmentCompletedPercent = PageProjectsInformation.DevelopmentCompletedPercent;
        //                if (developmentCompletedPercent != "100.0%")
        //                {
        //                    message = "Please finish the development phase of SDP!";
        //                    return false;
        //                }
        //            }

        //            if (intPhase == (int)PmsCommonEnum.EnumSdpPhase.Test && type != PmsCommonEnum.ProjectTypeFlowId.Service.GetDescription())
        //            {

        //                string testCompletedPercent = PageProjectsInformation.TestCompletedPercent;
        //                if (testCompletedPercent != "100.0%")
        //                {
        //                    message = "Please finish the test phase of SDP!";
        //                    return false;
        //                }
        //            }

        //        }

        //        return true;
        //    }
        //    catch (Exception)
        //    {
        //        return false;
        //    }
        //}
        #endregion

        protected void ImageButtonStage_Click(object sender, ImageClickEventArgs e)
        {
            #region 获取信息pmsHead
            //从数据库中获取最新数据
            PmsHead         pmsHead     = null;
            PmsHeadBiz      pmsHeadBiz  = new PmsHeadBiz();
            IList <PmsHead> pmsHeadList = pmsHeadBiz.SelectPmsHead(PmsID, null);
            if (pmsHeadList != null && pmsHeadList.Count > 0)
            {
                pmsHead = pmsHeadList[0];
            }
            else
            {
                Msgbox("无相关资料!");
                return;
            }
            #endregion

            #region 检查是否符合推进条件
            string message;
            if (!CheckPromote(pmsHead, out message))
            {
                Msgbox(message);
                return;
            }
            #endregion

            #region 更新数据库(推进成功)

            //获取当前的type类型对应的pmsFlow
            int         intPending    = (int)PmsCommonEnum.ProjectStage.Pending;
            int         intHardClosed = (int)PmsCommonEnum.ProjectStage.HardClosed;
            int         intCancelled  = (int)PmsCommonEnum.ProjectStage.Cancelled;
            int         intReactive   = (int)PmsCommonEnum.ProjectStage.Reactive;
            IList <int> stages        = ProjectTypeStageList.Select(t => t)
                                        .Where(p => (p.Typeid == ProjectType &&
                                                     p.Stageid != intPending &&
                                                     p.Stageid != intHardClosed &&
                                                     p.Stageid != intCancelled &&
                                                     p.Stageid != intReactive))
                                        .OrderBy(m => m.Order)
                                        .Select(t => t.Stageid)
                                        .ToList();

            int oldStage = Stage;
            int newStage = 0;

            for (int i = 0; i < stages.Count; i++)
            {
                if (oldStage == stages[i])
                {
                    newStage = stages[i + 1];
                }
            }

            string strAction = Enum.Parse(typeof(PmsCommonEnum.ProjectStage), oldStage.ToString()).GetDescription();

            #region  SDP confirm

            //Pm or Sd must confirm the SDP  Change only Sd confirm
            //if (IsPm(pmsHead.Pm, CurrentUser.LoginName) || IsSd(pmsHead.Sd, CurrentUser.LoginName))
            if (IsSd(pmsHead.Sd, CurrentUser.LoginName))
            {
                switch (pmsHead.Type)
                {
                case "CR":
                case "Study":
                case "Project":
                    if (strAction == PmsCommonEnum.ProjectStage.PIS_STP.GetDescription())
                    {
                        if (pmsHead.SDPConfirmDate.ToString("yyyy") == "0000" || pmsHead.SDPConfirmDate.ToString("yyyy") == "0001" ||
                            pmsHead.SDPConfirmDate.ToString("yyyy") == "1900")
                        {
                            Msgbox("Please Click SDP Confirm First");
                            return;
                        }
                    }
                    break;

                case "Small CR":

                    if (strAction == PmsCommonEnum.ProjectStage.Develop_Test.GetDescription())
                    {
                        if (pmsHead.SDPConfirmDate.ToString("yyyy") == "0000" || pmsHead.SDPConfirmDate.ToString("yyyy") == "0001" ||
                            pmsHead.SDPConfirmDate.ToString("yyyy") == "1900")
                        {
                            Msgbox("Please Click SDP Confirm First");
                            return;
                        }
                    }
                    break;

                default:
                    break;
                }
            }
            #endregion

            bool blResult = new BasicInformationDetailBiz().UpdateStages(PmsID, LoginName, oldStage, newStage, strAction);

            //从waitingclose到Close,需要更新Head页签closeday事件
            if (oldStage == (int)PmsCommonEnum.ProjectStage.WaitingClosed)
            {
                DateTime closeDate = PmsSysBiz.GetDBDateTime();

                pmsHeadBiz.UpdatePmsHeadCloseDate(PmsID, LoginName, closeDate);

                //修改BasicInformationDetail页面和Service页面上的close时间;
                PageProjectsInformation.CloseDate           = m_PmsCommonBiz.FormatDateTime(closeDate.ToString("yyyy-MM-dd").Trim());
                PageProjectsInformation.CloseDateForService = m_PmsCommonBiz.FormatDateTime(closeDate.ToString("yyyy-MM-dd").Trim());
            }


            if (!blResult)
            {
                Msgbox("更新stage数据失败!");
            }

            #endregion

            #region 重绘控件
            //如果推进到release 则点亮BasicInformationDetail.ascx
            if (newStage == (int)PmsCommonEnum.ProjectStage.Release)
            {
                PageProjectsInformation.SetReleaseButtonEnable();
            }

            Stage = newStage;
            InitPmsFlow(Stage, ProjectType);
            #endregion

            #region 发送相关的mail
            LoginName.Replace(".", " ");
            pmsHead.UserName = LoginName;
            new MailBiz().SendPromoteMail(pmsHead, newStage);
            #endregion
        }