Example #1
0
        private void InitPage()
        {
            PmsId = Request.Params["PmsID"];
            string resource = Request.Params["resource"];

            Serials = Request.Params["serials"];
            //var url = "../Maintain/ModifyResource.aspx?PmsID=" + pmsId + "&serials="
            //    + serials + "&resource=" + resource + "&Radom=" + Math.random();
            IList <PmsHead> pmsHead    = new PmsHeadBiz().SelectPmsHeadByPmsId(PmsId);
            PmsHead         objPmsHead = new PmsHead();

            if (pmsHead != null && pmsHead.Count > 0)
            {
                objPmsHead = pmsHead[0];
            }
            else
            {
                Msgbox("Data Bind Error!");
                return;
            }
            Hashtable rTable = new Hashtable();

            rTable.Add("PM", objPmsHead.Pm);
            rTable.Add("SD", objPmsHead.Sd);
            rTable.Add("SE", objPmsHead.Se);
            rTable.Add("QA", objPmsHead.Qa);
            this.TextBoxOldResource.Text = resource.Trim();
            BindDropDownListNewResource(rTable);
        }
Example #2
0
        public string GetResourceList(string pmsid)
        {
            PmsHead         ObjPmsHead = new PmsHead();
            IList <PmsHead> pmsHead    = new PmsHeadBiz().SelectPmsHeadByPmsId(pmsid);

            if (pmsHead != null && pmsHead.Count > 0)
            {
                ObjPmsHead = pmsHead[0];
                Hashtable rTable = new Hashtable();
                rTable.Add("PM", ObjPmsHead.Pm);
                rTable.Add("SD", ObjPmsHead.Sd);
                rTable.Add("SE", ObjPmsHead.Se);
                rTable.Add("QA", ObjPmsHead.Qa);

                string resourceList = "";
                foreach (string str in rTable.Values)
                {
                    string[] sArray = str.Split(';');
                    foreach (string name in sArray)
                    {
                        if (!resourceList.Contains(name))
                        {
                            resourceList += name + ",";
                        }
                    }
                }
                return(resourceList);
            }
            else
            {
                return("");
            }
        }
Example #3
0
        public void InitGrid(object sender, EventArgs e)
        {
            try
            {
                PmsHead pmsHead = new PmsHead();
                pmsHead.Vid         = "PM";
                pmsHead.NoStageName = "'CLose','HardClosed'";

                //if (UserStatus == "PM")
                //    pmsHead.Pm = textboxPM.Text.ToString().Trim();
                //else
                //    pmsHead.UserName = textboxUserName.Text.ToString().Trim();

                pmsHead.UserName = textboxUserName.Text.Trim();
                pmsHead.CrId     = textboxCrNo.Text.Trim();

                PmsHeadBiz      pmsHeadBiz  = new PmsHeadBiz();
                IList <PmsHead> pmsHeadList = pmsHeadBiz.SelectPmsHeadOther(pmsHead);
                gridViewMain.DataSource = pmsHeadList;
                gridViewMain.DataBind();
                gridViewMain.Columns[13].Visible = false;
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('InitGrid failure!');", true);
            }
        }
Example #4
0
        public bool UpdateStage(PmsHead pmsHead, PmsChangeHistory pmsChangeHistory)
        {
            try
            {
                m_PMSSqlConnection.BeginTransaction();

                if (!UpdatePmsHeadOther(pmsHead))
                {
                    m_PMSSqlConnection.RollBackTransaction();
                    m_Logger.Error("PmsHeadBiz/UpdateStage/UpdatePmsHeadOther");
                    return(false);
                }
                PmsChangeHistoryBiz pmsChangeHistoryBiz = new PmsChangeHistoryBiz();
                int result = pmsChangeHistoryBiz.InsertPmsChangeHistory(pmsChangeHistory);
                if (result == 0)
                {
                    m_PMSSqlConnection.RollBackTransaction();
                    m_Logger.Error("PmsHeadBiz/UpdateStage/InsertPmsChangeHistory");
                    return(false);
                }
                m_PMSSqlConnection.CommitTransaction();

                return(true);
            }
            catch (Exception ex)
            {
                m_PMSSqlConnection.RollBackTransaction();
                m_Logger.Error("PmsHeadBiz/UpdateStage:" + ex.ToString());
                return(false);
            }
        }
Example #5
0
        protected void buttonGetFile_Click(object sender, EventArgs e)
        {
            PmsHead  pmsHead   = new PmsHead();
            DateTime dtCurDate = PmsSysBiz.GetDBDateTime();

            pmsHead.Creator    = LoginName;
            pmsHead.CreateDate = dtCurDate;
            pmsHead.PmsId      = PmsID;
            pmsHead.CrId       = CrID;
            IList <PmsDocuments> listPmsDocuments = new PmsDocumentsBiz().GetPmsDocuments(pmsHead);
            int saveResult = 0;

            foreach (PmsDocuments pmsDocuments in listPmsDocuments)
            {
                IList <PmsDocuments> pmsDocList = new PmsDocumentsBiz().SelectPmsDocuments(pmsDocuments);
                if (pmsDocList != null && pmsDocList.Count > 0)
                {
                    continue;
                }
                saveResult = new PmsDocumentsBiz().InsertPmsDocuments(pmsDocuments);
                if (saveResult <= 0)
                {
                    Msgbox("Get File failure!");
                    return;
                }
            }
            BindGrid(sender, e); // BindGrid时需判断projectType
        }
