Esempio n. 1
0
        //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
        }
Esempio n. 2
0
        protected void ButtonSave_Click(object sender, EventArgs e)
        {
            try
            {
                //get creator,createDate,pmsID,crID
                string   creator = WSC.GlobalDefinition.Cookie_LoginUser.Replace(" ", ".");
                DateTime createDate;
                string   pmsID = string.Empty;
                string   crId  = string.Empty;
                m_PmsCRCreatBiz.GetNewPmsIdTempCrId(out createDate, out pmsID, out crId);

                //get pmsHead,pmsflow,sdpDetail,getPmsChangeHistory,getPmsItarmMapping,getPmsFlow,itarmCrList
                PmsHead              pmsHead          = getPmsHead(creator, createDate, pmsID);
                SdpDetail            sdpDetail        = getSdpDetail(pmsID);
                PmsChangeHistory     pmsChangeHistory = getPmsChangeHistory(creator, createDate, pmsID);
                PmsItarmMapping      pmsItarmMapping  = getPmsItarmMapping(creator, createDate, pmsID, crId);
                PmsFlow              pmsFlow          = getPmsFlow(creator, createDate, pmsID);
                ItarmCrList          itarmCrList      = getItarmCrList(creator, createDate, crId);
                IList <PmsDocuments> pmsDocuments     = getPmsDocuments(creator, createDate, pmsID, crId);
                if (pmsHead == null)
                {
                    Msgbox("Save failed");
                    return;
                }
                //Insert
                PmsHeadBiz pmsInsert = new PmsHeadBiz();
                string     errorInfo;
                int        insertResult = pmsInsert.InsertPmsHeadAndDoc(pmsHead, sdpDetail, pmsChangeHistory, pmsItarmMapping, pmsFlow, itarmCrList, pmsDocuments, out errorInfo);

                if (insertResult == 0)
                {
                    Msgbox(errorInfo);
                }
                else
                {
                    //将TempFile文件夹里的文件移动到UploadFile下以CRNO命名的文件夹里并删除Temp里的文件。
                    MoveUploadFileDeleteTempFile(crId);
                    LoginName.Replace(".", " ");
                    pmsHead.UserName = LoginName;
                    new MailBiz().SendCreateMail(pmsHead);

                    // 更新Stage 自动把这个Cr推进到AssginMember
                    int    oldStage  = (int)PmsCommonEnum.ProjectStage.PES;
                    int    newStage  = (int)PmsCommonEnum.ProjectStage.AssignMember;
                    string strAction = Enum.Parse(typeof(PmsCommonEnum.ProjectStage), oldStage.ToString()).GetDescription();
                    bool   blResult  = new BasicInformationDetailBiz().UpdateStages(pmsID, LoginName, oldStage, newStage, strAction);
                    if (!blResult)
                    {
                        Msgbox("更新stage数据失败!");
                        return;
                    }
                    new MailBiz().SendPromoteMail(pmsHead, newStage);
                    Msgbox("Create Successful!");
                    PageRegisterStartupScript("window.close();");
                }
            }
            catch (Exception exception)
            {
                throw new Exception(exception.ToString());
            }
        }