protected PmsItarmMapping getPmsItarmMapping(string creator, DateTime createDate, string pmsID, string crID) { PmsItarmMapping pmsItarmMapping = new PmsItarmMapping(); pmsItarmMapping.Creator = creator; pmsItarmMapping.CreateDate = createDate; pmsItarmMapping.PmsId = pmsID; pmsItarmMapping.CrId = crID; return(pmsItarmMapping); }
//end add public int DeletePmsItarmMapping(PmsItarmMapping pmsItarmMapping) { int returnSerial = 0; try { returnSerial = m_PMSSqlConnection.Delete("DeletePmsItarmMapping", pmsItarmMapping); } catch (Exception ex) { m_Logger.Error("PmsItarmMappingBiz/DeletePmsItarmMapping" + ex.Message.ToString()); } return(returnSerial); }
public int InsertPmsItarmMapping(PmsItarmMapping pmsItarmMapping) { int returnSerial = 0; try { object objResult = m_PMSSqlConnection.Insert("InsertPmsItarmMapping", pmsItarmMapping); returnSerial = 1; } catch (Exception ex) { m_Logger.Error("PmsItarmMappingBiz/InsertPmsItarmMapping" + ex.Message.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!"); } }