Example #6
0
 public bool UpDateCrIdPmsId(string newCrId, string oldCrId, out string infor)
 {
     infor = string.Empty;
     try
     {
         Hashtable newHashtable = new Hashtable {
             { "NewCrId", newCrId }, { "OldCrId", oldCrId }
         };
         m_PMSSqlConnection.Update("UpdatePmsItarmMappingCrId", newHashtable);
         IList <PmsItarmMapping> listPmsItarmMapping = m_PMSSqlConnection.QueryForList <PmsItarmMapping>("SelectPmsItarmMapping", new Hashtable {
             { "CrId", newCrId }, { "PmsId", null }
         });
         string  pmsId   = listPmsItarmMapping.FirstOrDefault().PmsId;
         PmsHead pmsHead = new PmsHead();
         pmsHead.PmsId = pmsId;
         pmsHead.Vid   = "PM";
         m_PMSSqlConnection.Update("UpdatePmsHeadVID", pmsHead);
         return(true);
     }
     catch (Exception ex)
     {
         m_Logger.Error("CRNoUpdateBiz/UpDateCrIdPmsId:" + ex.Message.ToString());
         infor = "Update failed!";
         return(false);
     }
 }
        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 #8
0
        private void InitPage()
        {
            Serial = int.Parse(Request.Params["Serial"]);
            string PmsId = Request.Params["PmsID"];
            string crId  = Request.Params["CrId"];
            //Abel test用
            //Serial = 697;
            //PmsId = "PMS201303010003";

            SdpDetail sdpDetailParms = new SdpDetail();

            sdpDetailParms.Serial = Serial;
            IList <PmsHead> pmsHead = new PmsHeadBiz().SelectPmsHeadByPmsId(PmsId);

            ;
            PmsHead ph = pmsHead[0];

            TextBoxCrNo.Text   = crId;
            TextBoxCrName.Text = ph.PmsName;
            IList <SdpDetail> sdpDetailList = new SdpDetailBiz().SelectSdpDetail(sdpDetailParms);

            if (sdpDetailList == null && sdpDetailList.Count == 0)
            {
                Msgbox("Data is null");
                return;
            }
            SdpDetailResult = (sdpDetailList == null || sdpDetailList.Count == 0) ? new SdpDetail() : sdpDetailList[0];
            ApprovedOutData();
            ControlEnabled(SdpDetailResult.TaskStatus);
        }
Example #9
0
 //Get PmsDocuments from TFS add by Ename Wang on 20140221
 public IList <PmsDocuments> GetPmsDocuments(PmsHead pmsHead)
 {
     try
     {
         IList <PmsDocuments> listPmsDocuments = new List <PmsDocuments>();
         Hashtable            hashtable        = new Hashtable();
         hashtable.Add("CrNo", pmsHead.CrId);
         IList <VTfsDoc> listVTfsDoc = m_PMSMSSqlConnection.QueryForList <VTfsDoc>("SelectVTfsDoc", hashtable);
         foreach (VTfsDoc VTfsDoc in listVTfsDoc)
         {
             PmsDocuments PmsDocuments = new PmsDocuments();
             PmsDocuments.PmsId      = pmsHead.PmsId;
             PmsDocuments.CreateDate = pmsHead.CreateDate;
             PmsDocuments.Creator    = pmsHead.Creator;
             PmsDocuments.DocTypeId  = GetDocTypeIdByFileName(VTfsDoc.FileName);
             PmsDocuments.FileName   = VTfsDoc.FileName;
             PmsDocuments.Path       = VTfsDoc.FileUrl;
             PmsDocuments.Size       = "0";
             listPmsDocuments.Add(PmsDocuments);
         }
         return(listPmsDocuments);
     }
     catch (Exception ex)
     {
         m_Logger.Error("PmsDocumentsBiz/GetPmsDocuments:" + ex.ToString());
         return(null);
     }
 }
Example #10
0
        private void InitPage()
        {
            try
            {
                LoginName = WSC.GlobalDefinition.Cookie_LoginUser.Replace(" ", ".");



                ButtonSaveTop.Attributes.Add("onclick", "return CheckBeforeSave()");
                ButtonSaveUnder.Attributes.Add("onclick", "return CheckBeforeSave()");
                ButtonCancelTop.OnClientClick   = "window.close()";
                ButtonCancelUnder.OnClientClick = "window.close()";

                //取得project,module
                PmsHead pmsHead = new PmsHead();
                pmsHead.Vid      = "PM";
                pmsHead.UserName = LoginName;
                pmsHead.CrId     = CrID;

                string        minID         = string.Empty;
                PmsMinHeadBiz pmsMinHeadBiz = new PmsMinHeadBiz();
                pmsMinHeadBiz.GetMinId(out minID);
                MinID = minID;  // 保存到ViewState,发mail时使用


                PmsHeadBiz      pmsHeadBiz  = new PmsHeadBiz();
                IList <PmsHead> pmsHeadList = pmsHeadBiz.SelectPmsHeadOther(pmsHead);
                string          project     = pmsHeadList[0].BugFreeProject;
                string          module      = pmsHeadList[0].BugFreeModule;


                string IssueCreateUrl = ConfigurationManager.AppSettings["IssueCreateUrl"];
                string paraMeter      = "&PmsID=" + Server.UrlEncode(GetBase64Encode(PmsID))
                                        + "&UserName="******".", " ")))
                                        + "&CrID=" + Server.UrlEncode(GetBase64Encode(CrID))
                                        + "&BugFreeProject=" + Server.UrlEncode(GetBase64Encode(project))
                                        + "&BugFreeModule=" + Server.UrlEncode(GetBase64Encode(module))
                                        + "&MNID=" + Server.UrlEncode(GetBase64Encode(MinID));

                ButtonCreateIssue.OnClientClick = "javascript:window.open('" + IssueCreateUrl + paraMeter + "');";

                BindDropDown();
                InitTextBox();

                GridViewBind(null);
                GridViewIssueBind();
            }
            catch (Exception ex)
            {
                Msgbox("Init Page Failed !");
            }
        }
Example #11
0
 public PmsHead SelectPmsHeadOther(PmsHead pmsHead)
 {
     try
     {
         PmsHead result = m_PMSSqlConnection.QueryForObject <PmsHead>("SelectPmsHeadOther", pmsHead);
         return(result);
     }
     catch (Exception ex)
     {
         m_Logger.Error("MyTaskDetailBiz/SelectPmsHeadOther:" + ex.ToString());
         return(null);
     }
 }
