Ejemplo n.º 1
0
        public BaseDataUser SetUserProjectRole(BaseDataUser user, string pmsId)
        {
            try
            {
                PmsHeadBiz      pmsBO      = new PmsHeadBiz();
                IList <PmsHead> pmsDTOList = pmsBO.SelectPmsHeadByPmsId(pmsId);
                PmsHead         pmsDTO;
                if (pmsDTOList != null && pmsDTOList.Count > 0)
                {
                    pmsDTO = pmsDTOList[0];
                }
                else
                {
                    return(user);
                }

                if (pmsDTO.Pm.ToUpper().Contains(user.LoginName.ToUpper()))
                {
                    user.IsProjectPM = true;
                }

                if (pmsDTO.Qa.ToUpper().Contains(user.LoginName.ToUpper()))
                {
                    user.IsProjectQA = true;
                }

                if (pmsDTO.Sd.ToUpper().Contains(user.LoginName.ToUpper()))
                {
                    user.IsProjectSD = true;
                }
                if (pmsDTO.Se.ToUpper().Contains(user.LoginName.ToUpper()))
                {
                    user.IsProjectSE = true;
                }

                return(user);
            }
            catch (Exception ex)
            {
                m_Logger.Error("BaseDataUserBiz/SetUserProjectRole:" + ex.ToString());
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public bool GetNewPmsIdTempCrId(out DateTime creatDateTime, out string newPmsId, out string newTempCrId)
        {
            creatDateTime = PmsSysBiz.GetDBDateTime();
            string creatDate = FormatDate(creatDateTime, "yyyyMMdd");

            //获取PmsId
            string          pmsIdPart        = "PMS" + creatDate;
            PmsHeadBiz      pmsHeadBiz       = new PmsHeadBiz();
            IList <PmsHead> pmsHeadListPmsId = pmsHeadBiz.SelectPmsHeadByPmsId(pmsIdPart);

            // pmsIdListCount = pmsHeadListPmsId.Count;
            if (pmsHeadListPmsId != null && pmsHeadListPmsId.Count > 0)
            {
                //目前不考虑“9999”的情况
                //取最大的记录加1
                int maxPmsIdNum = int.Parse(pmsHeadListPmsId[pmsHeadListPmsId.Count - 1].PmsId.Substring(11, 4));
                int tempPmsIdNum;
                for (int i = 0; i < pmsHeadListPmsId.Count; i++)
                {
                    tempPmsIdNum = int.Parse(pmsHeadListPmsId[i].PmsId.Substring(11, 4));
                    if (maxPmsIdNum < tempPmsIdNum)
                    {
                        maxPmsIdNum = tempPmsIdNum;
                    }
                }
                maxPmsIdNum = maxPmsIdNum + 1;

                string pmsIdNum = maxPmsIdNum.ToString();

                //不足四位补“0”
                while (pmsIdNum.Length < 4)
                {
                    pmsIdNum = "0" + pmsIdNum;
                }
                ////不足四位补“0”
                //do
                //{
                //    pmsIdNum = "0" + pmsIdNum;

                //} while (pmsIdNum.Length < 4);

                newPmsId = pmsIdPart + pmsIdNum;
            }
            else
            {
                newPmsId = pmsIdPart + "0001";
            }

            //获取CrId
            string tempCrIdPart = "T" + creatDate;
            //IList<PmsHead> pmsHeadListCrId = pmsHeadBiz.SelectPmsHeadByTempCrIdPart(tempCrIdPart);
            IList <PmsItarmMapping> pmsItarmMappingList = new PmsItarmMappingBiz().SelectPmsItarmMappingByTempCrIdPart(tempCrIdPart);

            if (pmsItarmMappingList != null && pmsItarmMappingList.Count > 0)
            {
                //目前不考虑“9999”的情况
                //取最大的记录加1
                int maxCrIdNum = int.Parse(pmsItarmMappingList[pmsItarmMappingList.Count - 1].CrId.Substring(9, 4));
                int tempCrIdNum;
                for (int j = 0; j < pmsItarmMappingList.Count; j++)
                {
                    tempCrIdNum = int.Parse(pmsItarmMappingList[j].CrId.Substring(9, 4));
                    if (maxCrIdNum < tempCrIdNum)
                    {
                        maxCrIdNum = tempCrIdNum;
                    }
                }
                maxCrIdNum = maxCrIdNum + 1;

                string crIdNum = maxCrIdNum.ToString();

                //不足四位补“0”
                while (crIdNum.Length < 4)
                {
                    crIdNum = "0" + crIdNum;
                }
                //do
                //{
                //    crIdNum = "0" + crIdNum;

                //} while (crIdNum.Length < 4);
                newTempCrId = tempCrIdPart + crIdNum;
            }
            else
            {
                newTempCrId = tempCrIdPart + "0001";
            }

            return(true);
        }
Ejemplo n.º 3
0
        public bool Save(PmsHead pmsHead, string oldCrId, string newCrId, string loginName, string oldType, string newType)
        {
            try
            {
                m_PMSSqlConnection.BeginTransaction();

                // add by Ename Wang on 20120321
                #region 更新pms_flow表
                PmsFlow                 pmsFlow             = new PmsFlow();
                PmsFlowTemplateBiz      pmsFlowTemplateBiz  = new PmsFlowTemplateBiz();
                IList <PmsFlowTemplate> pmsFlowTemplateList = pmsFlowTemplateBiz.SelectPmsFlowTemplateByTypeId(newType);
                pmsFlow.FlowId     = pmsFlowTemplateList[0].FlowId;
                pmsFlow.PmsId      = pmsHead.PmsId;
                pmsFlow.Creator    = loginName;
                pmsFlow.CreateDate = System.DateTime.Now;
                if (!UpdatePmsFlow(pmsFlow))
                {
                    m_PMSSqlConnection.RollBackTransaction();
                    return(false);
                }
                #endregion
                // end add

                // add by Ename Wang on 20120531 fix change CR to Small CR stage Bug
                IList <int> StageIds = new List <int>();
                bool        IsExist  = true;
                foreach (PmsFlowTemplate pmsFlowTemplate in pmsFlowTemplateList)
                {
                    StageIds.Add(pmsFlowTemplate.Stageid);
                }
                if (StageIds != null)
                {
                    IsExist = StageIds.Contains(pmsHead.Stage);
                }
                if (IsExist == false)
                {
                    switch (pmsHead.Stage)
                    {
                    case (int)PmsCommonEnum.ProjectStage.PIS_STP:
                        pmsHead.Stage = (int)PmsCommonEnum.ProjectStage.Develop_Test;
                        break;

                    default:
                        break;
                    }
                }
                // end add

                if (!UpdatePmsHeadForOK(pmsHead))
                {
                    m_PMSSqlConnection.RollBackTransaction();
                    return(false);
                }

                if (newType != oldType)
                {
                    if (!new SdpDetailBiz().InsertSdpDetailByTemplateOnTypeChange(pmsHead.PmsId, oldType, newType))
                    {
                        m_PMSSqlConnection.RollBackTransaction();
                        return(false);
                    }
                }

                if (oldCrId != newCrId)
                {
                    //更新itarm_cr_list(删除旧的CRID,更新新的CRID)
                    if (!DeleteItarmCrListAndCo(oldCrId))
                    {
                        m_PMSSqlConnection.RollBackTransaction();
                        return(false);
                    }

                    PmsItarmMappingBiz      pmsItarmMappingBiz    = new PmsItarmMappingBiz();
                    IList <PmsItarmMapping> pmsItarmMappingChange = pmsItarmMappingBiz.SelectPmsItarmMapping(newCrId, null);
                    string changeContent = pmsItarmMappingChange.Aggregate("The following data is deleted:", (current, m) => current + m.CrId + ":" + m.PmsId + ".");

                    // 已经存在SD的CR不能删除
                    if (pmsItarmMappingChange != null)
                    {
                        if (pmsItarmMappingChange.FirstOrDefault() != null)
                        {
                            string          pmsId       = pmsItarmMappingChange.FirstOrDefault().PmsId;
                            PmsHeadBiz      pmsHeadBiz  = new PmsHeadBiz();
                            IList <PmsHead> ListPmsHead = pmsHeadBiz.SelectPmsHeadByPmsId(pmsId);
                            if (ListPmsHead != null)
                            {
                                if (ListPmsHead.FirstOrDefault() != null)
                                {
                                    if (ListPmsHead.FirstOrDefault().Sd == string.Empty)
                                    {
                                        if (!pmsItarmMappingBiz.DeletePmsItarmMappingCrId(newCrId))
                                        {
                                            m_PMSSqlConnection.RollBackTransaction();
                                            return(false);
                                        }
                                    }
                                }
                            }
                        }
                    }

                    if (!pmsItarmMappingBiz.UpdatePmsItarmMappingCrId(oldCrId, newCrId))
                    {
                        m_PMSSqlConnection.RollBackTransaction();
                        return(false);
                    }

                    //New CR 是ITARM创建的,它的SDP应及时删掉,防止和老CR的SDP重复
                    if (!new SdpDetailBiz().DeleteSDPForCRNoChange(newCrId))
                    {
                        m_PMSSqlConnection.RollBackTransaction();
                        return(false);
                    }

                    //更新bugfree数据库中的表。账号权限不足,执行报错
                    //if (!UpdateBugfree(oldCrId, newCrId))
                    //{
                    //    m_PMSSqlConnection.RollBackTransaction();
                    //    return false;
                    //}

                    PmsChangeHistory pmsChangeHistory = new PmsChangeHistory();
                    pmsChangeHistory.PmsId         = pmsHead.PmsId;
                    pmsChangeHistory.Action        = "Delete and Update CrId";
                    pmsChangeHistory.ChangeContent = changeContent + " CrId is changed from '" + oldCrId + "' to '" + newCrId + "'";
                    pmsChangeHistory.Creator       = loginName;
                    pmsChangeHistory.CreateDate    = PmsSysBiz.GetDBDateTime();
                    new PmsChangeHistoryBiz().InsertPmsChangeHistory(pmsChangeHistory);
                }

                //更新pms_system_version
                #region 更新系统版本表
                //TODO: oldType,newType为Service的情况。

                if (oldType != PmsCommonEnum.ProjectTypeFlowId.Service.GetDescription())
                {
                    bool upVerResult =
                        new PmsCRCreatBiz().UpdateSysVersion(pmsHead.Domain, pmsHead.System, pmsHead.Site, pmsHead.NewVersion);

                    if (!upVerResult)
                    {
                        m_PMSSqlConnection.RollBackTransaction();
                        return(false);
                    }
                }
                #endregion



                m_PMSSqlConnection.CommitTransaction();
                return(true);
            }
            catch (Exception ex)
            {
                m_PMSSqlConnection.RollBackTransaction();
                m_Logger.Error("BasicInformationDetailBiz/Save" + ex.Message.ToString());
                return(false);
            }
        }