public bool InsertItarmCrList(ItarmCrList itarmCrList) { try { m_PMSSqlConnection.Insert("InsertItarmCrList", itarmCrList); return(true); } catch (Exception ex) { m_Logger.Error("PmsCRCreatBiz/InsertItarmCrList:" + ex.ToString()); return(false); } }
protected ItarmCrList getItarmCrList(string creator, DateTime createDate, string crID) { ItarmCrList itarmCrList = new ItarmCrList(); itarmCrList.Creator = creator; itarmCrList.CreateDate = createDate; itarmCrList.CrId = crID; itarmCrList.CrName = textboxServiceName.Text.Trim().Replace("'", ""); itarmCrList.Site = dropdownlistSite.SelectedValue; itarmCrList.Pm = creator; // in default creator is pm itarmCrList.System = dropdownlistSystem.SelectedValue; return(itarmCrList); }
public int InsertItarmCrList(ItarmCrList itarmCrList) { int returnSerial = 0; try { object obj = m_PMSSqlConnection.Insert("InsertItarmCrList", itarmCrList); if (obj != null) { returnSerial = (int)obj; } } catch (Exception ex) { m_Logger.Error("ItArmCrListBiz/InsertItarmCrList" + ex.ToString()); } return(returnSerial); }
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); }
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()); } }
//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 int InsertFromItarmRequirement(string oldCrId, string newCrId) { ItarmCrList itarmCrListInsert = new ItarmCrList(); ItarmCrListCo itarmCrListCoInsert = new ItarmCrListCo(); ItarmCrListBiz itarmCrListBiz = new ItarmCrListBiz(); PmsItarmMappingBiz pmsItarmMappingBiz = new PmsItarmMappingBiz(); string creator = "Itarm"; DateTime createDate = System.DateTime.Now; int returnSerial = 0; try { #region Deal Requirement IList <SdpSys> sdpSysList = m_ITARMSqlConnection.QueryForList <SdpSys>("SelectRequirementList", newCrId); if (sdpSysList != null && sdpSysList.Count > 0) { // 插到itarm_CR_List m_PMSSqlConnection.BeginTransaction(); #region Insert itarm_cr_list if (sdpSysList[0].CrId.ToString().Trim().Length > 15) { itarmCrListInsert.CrId = sdpSysList[0].CrId.ToString().Trim().Substring(0, 15); } else { itarmCrListInsert.CrId = sdpSysList[0].CrId.ToString().Trim(); } if (sdpSysList[0].CRName.ToString().Trim().Length > 500) { itarmCrListInsert.CrName = sdpSysList[0].CRName.ToString().Trim().Substring(0, 500); } else { itarmCrListInsert.CrName = sdpSysList[0].CRName.ToString().Trim(); } if (sdpSysList[0].Site.ToString().Trim().Length > 20) { itarmCrListInsert.Site = sdpSysList[0].Site.ToString().Trim().Substring(0, 20); } else { itarmCrListInsert.Site = sdpSysList[0].Site.ToString().Trim(); } itarmCrListInsert.Creator = creator; itarmCrListInsert.CreateDate = createDate; if (sdpSysList[0].SystemName.ToString().Trim().Length > 100) { itarmCrListInsert.System = sdpSysList[0].SystemName.ToString().Trim().Substring(0, 100); } else { itarmCrListInsert.System = sdpSysList[0].SystemName.ToString().Trim(); } if (sdpSysList[0].PM.ToString().Trim().Length > 100) { itarmCrListInsert.Pm = sdpSysList[0].PM.ToString().Trim().Substring(0, 100); } else { itarmCrListInsert.Pm = sdpSysList[0].PM.ToString().Trim(); } int returnInsertResult = itarmCrListBiz.InsertItarmCrList(itarmCrListInsert); if (returnInsertResult <= 0) { m_PMSSqlConnection.RollBackTransaction(); return(returnSerial); } #endregion // 并更新PMS_Itarm_Mapping #region Update PMS_ITARM_Mapping bool mappingResult = pmsItarmMappingBiz.UpdatePmsItarmMappingCrId(oldCrId, newCrId); if (mappingResult == false) { m_PMSSqlConnection.RollBackTransaction(); return(returnSerial); } #endregion m_PMSSqlConnection.CommitTransaction(); returnSerial = 1; } #endregion } catch (Exception ex) { m_Logger.Error("ItArmCrListBiz/InsertFromItarmCr" + ex.ToString()); return(returnSerial); } try { #region Deal Requirement_Co IList <SdpSys> sdpSysList = m_ITARMSqlConnection.QueryForList <SdpSys>("SelectRequirementCoList", newCrId); if (sdpSysList != null && sdpSysList.Count > 0) { // 插到itarm_CR_List m_PMSSqlConnection.BeginTransaction(); #region Insert itarm_cr_list if (sdpSysList[0].CrId.ToString().Trim().Length > 15) { itarmCrListCoInsert.CrId = sdpSysList[0].CrId.ToString().Trim().Substring(0, 15); } else { itarmCrListCoInsert.CrId = sdpSysList[0].CrId.ToString().Trim(); } if (sdpSysList[0].CrId_co.ToString().Trim().Length > 15) { itarmCrListCoInsert.RelatedcrId = sdpSysList[0].CrId_co.ToString().Trim().Substring(0, 15); } else { itarmCrListCoInsert.RelatedcrId = sdpSysList[0].CrId_co.ToString().Trim(); } if (sdpSysList[0].CRName.ToString().Trim().Length > 500) { itarmCrListCoInsert.CrName = sdpSysList[0].CRName.ToString().Trim().Substring(0, 500); } else { itarmCrListCoInsert.CrName = sdpSysList[0].CRName.ToString().Trim(); } if (sdpSysList[0].CRName_co.ToString().Trim().Length > 100) { itarmCrListCoInsert.RelatedcrName = sdpSysList[0].CRName_co.ToString().Trim().Substring(0, 100); } else { itarmCrListCoInsert.RelatedcrName = sdpSysList[0].CRName_co.ToString().Trim(); } if (sdpSysList[0].Site.ToString().Trim().Length > 20) { itarmCrListCoInsert.RelatedSite = sdpSysList[0].Site.ToString().Trim().Substring(0, 20); } else { itarmCrListCoInsert.RelatedSite = sdpSysList[0].Site.ToString().Trim(); } itarmCrListCoInsert.Creator = creator; itarmCrListCoInsert.CreateDate = createDate; if (sdpSysList[0].SystemName.ToString().Trim().Length > 100) { itarmCrListCoInsert.System = sdpSysList[0].SystemName.ToString().Trim().Substring(0, 100); } else { itarmCrListCoInsert.System = sdpSysList[0].SystemName.ToString().Trim(); } if (sdpSysList[0].PM.ToString().Trim().Length > 100) { itarmCrListCoInsert.Pm = sdpSysList[0].PM.ToString().Trim().Substring(0, 100); } else { itarmCrListCoInsert.Pm = sdpSysList[0].PM.ToString().Trim(); } int returnInsertResult = itarmCrListBiz.InsertItarmCrListCo(itarmCrListCoInsert); if (returnInsertResult <= 0) { m_PMSSqlConnection.RollBackTransaction(); return(returnSerial); } #endregion // 并更新PMS_Itarm_Mapping #region Update PMS_ITARM_Mapping bool mappingResult = pmsItarmMappingBiz.UpdatePmsItarmMappingCrId(oldCrId, newCrId); if (mappingResult == false) { m_PMSSqlConnection.RollBackTransaction(); return(returnSerial); } #endregion m_PMSSqlConnection.CommitTransaction(); returnSerial = 1; } #endregion return(returnSerial); } catch (Exception ex) { m_Logger.Error("ItArmCrListBiz/InsertFromItarmCrCo" + ex.ToString()); return(returnSerial); } }