Example #12
0
 public bool UpdatePmsHeadOther(PmsHead pmsHead)
 {
     try
     {
         m_PMSSqlConnection.Update("UpdatePmsHeadOther", pmsHead);
         return(true);
     }
     catch (Exception ex)
     {
         m_Logger.Error("PmsHeadBiz/UpdatePmsHeadOther:" + ex.ToString());
         return(false);
     }
 }
 public bool UpdatePmsHeadForOK(PmsHead pmsHead)
 {
     try
     {
         m_PMSSqlConnection.Update("UpdatePmsHeadForOK", pmsHead);
         return(true);
     }
     catch (Exception ex)
     {
         m_Logger.Error("BasicInformationDetailBiz/UpdatePmsHeadForOK:" + ex.ToString());
         return(false);
     }
 }
Example #14
0
 public IList <PmsHead> SelectPmsHeadForCheckNewVersion(PmsHead pmsHead)
 {
     try
     {
         IList <PmsHead> result =
             m_PMSSqlConnection.QueryForList <PmsHead>("SelectPmsHeadForCheckNewVersion", pmsHead);
         return(result);
     }
     catch (Exception ex)
     {
         m_Logger.Error("PmsHeadBiz/SelectPmsHeadOther:" + ex.ToString());
         return(null);
     }
 }
Example #15
0
        public bool UpdatePmsHead(PmsHead pmsHead)
        {
            bool updateResult = false;

            try
            {
                m_PMSSqlConnection.Update("UpdatePmsHead", pmsHead);
                updateResult = true;
            }
            catch (Exception ex)
            {
                m_Logger.Error("PmsHeadBiz/UpdatePmsHead:" + ex.ToString());
            }
            return(updateResult);
        }
Example #16
0
        /// <summary>
        /// Save Service Data
        /// </summary>
        /// <param name="pmsHead"></param>
        /// <param name="sdpDetail"></param>
        /// <param name="pmsFlow"></param>
        /// <param name="pmsDocuments"></param>
        /// <returns></returns>
        public int InsertServiceDataToDB(PmsHead pmsHead, SdpDetail sdpDetail, PmsFlow pmsFlow, PmsDocuments pmsDocuments)
        {
            int returnResult = 0;

            try
            {
                m_PMSSqlConnection.BeginTransaction();

                // Insert PmsHead
                pmsHead.Vid   = "PM";
                pmsHead.Stage = 1;
                pmsHead.Pm    = "";
                pmsHead.Sd    = "";
                pmsHead.Se    = "";
                pmsHead.Qa    = "";
                // m_PMSSqlConnection.Insert("InsertPmsHead", pmsHead);

                // Insert SdpDetail
                SdpDetailBiz sdpDetailBiz = new SdpDetailBiz();
                returnResult = sdpDetailBiz.InsertSdpDetailByTemplate(sdpDetail);

                if (returnResult == 0)
                {
                    m_PMSSqlConnection.RollBackTransaction();
                    return(returnResult);
                }

                // Insert PmsFlow
                PmsFlowBiz pmsFlowBiz = new PmsFlowBiz();
                pmsFlowBiz.InsertPmsFlow(pmsFlow);


                // Insert PmsDocuments
                if (pmsDocuments.FileName != string.Empty)
                {
                    m_PMSSqlConnection.Insert("InsertPmsDocuments", pmsDocuments);
                }

                m_PMSSqlConnection.CommitTransaction();
            }
            catch (Exception ex)
            {
                m_PMSSqlConnection.RollBackTransaction();
                m_Logger.Error("PmsHeadBiz/InsertServiceDataToDB" + ex.Message.ToString());
            }

            return(returnResult);
        }
Example #17
0
        protected PmsHead getPmsHead(string creator, DateTime createDate, string pmsID)
        {
            PmsHead pmsHead = new PmsHead();

            pmsHead.Vid        = "PM";
            pmsHead.Creator    = creator;
            pmsHead.CreateDate = createDate;
            pmsHead.PmsId      = pmsID;
            pmsHead.PmsName    = textboxServiceName.Text;
            pmsHead.Priority   = dropdownlistPriority.SelectedValue;

            // 根据teamDomain,system,site 取得Domain
            pmsHead.Domain     = getDomain(dropdownlistTeamDomain.SelectedValue, dropdownlistSystem.SelectedValue, dropdownlistSite.SelectedValue);
            pmsHead.Site       = dropdownlistSite.SelectedValue;
            pmsHead.ImpactSite = dropdownlistSite.SelectedValue;
            pmsHead.System     = dropdownlistSystem.SelectedValue;
            //pmsHead.Description = FreeTextBoxDescription.Text;
            pmsHead.Description = TextBoxDescription.Text;
            if (pmsHead.Description.Length > 2000)
            {
                Msgbox("Description is too long!");
                return(null);
            }

            pmsHead.NeedSTP    = "N";
            pmsHead.NeedSTC    = "N";
            pmsHead.Category   = "N";
            pmsHead.NewVersion = "";
            pmsHead.OldVersion = "";


            pmsHead.Type  = "Service";
            pmsHead.Stage = GetStageID("Service");
            pmsHead.Pm    = creator;
            pmsHead.Sd    = "";
            pmsHead.Se    = "";
            pmsHead.Qa    = "";

            pmsHead.MaintainUser = "";
            pmsHead.OwnerDept    = m_PmsCRCreatBiz.GetOwnerDept(creator) ?? string.Empty;
            pmsHead.RelatedCrNo  = "";

            return(pmsHead);
        }
