protected void btnSave_Click(object sender, EventArgs e) { short iSeq = Convert.ToInt16(this.txtSeq.Text); bool bEnabled = this.chkEnabled.Checked; short iDaysFromEstClose = this.txtDaysFromEstClose.Text == string.Empty ? Int16.Parse("0") : Convert.ToInt16(this.txtDaysFromEstClose.Text); short iDaysAfterCreation = this.txtDaysAfterCreation.Text == string.Empty ? Int16.Parse("0") : Convert.ToInt16(this.txtDaysAfterCreation.Text); short iCalcMethod = 0; if (this.hdnCalcDueDateMethod.Value == "Est Close Date") { iCalcMethod = 1; } else if (this.hdnCalcDueDateMethod.Value == "Creation Date") { iCalcMethod = 2; } else if (this.hdnCalcDueDateMethod.Value == "Completion Date of the previous Stage") { iCalcMethod = 3; } Template_Workflow WorkflowTemplateManager = new Template_Workflow(); #region 检查Rule Name是否重复 bool bIsExist = WorkflowTemplateManager.IsWflStageSeqExist(this.iWorkflowTemplateID, this.iWflStageID, iSeq); if (bIsExist == true) { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Duplicate", "$('#divContainer').hide();alert('The Sequence has been taken. Please use a different number.');$('#divContainer').show();", true); return; } #endregion WorkflowTemplateManager.UpdateWflStage(this.iWflStageID, iSeq, bEnabled, iDaysFromEstClose, iDaysAfterCreation, iCalcMethod); #region update seq no of workflow task string sSeqNos = this.hdnSeqNos.Value; if (sSeqNos != string.Empty) { string[] IDSeqs = sSeqNos.Split(','); foreach (string IDSeq in IDSeqs) { string[] temp = IDSeq.Split(':'); string sTaskID = temp[0]; string sSeqNo = temp[1]; int iTaskID = Convert.ToInt32(sTaskID); int iSeqNo = Convert.ToInt32(sSeqNo); this.UpdateWflTaskSeqNo(iTaskID, iSeqNo); } } #endregion // success this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Success", "$('#divContainer').hide();alert('Update workflow stage successfully.');window.parent.location.href='" + this.sFrom + "';", true); }