public bool UpdateStages(string pmsId, string loginName, int oldStage, int newStage, string strAction)
        {
            DateTime dtCurDate = PmsSysBiz.GetDBDateTime();
            bool     blResult  = false;

            try
            {
                #region Update Stage
                PmsHead pmsHead = new PmsHead();
                pmsHead.PmsId         = pmsId;
                pmsHead.Stage         = newStage;
                pmsHead.MaintainDate  = dtCurDate;
                pmsHead.MaintainUser  = loginName;
                pmsHead.AbnormalStage = oldStage;
                #endregion

                #region Insert PMSChangeHistory
                PmsChangeHistory pmsChangeHistory = new PmsChangeHistory();
                pmsChangeHistory.PmsId         = pmsId;
                pmsChangeHistory.ChangeContent = "Stage,AbnormalStage";
                pmsChangeHistory.Action        = strAction;
                pmsChangeHistory.CreateDate    = dtCurDate;
                pmsChangeHistory.Creator       = loginName;
                #endregion

                PmsHeadBiz pmsHeadBiz = new PmsHeadBiz();
                blResult = pmsHeadBiz.UpdateStage(pmsHead, pmsChangeHistory);
            }
            catch
            {
                blResult = false;
            }

            return(blResult);
        }
Example #2
0
 public bool InsertPMSChangeHistory(string newCrId, string oldCrId, string currentUser, out string infor)
 {
     infor = string.Empty;
     try
     {
         Hashtable hashtable = new Hashtable();
         hashtable.Add("CrId", newCrId);
         IList <PmsItarmMapping> listPmsItarmMapping = m_PMSSqlConnection.QueryForList <PmsItarmMapping>("SelectPmsItarmMapping", hashtable);
         if (listPmsItarmMapping != null && listPmsItarmMapping.Count > 0 && listPmsItarmMapping.FirstOrDefault().PmsId != string.Empty)
         {
             PmsChangeHistory pmsChangeHistory = new PmsChangeHistory();
             pmsChangeHistory.PmsId         = listPmsItarmMapping.FirstOrDefault().PmsId;
             pmsChangeHistory.ChangeContent = "CR ID from" + " " + oldCrId + " " + newCrId;
             pmsChangeHistory.Action        = "CREATE";
             pmsChangeHistory.Creator       = currentUser;
             pmsChangeHistory.CreateDate    = PmsSysBiz.GetDBDateTime();
             m_PMSSqlConnection.Insert("InsertPmsChangeHistory", pmsChangeHistory);
             return(true);
         }
         infor = "InsertPMSChangeHistory failed!";
         return(false);
     }
     catch (Exception ex)
     {
         m_Logger.Error("CRNoUpdateBiz/UpDateCrIdPmsId:" + ex.Message.ToString());
         infor = "InsertPMSChangeHistory failed!";
         return(false);
     }
 }
Example #3
0
        public bool InsertCopyFromDevelopment(IList <SdpDetail> pmsSdpDetailIlist, string strPmsID, string strUser)
        {
            DateTime dateTime = PmsSysBiz.GetDBDateTime();

            PmsCommonBiz pmsCommonBiz = new PmsCommonBiz();

            try
            {
                m_PMSSqlConnection.BeginTransaction();

                for (int i = 0; i < pmsSdpDetailIlist.Count; i++)
                {
                    SdpDetail pmsSdpDetail = new SdpDetail();
                    pmsSdpDetail.Pmsid = strPmsID;

                    pmsSdpDetail.TaskName         = pmsSdpDetailIlist[i].TaskName;
                    pmsSdpDetail.Phase            = PmsCommonEnum.EnumSdpPhase.Test.ToString();
                    pmsSdpDetail.Role             = pmsSdpDetailIlist[i].Role;
                    pmsSdpDetail.Resource         = pmsSdpDetailIlist[i].Resource;
                    pmsSdpDetail.Taskno           = int.Parse(pmsSdpDetailIlist[i].Taskno.ToString());
                    pmsSdpDetail.Plancost         = double.Parse(pmsSdpDetailIlist[i].Plancost.ToString());
                    pmsSdpDetail.Actualcost       = double.Parse(pmsSdpDetailIlist[i].Actualcost.ToString());
                    pmsSdpDetail.Completedpercent = double.Parse(pmsSdpDetailIlist[i].Completedpercent.ToString());
                    pmsSdpDetail.Planstartday     = pmsSdpDetailIlist[i].Planstartday;
                    pmsSdpDetail.Planendday       = pmsSdpDetailIlist[i].Planendday;
                    pmsSdpDetail.Actualstartday   = pmsCommonBiz.ConvertDateTime("");
                    pmsSdpDetail.Actualendday     = pmsCommonBiz.ConvertDateTime("");
                    pmsSdpDetail.PretaskNo        = int.Parse(pmsSdpDetailIlist[i].PretaskNo.ToString());
                    pmsSdpDetail.Remark           = pmsSdpDetailIlist[i].Remark;
                    pmsSdpDetail.Iseditable       = "Y";
                    pmsSdpDetail.Deleteflag       = "N";
                    pmsSdpDetail.Createdate       = dateTime;
                    pmsSdpDetail.Createuser       = strUser;
                    pmsSdpDetail.Maintaindate     = dateTime;
                    pmsSdpDetail.Maintainuser     = strUser;

                    int insertResult = InsertSdpDetail(pmsSdpDetail);

                    if (insertResult <= 0)
                    {
                        m_PMSSqlConnection.RollBackTransaction();
                        return(false);
                    }
                }

                m_PMSSqlConnection.CommitTransaction();
                return(true);
            }
            catch (Exception ex)
            {
                m_PMSSqlConnection.RollBackTransaction();
                m_Logger.Error("SdpDetailBiz/InsertFromCopyFromDevelopment:" + ex.Message.ToString());
                return(false);
            }
        }
Example #4
0
        public void GetMinId(out string minId)
        {
            DateTime createDateTime = PmsSysBiz.GetDBDateTime();
            string   creatDate      = PmsCommonBiz.FormatDate(createDateTime, "yyyyMMdd");

            //获取minId
            string tempMinIdPart = "MN" + creatDate;

            IList <PmsMinHead> pmsMinHeadList = SelectPmsMinHeadByMinIdPart(tempMinIdPart);

            if (pmsMinHeadList != null && pmsMinHeadList.Count > 0)
            {
                //取最大的记录加1
                int maxCrIdNum = int.Parse(pmsMinHeadList[pmsMinHeadList.Count - 1].Mnid.Substring(9, 4));
                int tempCrIdNum;
                for (int j = 0; j < pmsMinHeadList.Count; j++)
                {
                    tempCrIdNum = int.Parse(pmsMinHeadList[j].Mnid.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);
                minId = tempMinIdPart + crIdNum;
            }
            else
            {
                minId = tempMinIdPart + "0001";
            }
        }
Example #5
0
        public bool UpdatePmsHeadCloseDate(string pmsId, string loginName, DateTime closeDate)
        {
            try
            {
                Hashtable hashtable = new Hashtable
                {
                    { "PmsId", pmsId },
                    { "MaintainUser", loginName },
                    { "CloseDate", closeDate },
                    { "MaintainDate", PmsSysBiz.GetDBDateTime() }
                };

                m_PMSSqlConnection.Update("UpdatePmsHeadCloseDate", hashtable);
                return(true);
            }
            catch (Exception ex)
            {
                m_Logger.Error("PmsHeadBiz/UpdateStage:" + ex.ToString());
                return(false);
            }
        }
Example #6
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);
        }
        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);
            }
        }