Example #18
0
        //public IList<PmsHead> SelectPmsHeadByTempCrIdPart(string tempCrIdPart)
        //{
        //    Hashtable hashtable = new Hashtable { { "TempCrIdPart", tempCrIdPart } };
        //    try
        //    {
        //        return m_PMSSqlConnection.QueryForList<PmsHead>("SelectPmsHeadByTempCrIdPart", hashtable);
        //    }
        //    catch (Exception ex)
        //    {
        //        m_Logger.Error("PmsHeadBiz/SelectPmsHeadByTempCrIdPart:" + ex.ToString());
        //        return null;
        //    }
        //}

        public int InsertPmsHead(PmsHead pmsHead)
        {
            int returnSerial = 0;

            try
            {
                object obj = m_PMSSqlConnection.Insert("InsertPmsHead", pmsHead);

                if (obj != null)
                {
                    returnSerial = (int)obj;
                }
            }
            catch (Exception ex)
            {
                m_Logger.Error("PmsHeadBiz/InsertPmsHead" + ex.Message.ToString());
            }

            return(returnSerial);
        }
Example #19
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);
        }
Example #20
0
        //private void BindDropDownListSiteAndImpactSite()
        //{
        //    try
        //    {
        //        PmsSys pmsSys = new PmsSys();
        //        pmsSys.Vid = "PM";
        //        pmsSys.Type = "Site";

        //        PmsSysBiz pmsSysBiz = new PmsSysBiz();
        //        IList<PmsSys> pmsSysList = pmsSysBiz.SelectData1ByType(pmsSys);

        //        dropdownlistSite.DataSource = pmsSysList;
        //        dropdownlistSite.DataTextField = "Data1";
        //        dropdownlistSite.DataValueField = "Data1";
        //        dropdownlistSite.DataBind();

        //        dropdownlistSite.Items.Insert(0, "");

        //        dropdownlistImpactSite.DataSource = pmsSysList;
        //        dropdownlistImpactSite.DataTextField = "Data1";
        //        dropdownlistImpactSite.DataValueField = "Data1";
        //        dropdownlistImpactSite.DataBind();

        //        QWeb.SelectItem(dropdownlistImpactSite, "QCS");

        //        //dropdownlistSite.Items.Insert(0, new ListItem());
        //        //dropdownlistSite.Items[0].Text = "";
        //        //dropdownlistSite.Items[0].Value = "";

        //        //dropdownlistImpactSite.Items.Insert(0, new ListItem());
        //        //dropdownlistImpactSite.Items[0].Text = "";
        //        //dropdownlistImpactSite.Items[0].Value = "";
        //    }
        //    catch
        //    {
        //        ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('Bind ImpactSite failure');", true);
        //    }

        //}
        #endregion
        #endregion

        protected void buttonSave_Click(object sender, EventArgs e)
        {
            try
            {
                //#region Define Variable
                ////string strSavePath = "";
                ////int iTypeID = 0;
                //#endregion

                //检查控件中的值
                if (!CheckControlValue())
                {
                    return;
                }

                //获取新的Pmsid,CrId以及他们的创建时间
                DateTime dtCurDate;
                string   strPmsID = string.Empty;
                string   strCrId  = string.Empty;
                m_PmsCRCreatBiz.GetNewPmsIdTempCrId(out dtCurDate, out strPmsID, out strCrId);

                #region Get StageID
                PmsFlowTemplateBiz      pmsFlowTemplateBiz  = new PmsFlowTemplateBiz();
                IList <PmsFlowTemplate> pmsFlowTemplateList = pmsFlowTemplateBiz.SelectPmsFlowTemplateByTypeId(dropdownlistType.SelectedValue.Trim());
                int stageId = pmsFlowTemplateList[0].Stageid;
                #endregion

                #region For Insert PmsHead
                PmsHead pmsHeadInsert = new PmsHead();
                pmsHeadInsert.Vid         = "PM";
                pmsHeadInsert.PmsId       = strPmsID;
                pmsHeadInsert.PmsName     = textboxPmsName.Text.Trim().Replace("'", "");
                pmsHeadInsert.Type        = dropdownlistType.SelectedItem.Text.Trim();
                pmsHeadInsert.Description = textboxDescription.Text.Trim().Replace("'", "");
                pmsHeadInsert.System      = textboxSystem.Text.Trim().Replace("'", "");
                pmsHeadInsert.Domain      = dropdownlistDomain.SelectedItem.Text.Trim();
                pmsHeadInsert.Priority    = dropdownlistPriority.SelectedItem.Text.Trim();
                pmsHeadInsert.Site        = dropdownlistSite.SelectedValue;
                pmsHeadInsert.ImpactSite  = dropdownlistImpactSite.SelectedItem.Text.Trim();
                pmsHeadInsert.NeedSTP     = RadioButtonNeedSTPYes.Checked ? "Y" : "N";
                pmsHeadInsert.NeedSTC     = RadioButtonNeedSTCYes.Checked ? "Y" : "N";
                //要插VB2Net add by ITO.Abel.Li 2014-01-06
                pmsHeadInsert.Category   = RadioButtonVB2NetYes.Checked ? "Y" : "N";
                pmsHeadInsert.NewVersion = textboxNewVersion.Text.Trim().Replace("'", "");
                // pmsHeadInsert.OldVersion = textboxOldVersion.Text.Trim().Replace("'", "");
                pmsHeadInsert.OldVersion = HiddenFieldOldVersion.Value.Trim().Replace("'", "");

                pmsHeadInsert.DueDate       = DateTime.Parse(dateTextBoxDueDate.Text.Trim());
                pmsHeadInsert.PlanStartDate = DateTime.Parse(dateTextBoxPlanStartDate.Text.Trim());
                //pmsHeadInsert.ReleaseDate = 0;
                //pmsHeadInsert.CloseDate = 0;
                pmsHeadInsert.Stage         = stageId;
                pmsHeadInsert.Pm            = textboxPM.Text.Trim().Replace("'", "");
                pmsHeadInsert.Sd            = "";
                pmsHeadInsert.Se            = "";
                pmsHeadInsert.Qa            = "";
                pmsHeadInsert.AbnormalStage = 0;
                pmsHeadInsert.Rerver1       = "";
                pmsHeadInsert.Rerver2       = "";
                pmsHeadInsert.Rerver3       = "";
                pmsHeadInsert.Rerver4       = "";
                pmsHeadInsert.Rerver5       = "";
                pmsHeadInsert.CreateDate    = dtCurDate;
                pmsHeadInsert.Creator       = LoginName;
                //pmsHeadInsert.MaintainDate = dtCurDate;
                pmsHeadInsert.MaintainUser = "";
                pmsHeadInsert.OwnerDept    = m_PmsCRCreatBiz.GetOwnerDept(LoginName) ?? string.Empty;
                pmsHeadInsert.RelatedCrNo  = textboxRelatedCrNo.Text.Trim();
                #endregion

                #region For Insert PMS_ITARM_Mapping
                PmsItarmMapping pmsItarmMapping = new PmsItarmMapping();
                pmsItarmMapping.PmsId      = strPmsID;
                pmsItarmMapping.CrId       = strCrId;
                pmsItarmMapping.Creator    = LoginName;
                pmsItarmMapping.CreateDate = dtCurDate;
                #endregion

                #region File(注释不用)
                #region Get Document Type
                //PmsDocumentType pmsDocType = new PmsDocumentType();
                //pmsDocType.Vid = "PM";
                //pmsDocType.TypeName = "PES";

                //PmsDocumentTypeBiz pmsDocTypeBiz = new PmsDocumentTypeBiz();
                //IList<PmsDocumentType> pmsDocTypeList = pmsDocTypeBiz.SelectPmsDocumentType(pmsDocType);

                //if (pmsDocTypeList != null && pmsDocTypeList.Count > 0)
                //{
                //    iTypeID = pmsDocTypeList[0].TypeId;
                //}
                #endregion

                #region Get UploadFilePath
                //PmsSys pmsSys = new PmsSys();
                //pmsSys.Vid = "PM";
                //pmsSys.Type = "UploadFilePath";

                //PmsSysBiz pmsSysBiz = new PmsSysBiz();
                //IList<PmsSys> pmsSysList = pmsSysBiz.SelectData1ByType(pmsSys);
                //if (pmsSysList != null && pmsSysList.Count > 0)
                //{
                //    strSavePath = pmsSysList[0].Data1.ToString().Trim();
                //}
                //else
                //{
                //    ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('Please maintain UploadFilePath!');", true);
                //    return;
                //}
                #endregion

                #region For Insert PmsDocuments
                //PmsDocuments pmsDocuments = new PmsDocuments();
                //pmsDocuments.PmsId = strPmsID;
                //pmsDocuments.DocTypeId = iTypeID;
                //pmsDocuments.FileName = pesUpload.PostedFile.FileName.Substring(pesUpload.PostedFile.FileName.LastIndexOf("\\") + 1);

                //string strTmp = strSavePath + "\\" + strPmsID + "\\" + pmsDocuments.FileName;
                //if (strTmp.Length > 150)
                //{
                //    ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('The length of SavePath is larger than 150!');", true);
                //    pesUpload.Focus();
                //    return;
                //}

                //pmsDocuments.Path = strSavePath + "\\" + strPmsID + "\\" + pmsDocuments.FileName;
                //pmsDocuments.Size = pesUpload.PostedFile.ContentLength.ToString().Trim();
                //pmsDocuments.Creator = LoginName;
                //pmsDocuments.CreateDate = dtCurDate;
                //#endregion

                //#region Upload PES File
                //if (pmsDocuments.FileName != "")
                //{
                //    strSavePath = strSavePath + "\\" + strPmsID;

                //    if (!QFile.CheckFolderExist(strSavePath))
                //    {
                //        QFile.CreateDirectory(strSavePath);
                //    }

                //    strSavePath = strSavePath + "\\" + pmsDocuments.FileName;

                //    pesUpload.PostedFile.SaveAs(strSavePath);
                //}
                #endregion
                #endregion

                #region For Insert SdpDetail
                SdpDetail sdpDetail = new SdpDetail();
                sdpDetail.Pmsid = strPmsID;
                sdpDetail.Type  = dropdownlistType.SelectedValue.Trim();
                #endregion

                #region For Insert PmsFlow

                //pmsFlowTemplateList = pmsFlowTemplateBiz.SelectPmsFlowTemplateByTypeId(dropdownlistType.SelectedValue.Trim());

                PmsFlow pmsFlow = new PmsFlow();
                pmsFlow.FlowId     = pmsFlowTemplateList[0].FlowId;
                pmsFlow.PmsId      = strPmsID;
                pmsFlow.Creator    = LoginName;
                pmsFlow.CreateDate = dtCurDate;
                #endregion

                #region For Insert PMSChangeHistory
                PmsChangeHistory pmsChangeHistory = new PmsChangeHistory();
                pmsChangeHistory.PmsId         = strPmsID;
                pmsChangeHistory.ChangeContent = "";
                pmsChangeHistory.Action        = "CREATE";
                pmsChangeHistory.CreateDate    = dtCurDate;
                pmsChangeHistory.Creator       = LoginName;
                #endregion

                #region For Insert Itarm_Cr_List
                ItarmCrList itarmCrList = new ItarmCrList();
                itarmCrList.CrId       = strCrId;
                itarmCrList.CrName     = textboxPmsName.Text.Trim().Replace("'", "");
                itarmCrList.Site       = dropdownlistSite.SelectedValue;
                itarmCrList.Creator    = LoginName;
                itarmCrList.CreateDate = dtCurDate;
                itarmCrList.Pm         = textboxPM.Text.Trim().Replace("'", "");
                itarmCrList.System     = textboxSystem.Text.Trim().Replace("'", "");

                #endregion

                #region Insert
                PmsHeadBiz pmsInsert = new PmsHeadBiz();

                string errorInfo;
                int    insertResult = pmsInsert.InsertPmsHeadAndDoc(pmsHeadInsert, sdpDetail, pmsChangeHistory, pmsItarmMapping, pmsFlow, itarmCrList, null, out errorInfo);

                if (insertResult == 0)
                {
                    Msgbox("Save Fail!");
                }
                else
                {
                    #region 更新系统版本表
                    bool upVerResult =
                        m_PmsCRCreatBiz.UpdateSysVersion(dropdownlistDomain.SelectedValue, textboxSystem.Text.Trim(), dropdownlistSite.SelectedValue, textboxNewVersion.Text.Trim());

                    if (!upVerResult)
                    {
                        Msgbox("Updated system version number fail!");
                    }

                    #endregion

                    //  Session["InquiryPage_Refresh"] = "Y";
                    //发送创建成功的Mail

                    LoginName.Replace(".", " ");
                    pmsHeadInsert.UserName = LoginName;
                    new MailBiz().SendCreateMail(pmsHeadInsert);

                    Msgbox("Create Successful!");
                    PageRegisterStartupScript("window.close();");
                }
                #endregion
            }
            catch (Exception exception)
            {
                Msgbox("Save Fail!");
            }
        }
        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();
        }
        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);
            }
        }
