Example #1
0
        /// <summary>
        /// 检查是否已上传stage必要的文档
        /// </summary>
        /// <param name="pmsId">当前的PmsId</param>
        /// <param name="stage">当前的项目进度Stage</param>
        /// <param name="message">记录用以返回的必要的提示信息</param>
        /// <returns>如果该Stage必要的所有文档都已上传,则返回true,否则返回false</returns>
        public bool CheckDocuments(PmsHead pmsHead, int stage, out string message)
        {
            message = string.Empty;

            // modified by Ename Wang on 20120209
            string                  pmsId = pmsHead.PmsId;
            PmsDocumentTypeBiz      pmsDocumentTypeBiz    = new PmsDocumentTypeBiz();
            IList <PmsDocumentType> pmsDocumentTypeIdName = pmsDocumentTypeBiz.SelectDistinctDocTypeIdName(pmsId, stage);

            //end modified

            //STP属于PIS|STP阶段的产出文档,当由Develop|Test Premote到下一个Stage时要做额外的check。
            //STC属于Develop|Test 阶段的产出文档,当由Develop|Test  Stage Premote到下一个Stage时要做额外的check。
            if (stage == (int)PmsCommonEnum.ProjectStage.Develop_Test)
            {
                if (pmsHead.NeedSTP == "Y")
                {
                    PmsDocumentType pmsDocumentTypeSTP = new PmsDocumentType();
                    pmsDocumentTypeSTP.TypeId   = (int)PmsCommonEnum.DocumentType.STP;
                    pmsDocumentTypeSTP.TypeName = PmsCommonEnum.DocumentType.STP.GetDescription();
                    pmsDocumentTypeIdName.Add(pmsDocumentTypeSTP);
                }

                if (pmsHead.NeedSTC == "Y")
                {
                    PmsDocumentType pmsDocumentTypeSTC = new PmsDocumentType();
                    pmsDocumentTypeSTC.TypeId   = (int)PmsCommonEnum.DocumentType.STC;
                    pmsDocumentTypeSTC.TypeName = PmsCommonEnum.DocumentType.STC.GetDescription();
                    pmsDocumentTypeIdName.Add(pmsDocumentTypeSTC);
                }
            }

            // add by Ename Wang on 20130308  在点Release or Partial Release的时候,如果开发计划工时>80H 就必须上传STP,STC
            if (stage == (int)PmsCommonEnum.ProjectStage.Release)
            {
                SdpDetailBiz sdpDetailBiz = new SdpDetailBiz();
                SdpDetail    sdpDetail    = new SdpDetail();
                sdpDetail.Pmsid = pmsHead.PmsId;
                sdpDetail.Phase = "5";
                IList <SdpDetail> sdpDetailList = sdpDetailBiz.SelectSdpDetail(sdpDetail);
                decimal           totalPlanCost = (decimal)sdpDetailList.Select(t => t.Plancost).Sum();
                if (totalPlanCost > 80)
                {
                    PmsDocumentType pmsDocumentTypeSTP = new PmsDocumentType();
                    pmsDocumentTypeSTP.TypeId   = (int)PmsCommonEnum.DocumentType.STP;
                    pmsDocumentTypeSTP.TypeName = PmsCommonEnum.DocumentType.STP.GetDescription();
                    pmsDocumentTypeIdName.Add(pmsDocumentTypeSTP);

                    PmsDocumentType pmsDocumentTypeSTC = new PmsDocumentType();
                    pmsDocumentTypeSTC.TypeId   = (int)PmsCommonEnum.DocumentType.STC;
                    pmsDocumentTypeSTC.TypeName = PmsCommonEnum.DocumentType.STC.GetDescription();
                    pmsDocumentTypeIdName.Add(pmsDocumentTypeSTC);
                }
            }
            // end add

            //TypeId为int型,所以需要不用加上‘’
            string docTypeId = pmsDocumentTypeIdName.Aggregate(string.Empty, (current, pmsDocumentType) => + pmsDocumentType.TypeId + "," + current);

            //如果docTypeId为空,则证明该stage不需要文档,因此返回true
            if (string.IsNullOrEmpty(docTypeId))
            {
                message = string.Empty;
                return(true);
            }

            //如果docTypeId不为空,则需要检查数据库中是否存在该stage必要上传的文件。
            docTypeId = docTypeId.Substring(0, docTypeId.Length - 1);
            PmsDocumentsBiz      pmsDocumentsBiz       = new PmsDocumentsBiz();
            IList <PmsDocuments> pmsDocumentsDocTypeId = pmsDocumentsBiz.SelectPmsDocumentsDocTypeId(pmsHead.PmsId, docTypeId);
            IList <int>          typeIdExist           = pmsDocumentsDocTypeId.Select(t => t.DocTypeId).ToList();
            // IList<int> typeIdExist = pmsDocumentsBiz.SelectPmsDocumentsDocTypeId(pmsId, docTypeId);
            bool          result = true;
            StringBuilder msg    = new StringBuilder();

            msg.Append("Please upload the necessary documents:");
            foreach (PmsDocumentType documentType in pmsDocumentTypeIdName)
            {
                if (!typeIdExist.Contains(documentType.TypeId))
                {
                    msg.Append(documentType.TypeName);
                    msg.Append(",");
                    result = false;
                }
            }
            if (!result)
            {
                message = msg.ToString();
                message = message.Substring(0, message.Length - 1) + "!";
            }

            return(result);
        }
        public void GetReleaseXml(string pmsId, string sdpUrl, out string releaseXml)
        {
            //<CR_ID/>                --HeadSerial                             H
            //<APPLY_SITE/>           --多个site,用单引号分?                  H
            //<PROJECT_NAME/>         --System Name                            H
            //<CREATOR/>              --�有QA传QA,没QA传SD,没SD传SE            D
            //<PROJECT_TYPE/>         --CR/Project/Bug/Services/Study        H
            //<DUE_DATE/>             --YYYYMMDD                               H
            //<PROJECT_STATUS/>       --正常/提前/Delay
            //<PM/>                   --多个人员以单引号分隔,例如: Jack.Huang,Coase.Tseng,Derek.Chang     H
            //<SD/>                   --同上                                   D
            //<SE/>                   --同上                                   D
            //<QA/>                   --同上                                   D
            //<SDP_FILE_NAME/>        --?
            //<SDP_URL/>
            //<CONTACT/>              --�传人名,例如:sammi.yao   (CREATOR  + 分机?)  H


            string roleQA    = "";
            string roleSD    = "";
            string roleSE    = "";
            string contactQA = "";
            string contactSD = "";
            string contactSE = "";
            // string sdp_url = string.Empty;
            StringBuilder xml        = new StringBuilder();
            PmsHeadBiz    pmsHeadBiz = new PmsHeadBiz();


            PmsHead pmsSdpHead = new PmsHead();

            pmsSdpHead.PmsId = pmsId;
            pmsSdpHead.Vid   = "PM";
            IList <PmsHead> pmsSdpHeadList = pmsHeadBiz.SelectPmsHeadOther(pmsSdpHead);

            xml.Append("<RLNS>");
            if (pmsSdpHeadList != null && pmsSdpHeadList.Count > 0)
            {
                string project_status = "";
                string strNowDate     = DateTime.Now.ToString("yyyyMMdd", System.Globalization.DateTimeFormatInfo.InvariantInfo);
                string due_date       = pmsSdpHeadList[0].DueDate.ToString("yyyyMMdd", System.Globalization.DateTimeFormatInfo.InvariantInfo);
                if (pmsSdpHeadList[0].DueDate == null)
                {
                    project_status = string.Empty;
                }
                else
                {
                    if (Convert.ToInt32(due_date) > Convert.ToInt32(strNowDate))
                    {
                        project_status = "提前";
                    }
                    else if (Convert.ToInt32(due_date) == Convert.ToInt32(strNowDate))
                    {
                        project_status = "正常";
                    }
                    else
                    {
                        project_status = "Delay";
                    }
                }
                //end added

                xml.Append("<CR_ID>").Append(pmsSdpHeadList[0].CrId.Trim()).Append("</CR_ID>");
                xml.Append("<APPLY_SITE>").Append(pmsSdpHeadList[0].Site.Trim()).Append("</APPLY_SITE>");
                xml.Append("<CR_NAME>").Append(pmsSdpHeadList[0].PmsName.Trim()).Append("</CR_NAME>");
                xml.Append("<TYPE>").Append(pmsSdpHeadList[0].Type.Trim()).Append("</TYPE>");
                xml.Append("<DUE_DATE>").Append((pmsSdpHeadList[0].DueDate == null) ? string.Empty : pmsSdpHeadList[0].DueDate.ToString("yyyyMMdd").Trim()).Append("</DUE_DATE>");

                xml.Append("<STATUS>").Append(project_status).Append("</STATUS>");

                xml.Append("<IMPACT>").Append((pmsSdpHeadList[0].Site == null) ? string.Empty : pmsSdpHeadList[0].Site.Trim()).Append("</IMPACT>");
                xml.Append("<PM>").Append(pmsSdpHeadList[0].Pm.Trim()).Append("</PM>");
                xml.Append("<SDP_FILE_NAME>SDP</SDP_FILE_NAME>");
                string systemName = pmsSdpHeadList[0].System.Trim();
                systemName = systemName.Contains("(") ? systemName.Substring(0, systemName.IndexOf("(")) : systemName;
                xml.Append("<SYSTEM>").Append(systemName).Append("</SYSTEM>");
                xml.Append("<OLD_VERSION>").Append((pmsSdpHeadList[0].OldVersion == null) ? string.Empty : pmsSdpHeadList[0].OldVersion.Trim()).Append("</OLD_VERSION>");
                xml.Append("<NEW_VERSION>").Append((pmsSdpHeadList[0].NewVersion == null) ? string.Empty : pmsSdpHeadList[0].NewVersion.Trim()).Append("</NEW_VERSION>");
                xml.Append("<SDP_URL>").Append(sdpUrl).Append("</SDP_URL>");


                #region 获取文档的相关信息
                PmsDocuments pmsDocuments = new PmsDocuments();
                pmsDocuments.PmsId = pmsId;
                IList <PmsDocuments> pmsDocumentsList = new PmsDocumentsBiz().SelectPmsDocuments(pmsDocuments);
                string pesFileName         = string.Empty;
                string pisFileName         = string.Empty;
                string stpFileName         = string.Empty;
                string stcFileName         = string.Empty;
                string rlnFileName         = string.Empty;
                string studyReportFileName = string.Empty;
                string otherFileName       = string.Empty;
                string pesMinFileName      = string.Empty;
                string pisMinFileName      = string.Empty;
                string stpMinFileName      = string.Empty;

                string pesUrl         = string.Empty;
                string pisUrl         = string.Empty;
                string stpUrl         = string.Empty;
                string stcUrl         = string.Empty;
                string rlnUrl         = string.Empty;
                string studyReportUrl = string.Empty;
                string otherUrl       = string.Empty;
                string pesMinUrl      = string.Empty;
                string pisMinUrl      = string.Empty;
                string stpMinUrl      = string.Empty;

                if (pmsDocumentsList != null && pmsDocumentsList.Count > 0)
                {
                    foreach (PmsDocuments d in pmsDocumentsList)
                    {
                        switch (d.DocTypeId)
                        {
                        case (int)PmsCommonEnum.DocumentType.PES:
                            pesFileName = d.FileName;
                            pesUrl      = d.Path;
                            break;

                        case (int)PmsCommonEnum.DocumentType.PIS:
                            pisFileName = d.FileName;
                            pisUrl      = d.Path;
                            break;

                        case (int)PmsCommonEnum.DocumentType.STP:
                            stpFileName = d.FileName;
                            stpUrl      = d.Path;
                            break;

                        case (int)PmsCommonEnum.DocumentType.STC:
                            stcFileName = d.FileName;
                            stcUrl      = d.Path;
                            break;

                        case (int)PmsCommonEnum.DocumentType.RLN:
                            rlnFileName = d.FileName;
                            rlnUrl      = d.Path;
                            break;

                        case (int)PmsCommonEnum.DocumentType.Study_Report:
                            studyReportFileName = d.FileName;
                            studyReportUrl      = d.Path;
                            break;

                        case (int)PmsCommonEnum.DocumentType.Other:
                            otherFileName = d.FileName;
                            otherUrl      = d.Path;
                            break;

                        case (int)PmsCommonEnum.DocumentType.PES_MIN:
                            pesMinFileName = d.FileName;
                            pesMinUrl      = d.Path;
                            break;

                        case (int)PmsCommonEnum.DocumentType.PIS_MIN:
                            pisMinFileName = d.FileName;
                            pisMinUrl      = d.Path;
                            break;

                        case (int)PmsCommonEnum.DocumentType.STP_MIN:
                            stpMinFileName = d.FileName;
                            stpMinUrl      = d.Path;
                            break;

                        default:
                            break;
                        }
                    }
                }

                xml.Append("<PES_FILE_NAME>").Append(pesFileName).Append("</PES_FILE_NAME>");
                xml.Append("<PES_URL>").Append(pesUrl).Append("</PES_URL>");

                xml.Append("<PIS_FILE_NAME>").Append(pisFileName).Append("</PIS_FILE_NAME>");
                xml.Append("<PIS_URL>").Append(pisUrl).Append("</PIS_URL>");

                xml.Append("<STP_FILE_NAME>").Append(stpFileName).Append("</STP_FILE_NAME>");
                xml.Append("<STP_URL>").Append(stpUrl).Append("</STP_URL>");

                xml.Append("<STC_FILE_NAME>").Append(stcFileName).Append("</STC_FILE_NAME>");
                xml.Append("<STC_URL>").Append(stcUrl).Append("</STC_URL>");

                xml.Append("<RLN_FILE_NAME>").Append(rlnFileName).Append("</RLN_FILE_NAME>");
                xml.Append("<RLN_URL>").Append(rlnUrl).Append("</RLN_URL>");

                xml.Append("<StudyReport_FILE_NAME>").Append(studyReportFileName).Append("</StudyReport_FILE_NAME>");
                xml.Append("<StudyReport_URL>").Append(studyReportUrl).Append("</StudyReport_URL>");

                xml.Append("<Other_FILE_NAME>").Append(otherFileName).Append("</Other_FILE_NAME>");
                xml.Append("<Other_URL>").Append(otherUrl).Append("</Other_URL>");

                xml.Append("<PES_MIN_FILE_NAME>").Append(pesMinFileName).Append("</PES_MIN_FILE_NAME>");
                xml.Append("<PES_MIN_URL>").Append(pesMinUrl).Append("</PES_MIN_URL>");

                xml.Append("<PIS_MIN_FILE_NAME>").Append(pisMinFileName).Append("</PIS_MIN_FILE_NAME>");
                xml.Append("<PIS_MIN_URL>").Append(pisMinUrl).Append("</PIS_MIN_URL>");

                xml.Append("<STP_MIN_FILE_NAME>").Append(stpMinFileName).Append("</STP_MIN_FILE_NAME>");
                xml.Append("<STP_MIN_URL>").Append(stpMinUrl).Append("</STP_MIN_URL>");

                #endregion


                BaseDataUserBiz baseDataUserBiz = new BaseDataUserBiz();
                //  BaseDataUser baseDataUser = new BaseDataUser();
                if (!string.IsNullOrEmpty(pmsSdpHeadList[0].Qa))
                {
                    roleQA = string.Concat(roleQA, ",", pmsSdpHeadList[0].Qa);
                    string[] qas = roleQA.Split(';');
                    foreach (string str in qas)
                    {
                        if (string.IsNullOrEmpty(str))
                        {
                            string ext = baseDataUserBiz.SelectBaseDataUser(str.Trim(), null)[0].Extention;
                            contactQA = string.Concat(contactQA, ",", str, " ", ext);
                        }
                    }
                }
                if (!string.IsNullOrEmpty(pmsSdpHeadList[0].Sd))
                {
                    roleSD = string.Concat(roleSD, ",", pmsSdpHeadList[0].Sd);
                    string[] sds = roleSD.Split(';');
                    foreach (string str in sds)
                    {
                        if (string.IsNullOrEmpty(str))
                        {
                            string ext = baseDataUserBiz.SelectBaseDataUser(str.Trim(), null)[0].Extention;
                            contactSD = string.Concat(contactSD, ",", str, " ", ext);
                        }
                    }
                }
                if (!string.IsNullOrEmpty(pmsSdpHeadList[0].Se))
                {
                    roleSE = string.Concat(roleSE, ",", pmsSdpHeadList[0].Se);
                    string[] ses = roleSE.Split(';');
                    foreach (string str in ses)
                    {
                        if (string.IsNullOrEmpty(str))
                        {
                            string ext = baseDataUserBiz.SelectBaseDataUser(str.Trim(), null)[0].Extention;
                            contactSE = string.Concat(contactSE, ",", str, " ", ext);
                        }
                    }
                }

                xml.Append("<SD>").Append((roleSD != "") ? roleSD.Substring(1) : string.Empty).Append("</SD>");
                xml.Append("<SE>").Append((roleSE != "") ? roleSE.Substring(1) : string.Empty).Append("</SE>");
                xml.Append("<QA>").Append((roleQA != "") ? roleQA.Substring(1) : string.Empty).Append("</QA>");
                if (roleSD != "" || roleSE != "" || roleQA != "")
                {
                    xml.Append("<CREATOR>").Append((roleQA.Length > 1) ? roleQA.Substring(1) : (roleSD.Length > 1) ? roleSD.Substring(1) : roleSE.Substring(1)).Append("</CREATOR>");
                }
                else
                {
                    xml.Append("<CREATOR>").Append(string.Empty).Append("</CREATOR>");
                }
            }
            xml.Append("</RLNS>");
            m_Logger.Error(xml);
            releaseXml = xml.ToString();
        }