public void BindGrid(object sender, EventArgs e) { try { PmsDocuments pmsDoc = new PmsDocuments(); pmsDoc.PmsId = PmsID; PmsDocumentsBiz pmsDocBiz = new PmsDocumentsBiz(); IList <PmsDocuments> pmsDocList = pmsDocBiz.SelectPmsDocumentsOther(pmsDoc); // if projectType=="Service",绑定gridViewService,隐藏gridViewMain // else 绑定gridViewMain,隐藏gridViewService if (ProjectType == PmsCommonEnum.ProjectTypeFlowId.Service.GetDescription()) { gridViewMain.Visible = false; gridViewService.Visible = true; gridViewService.DataSource = pmsDocList; gridViewService.DataBind(); } else { gridViewMain.Visible = true; gridViewService.Visible = false; gridViewMain.DataSource = pmsDocList; gridViewMain.DataBind(); } } catch { Msgbox("BindGrid failure!"); } }
//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); } }
protected void gridView_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { int rowIndex = e.RowIndex; int docTypeId = 0; string fileName = string.Empty; string owner = string.Empty; switch (ProjectType) { // string service = PmsCommonEnum.ProjectTypeFlowId.Service.GetDescription(); case "Service": docTypeId = int.Parse(gridViewService.DataKeys[rowIndex]["DocTypeId"].ToString()); fileName = gridViewService.DataKeys[rowIndex]["FileName"].ToString(); owner = gridViewService.DataKeys[rowIndex]["Creator"].ToString(); break; default: docTypeId = int.Parse(gridViewMain.DataKeys[rowIndex]["DocTypeId"].ToString()); fileName = gridViewMain.DataKeys[rowIndex]["FileName"].ToString(); owner = gridViewMain.DataKeys[rowIndex]["Creator"].ToString(); break; } if (string.Compare(owner.ToLower(), LoginName.ToLower()) != 0) { Msgbox("You can not delete it, you are not owner!"); return; } PmsDocuments pmsDoc = new PmsDocuments(); pmsDoc.PmsId = PmsID; pmsDoc.DocTypeId = docTypeId; pmsDoc.FileName = fileName; PmsDocumentsBiz pmsDocBiz = new PmsDocumentsBiz(); int deleteResult = pmsDocBiz.DeletePmsDocuments(pmsDoc); if (deleteResult <= 0) { Msgbox("Delete failure!"); } else { if (ProjectType == PmsCommonEnum.ProjectTypeFlowId.Service.GetDescription()) { string filePath = gridViewService.DataKeys[rowIndex]["Path"].ToString(); File.Delete(filePath); //删除数据库记录的同时,删除服务器上的文件 } BindGrid(sender, e); } } catch { Msgbox("Delete failure!"); } }
public IList <PmsDocuments> SelectPmsDocumentsOther(PmsDocuments pmsDocuments) { try { return(m_PMSSqlConnection.QueryForList <PmsDocuments>("SelectPmsDocumentsOther", pmsDocuments)); } catch (Exception ex) { m_Logger.Error("PmsDocumentsBiz/SelectPmsDocumentsOther:" + ex.ToString()); return(null); } }
public IList <PmsDocuments> SelectPmsDocuments(PmsDocuments pmsDocuments) { try { IList <PmsDocuments> result = m_PMSSqlConnection.QueryForList <PmsDocuments>("SelectPmsDocuments", pmsDocuments); return(result); } catch (Exception ex) { m_Logger.Error("PmsDocumentsBiz/SelectPmsDocuments:" + ex.ToString()); return(null); } }
public int DeletePmsDocuments(PmsDocuments pmsDocuments) { int returnSerial = 0; try { returnSerial = m_PMSSqlConnection.Delete("DeletePmsDocuments", pmsDocuments); } catch (Exception ex) { m_Logger.Error("PmsDocumentsBiz/DeletePmsDocuments" + ex.Message.ToString()); } return(returnSerial); }
public int InsertPmsDocuments(PmsDocuments pmsDocuments) { int returnSerial = 0; try { object obj = m_PMSSqlConnection.Insert("InsertPmsDocuments", pmsDocuments); returnSerial = 1; } catch (Exception ex) { m_Logger.Error("PmsDocumentsBiz/InsertPmsDocuments" + ex.Message.ToString()); } return(returnSerial); }
protected void InsertPmsDocuments(string fileName, string fileFullPath, string fileSize, out int saveResult) { PmsDocuments pmsDocuments = new PmsDocuments(); pmsDocuments.PmsId = PmsID; pmsDocuments.DocTypeId = (int)PmsCommonEnum.DocumentType.Other; pmsDocuments.FileName = fileName; pmsDocuments.Path = fileFullPath; pmsDocuments.Size = fileSize; pmsDocuments.Creator = WSC.GlobalDefinition.Cookie_LoginUser.Replace(" ", ".");; DateTime dtCurDate = PmsSysBiz.GetDBDateTime(); pmsDocuments.CreateDate = dtCurDate; PmsDocumentsBiz pmsDocBiz = new PmsDocumentsBiz(); saveResult = pmsDocBiz.InsertPmsDocuments(pmsDocuments); }
protected IList <PmsDocuments> getPmsDocuments(string creator, DateTime createDate, string pmsID, string crId) { IList <PmsDocuments> pmsDocumentsList = new List <PmsDocuments>(); foreach (KeyValuePair <string, string> keyValuePair in this.Dictionary_FileNames) { PmsDocuments pmsDocuments = new PmsDocuments(); pmsDocuments.Creator = creator; pmsDocuments.CreateDate = createDate; pmsDocuments.PmsId = pmsID; string docTypeId = "Other"; pmsDocuments.DocTypeId = getTypeIdByTypeName(docTypeId); pmsDocuments.FileName = keyValuePair.Key; pmsDocuments.Path = getNewPath(keyValuePair.Key, keyValuePair.Value, crId); pmsDocuments.Size = getSizeByPath(keyValuePair.Value); pmsDocumentsList.Add(pmsDocuments); } return(pmsDocumentsList); }
protected void buttonSave_Click(object sender, EventArgs e) { try { #region Check Validity if (dropdownlistDocType != null && dropdownlistDocType.Items.Count > 0) { if (dropdownlistDocType.SelectedItem.Text.ToString().Trim() == "") { Msgbox("Please select Document Type!"); dropdownlistDocType.Focus(); return; } } if (textboxUrl.Text.Trim() == "") { Msgbox("Please input URL!"); textboxUrl.Focus(); return; } if (textboxUrl.Text.Length > 500) { Msgbox("The length of URL is larger than 500!"); textboxUrl.Focus(); return; } if (!ValidateUrl(textboxUrl.Text.Trim())) { Msgbox("The Url is not legal!"); textboxUrl.Focus(); return; } #endregion #region For Insert PmsDocuments PmsDocuments pmsDocuments = new PmsDocuments(); pmsDocuments.PmsId = PmsID; pmsDocuments.DocTypeId = int.Parse(dropdownlistDocType.SelectedValue); pmsDocuments.FileName = FileName; if (textboxUrl.Text.Trim().LastIndexOf("\\") != -1) { pmsDocuments.FileName = Server.UrlDecode(textboxUrl.Text.Trim().Substring(textboxUrl.Text.Trim().LastIndexOf("\\") + 1)); } else { pmsDocuments.FileName = Server.UrlDecode(textboxUrl.Text.Trim().Substring(textboxUrl.Text.Trim().LastIndexOf("/") + 1)); } int documentTypeId = int.Parse(dropdownlistDocType.SelectedValue); PmsHead pmsHead = new PmsHeadBiz().SelectCrIdSystemVersionByPmsId(PmsID); string errorInfo; if (!CheckFileName(pmsDocuments.FileName, documentTypeId, pmsHead.CrId, pmsHead.System, pmsHead.NewVersion, out errorInfo)) { Msgbox(errorInfo); return; } pmsDocuments.Path = textboxUrl.Text.Trim(); DateTime dtCurDate = PmsSysBiz.GetDBDateTime(); pmsDocuments.Creator = LoginName; pmsDocuments.CreateDate = dtCurDate; //默认给"0" pmsDocuments.Size = "0"; PmsDocumentsBiz pmsDocBiz = new PmsDocumentsBiz(); IList <PmsDocuments> pmsDocList = pmsDocBiz.SelectPmsDocuments(pmsDocuments); int saveResult = 0; if (pmsDocList != null && pmsDocList.Count > 0) { Msgbox("File Exists!"); return; } saveResult = pmsDocBiz.InsertPmsDocuments(pmsDocuments); if (saveResult <= 0) { Msgbox("Save failure!"); return; } #endregion Session["DocPage_Refresh"] = "Y"; Msgbox("Save Successfully!"); PageRegisterStartupScript("window.close();"); } catch { Msgbox("Save failure!"); } }
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(); }
/// <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); }