Example #23
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());
            }
        }
Example #24
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
        }
Example #25
0
        public bool CheckPromote(PmsHead pmsHead, out string message)
        {
            try
            {
                if (!m_ProjectProgressBiz.CheckDocuments(pmsHead, pmsHead.Stage, out message))
                {
                    return(false);
                }

                bool flag = true;
                switch (pmsHead.Stage)//stage为当前状态
                {
                case (int)PmsCommonEnum.ProjectStage.PES:
                    //Mark by Ename Wang on 20111128 08:56 for Service type has no dute date.
                    if (pmsHead.Type == PmsCommonEnum.ProjectTypeFlowId.Service.GetDescription())
                    {
                        break;
                    }
                    if (pmsHead.DueDate < Qisda.DateTime.QDateTime.ChangeNumericToDate("19000101"))
                    {
                        message = "Please input due date!";
                        flag    = false;
                    }
                    break;

                case (int)PmsCommonEnum.ProjectStage.AssignMember:
                    if (string.IsNullOrEmpty(pmsHead.Sd))
                    {
                        message = "Please assign SD!";
                        flag    = false;
                    }
                    break;

                //Abel 注释掉 on 2014-01-22
                //case (int)PmsCommonEnum.ProjectStage.PIS_STP:

                //    string designComp = PageProjectsInformation.DesignCompletedPercent;
                //    if (!string.IsNullOrEmpty(designComp))
                //    {
                //        designComp = designComp.Replace("%", "");
                //        if (float.Parse(designComp) <= 0)
                //        {
                //            message = "Please maintain design phase of the information!";
                //            flag = false;
                //        }
                //    }

                //    break;

                //case (int)PmsCommonEnum.ProjectStage.Develop_Test:
                //    flag = DevelopTestCheck(pmsHead.Type, out message);
                //    break;

                case (int)PmsCommonEnum.ProjectStage.WaitingClosed:
                    flag = true;
                    break;

                default:
                    message = "Has no right to promote!";
                    flag    = false;
                    break;
                }
                return(flag);
            }
            catch (Exception)
            {
                message = "Please Check Promote Condition!";
                return(false);
            }
        }
