示例#1
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);
            }
        }
示例#2
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";
            }
        }