Example #26
0
        public void BindGrid(object sender, EventArgs e)
        {
            #region Bind DataTable to GridView
            try
            {
                if (sender == null)
                {
                    DataTable dt = new DataTable();
                    gridViewMain.DataSource = dt;
                    gridViewMain.DataBind();
                    gridViewMain.Columns[13].Visible = false;
                }
                else
                {
                    #region Get Values
                    PmsHead pmsHead = new PmsHead();
                    pmsHead.Vid = "PM";

                    if (this.dropdownlistDomain.SelectedItem != null && this.dropdownlistDomain.SelectedItem.Text.ToUpper() != "")
                    {
                        pmsHead.Domain = this.dropdownlistDomain.SelectedItem.Text.ToString();
                    }
                    else
                    {
                        pmsHead.Domain = "";
                    }

                    pmsHead.System  = textboxSystem.Text.Trim();
                    pmsHead.CrId    = textboxCrNo.Text.Trim();
                    pmsHead.PmsName = textboxPmsName.Text.Trim();

                    if (this.dropdownlistType.SelectedItem != null && this.dropdownlistType.SelectedItem.Text.ToUpper() != "")
                    {
                        pmsHead.Type = this.dropdownlistType.SelectedItem.Value.ToString();
                    }
                    else
                    {
                        pmsHead.Type = "";
                    }

                    if (this.dropdownlistSite.SelectedItem != null && this.dropdownlistSite.SelectedItem.Text.ToUpper() != "")
                    {
                        pmsHead.Site = this.dropdownlistSite.SelectedItem.Value.ToString();
                    }
                    else
                    {
                        pmsHead.Site = "";
                    }

                    if (this.dropdownlistStage.SelectedItem != null && this.dropdownlistStage.SelectedItem.Text.ToUpper() != "")
                    {
                        pmsHead.StageName = this.dropdownlistStage.SelectedItem.Text.ToString().Trim();
                    }
                    else
                    {
                        pmsHead.StageName = "";
                    }

                    // pmsHead.Pm = textboxPM.Text.ToString().Trim();
                    // pmsHead.UserName = textboxUserName.Text.ToString().Trim();


                    if (this.dropdownlistPriority.SelectedItem != null && this.dropdownlistPriority.SelectedItem.Text.ToUpper() != "")
                    {
                        pmsHead.Priority = this.dropdownlistPriority.SelectedItem.Text.ToString().Trim();
                    }
                    else
                    {
                        pmsHead.Priority = "";
                    }

                    pmsHead.UserName = textboxUserName.Text.ToString().Trim();


                    if (this.dateTextBoxCreateDateFrom.Text.ToString().Trim() != "")
                    {
                        pmsHead.CreateDateFrom = DateTime.Parse(dateTextBoxCreateDateFrom.Text.ToString().Trim());
                    }

                    if (this.dateTextBoxCreateDateTo.Text.ToString().Trim() != "")
                    {
                        pmsHead.CreateDateTo = DateTime.Parse(dateTextBoxCreateDateTo.Text.ToString().Trim());
                    }

                    if (this.dateTextBoxReleaseDateFrom.Text.ToString().Trim() != "")
                    {
                        pmsHead.ReleaseDateFrom = DateTime.Parse(dateTextBoxReleaseDateFrom.Text.ToString().Trim());
                    }

                    if (this.dateTextBoxReleaseDateTo.Text.ToString().Trim() != "")
                    {
                        pmsHead.ReleaseDateTo = DateTime.Parse(dateTextBoxReleaseDateTo.Text.ToString().Trim());
                    }

                    if (this.dateTextBoxDueDateFrom.Text.ToString().Trim() != "")
                    {
                        pmsHead.DueDateFrom = DateTime.Parse(dateTextBoxDueDateFrom.Text.ToString().Trim());
                    }

                    if (this.dateTextBoxDueDateTo.Text.ToString().Trim() != "")
                    {
                        pmsHead.DueDateTo = DateTime.Parse(dateTextBoxDueDateTo.Text.ToString().Trim());
                    }
                    #endregion



                    PmsHeadBiz      pmsHeadBiz  = new PmsHeadBiz();
                    IList <PmsHead> pmsHeadList = pmsHeadBiz.SelectPmsHeadOther(pmsHead);

                    #region Sort Modify By Albee
                    List <PmsHead> SdpHeadList = (List <PmsHead>)pmsHeadList;

                    if (SdpHeadList != null && SdpHeadList.Count > 0)
                    {
                        #region Descending

                        if (GridViewSortDirection == SortDirection.Descending)
                        {
                            switch (ViewState["SortExpression"].ToString())
                            {
                            case "CrId":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.CrId.CompareTo(x.CrId)); });
                                break;

                            case "Type":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.Type.CompareTo(x.Type)); });
                                break;

                            case "PmsName":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.PmsName.CompareTo(x.PmsName)); });
                                break;

                            case "Progress":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.Progress.CompareTo(x.Progress)); });
                                break;

                            case "DueDate":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.DueDate.CompareTo(x.DueDate)); });
                                break;

                            case "ReleaseDate":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.ReleaseDate.CompareTo(x.ReleaseDate)); });
                                break;

                            case "CreateDate":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.CreateDate.CompareTo(x.CreateDate)); });
                                break;

                            case "StageName":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.StageName.CompareTo(x.StageName)); });
                                break;

                            case "Pm":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.Pm.CompareTo(x.Pm)); });
                                break;

                            case "Sd":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.Sd.CompareTo(x.Sd)); });
                                break;

                            case "System":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.System.CompareTo(x.System)); });
                                break;

                            default:

                                break;
                            }
                        }
                        #endregion

                        #region Ascending
                        else
                        {
                            switch (ViewState["SortExpression"].ToString())
                            {
                            case "CrId":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.CrId.CompareTo(y.CrId)); });
                                break;

                            case "Type":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.Type.CompareTo(y.Type)); });
                                break;

                            case "PmsName":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.PmsName.CompareTo(y.PmsName)); });
                                break;

                            case "Progress":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.Progress.CompareTo(y.Progress)); });
                                break;

                            case "DueDate":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.DueDate.CompareTo(y.DueDate)); });
                                break;

                            case "ReleaseDate":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.ReleaseDate.CompareTo(y.ReleaseDate)); });
                                break;

                            case "CreateDate":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.CreateDate.CompareTo(y.CreateDate)); });
                                break;

                            case "StageName":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.StageName.CompareTo(y.StageName)); });
                                break;

                            case "Pm":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.Pm.CompareTo(y.Pm)); });
                                break;

                            case "Sd":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.Sd.CompareTo(y.Sd)); });
                                break;

                            case "System":
                                SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.System.CompareTo(y.System)); });
                                break;

                            default:

                                break;
                            }
                        }
                        #endregion
                    }



                    //gridViewDetailList.DataSource = pmsSdpHeadList; //mark by Albee 2010-08-03
                    gridViewMain.DataSource = SdpHeadList;
                    #endregion

                    //gridViewMain.DataSource = pmsHeadList;
                    gridViewMain.DataBind();
                    gridViewMain.Columns[13].Visible = false;
                }
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('BindGrid failure!');", true);
            }

            #endregion
        }
Example #27
0
        public int InsertPmsHeadAndDoc(PmsHead pmsHead, SdpDetail sdpDetail, PmsChangeHistory pmsChangeHistory, PmsItarmMapping pmsItarmMapping,
                                       PmsFlow pmsFlow, ItarmCrList itarmCrList, IList <PmsDocuments> listPmsDocuments, out string errorInfo)
        {
            errorInfo = string.Empty;
            int returnResult = 0;

            try
            {
                m_PMSSqlConnection.BeginTransaction();

                #region Insert PmsHead
                //string type = pmsHead.PmsName.GetTypeCode;
                m_PMSSqlConnection.Insert("InsertPmsHead", pmsHead);
                #endregion

                #region Insert PmsItarmMapping
                PmsItarmMappingBiz pmsItarmMappingBiz = new PmsItarmMappingBiz();
                pmsItarmMappingBiz.InsertPmsItarmMapping(pmsItarmMapping);
                #endregion

                #region Insert PmsDocuments

                if (listPmsDocuments != null)
                {
                    foreach (PmsDocuments pmsDocuments in listPmsDocuments)
                    {
                        if (pmsDocuments.DocTypeId == 0)
                        {
                            errorInfo = "DocTypeId is Invalid!";
                            return(returnResult);
                        }

                        if (pmsDocuments.FileName == string.Empty)
                        {
                            errorInfo = "FileName is Empty!";
                            return(returnResult);
                        }

                        if (pmsDocuments.FileName != string.Empty)
                        {
                            m_PMSSqlConnection.Insert("InsertPmsDocuments", pmsDocuments);
                        }
                    }
                }


                #endregion

                #region Insert SdpDetail
                SdpDetailBiz sdpDetailBiz = new SdpDetailBiz();
                returnResult = sdpDetailBiz.InsertSdpDetailByTemplate(sdpDetail);

                if (returnResult == 0)
                {
                    m_PMSSqlConnection.RollBackTransaction();
                    return(returnResult);
                }
                #endregion

                #region Insert PmsChangeHistory
                PmsChangeHistoryBiz pmsChangeHistoryBiz = new PmsChangeHistoryBiz();
                pmsChangeHistoryBiz.InsertPmsChangeHistory(pmsChangeHistory);
                #endregion

                #region Insert PmsFlow
                PmsFlowBiz pmsFlowBiz = new PmsFlowBiz();
                pmsFlowBiz.InsertPmsFlow(pmsFlow);
                #endregion

                #region Insert ItarmCrList
                bool resultInsertItarm = new PmsCRCreatBiz().InsertItarmCrList(itarmCrList);
                if (!resultInsertItarm)
                {
                    m_PMSSqlConnection.RollBackTransaction();
                    errorInfo = "Save Fail";
                    return(0);
                }
                #endregion

                m_PMSSqlConnection.CommitTransaction();
            }
            catch (Exception ex)
            {
                m_PMSSqlConnection.RollBackTransaction();
                errorInfo = "Save Fail";
                m_Logger.Error("PmsHeadBiz/InsertPmsHeadAndDoc" + ex.Message.ToString());
            }

            return(returnResult);
        }
Example #28
0
        public void BindGrid(object sender, EventArgs e)
        {
            #region Bind DataTable to GridView
            try
            {
                if (sender == null)
                {
                    DataTable dt = new DataTable();
                    gridViewMain.DataSource = dt;
                    gridViewMain.DataBind();
                }
                else
                {
                    #region Get Values
                    PmsHead pmsHead = new PmsHead();
                    pmsHead.Vid       = "PM";
                    pmsHead.StageName = PmsCommonEnum.ProjectStage.AssignMember.GetDescription();
                    #endregion

                    PmsHeadBiz      pmsHeadBiz  = new PmsHeadBiz();
                    IList <PmsHead> pmsHeadList = pmsHeadBiz.SelectPmsHeadOther(pmsHead);

                    #region Sort Modify By Albee
                    List <PmsHead> SdpHeadList = (List <PmsHead>)pmsHeadList;
                    #region Descending

                    if (GridViewSortDirection == SortDirection.Descending)
                    {
                        switch (ViewState["SortExpression"].ToString())
                        {
                        case "CrId":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.CrId.CompareTo(x.CrId)); });
                            break;

                        case "Type":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.Type.CompareTo(x.Type)); });
                            break;

                        case "PmsName":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.PmsName.CompareTo(x.PmsName)); });
                            break;

                        case "Progress":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.Progress.CompareTo(x.Progress)); });
                            break;

                        case "DueDate":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.DueDate.CompareTo(x.DueDate)); });
                            break;

                        case "ReleaseDate":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.ReleaseDate.CompareTo(x.ReleaseDate)); });
                            break;

                        case "CreateDate":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.CreateDate.CompareTo(x.CreateDate)); });
                            break;

                        case "StageName":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.StageName.CompareTo(x.StageName)); });
                            break;

                        case "Priority":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.Priority.CompareTo(x.Priority)); });
                            break;

                        case "Sd":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.Sd.CompareTo(x.Sd)); });
                            break;

                        case "System":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(y.System.CompareTo(x.System)); });
                            break;

                        default:

                            break;
                        }
                    }
                    #endregion

                    #region Ascending
                    else
                    {
                        switch (ViewState["SortExpression"].ToString())
                        {
                        case "CrId":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.CrId.CompareTo(y.CrId)); });
                            break;

                        case "Type":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.Type.CompareTo(y.Type)); });
                            break;

                        case "PmsName":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.PmsName.CompareTo(y.PmsName)); });
                            break;

                        case "Progress":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.Progress.CompareTo(y.Progress)); });
                            break;

                        case "DueDate":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.DueDate.CompareTo(y.DueDate)); });
                            break;

                        case "ReleaseDate":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.ReleaseDate.CompareTo(y.ReleaseDate)); });
                            break;

                        case "CreateDate":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.CreateDate.CompareTo(y.CreateDate)); });
                            break;

                        case "StageName":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.StageName.CompareTo(y.StageName)); });
                            break;

                        case "Priority":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.Priority.CompareTo(y.Priority)); });
                            break;

                        case "Sd":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.Sd.CompareTo(y.Sd)); });
                            break;

                        case "System":
                            SdpHeadList.Sort(delegate(PmsHead x, PmsHead y) { return(x.System.CompareTo(y.System)); });
                            break;

                        default:

                            break;
                        }
                    }
                    #endregion

                    gridViewMain.DataSource = SdpHeadList;
                    #endregion

                    #region Get gridViewTaskAudit Values
                    //借用Creator传LoginName
                    pmsHead.Creator = LoginName;
                    IList <PmsHead> pmsHeadListAudit = pmsHeadBiz.SelectPmsHeadForAuditor(pmsHead);
                    List <PmsHead>  SdpHeadListAudit = (List <PmsHead>)pmsHeadListAudit;
                    gridViewTaskAudit.DataSource = SdpHeadListAudit;
                    #endregion
                    IList <PmsHead> pmsHeadListAgent = pmsHeadBiz.SelectPmsHeadForAgent(pmsHead);
                    List <PmsHead>  SdpHeadListAgent = (List <PmsHead>)pmsHeadListAgent;
                    gridViewTaskAgent.DataSource = SdpHeadListAgent;
                    #region Get gridViewTaskAgent Values

                    #endregion

                    gridViewMain.DataBind();
                    gridViewTaskAudit.DataBind();
                    gridViewTaskAgent.DataBind();
                }
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('BindGrid failure!');", true);
            }

            #endregion
        }