protected void btn_Remove_Click(object sender, EventArgs e) { #region string strResult = "", strErrMsg = ""; try { fmStatus = FormStatus.fmProcess; ALOModel.MaintainDisCRMRecord BCO = new ALOModel.MaintainDisCRMRecord(ConnectionDB); ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(txt_DisNo.Text.Trim()); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(DateTime.Now); BCO.ProcessCancelConfirm(ParameterList, out strResult, out strErrMsg, null); if (strResult == "1")//解除成功 { SLP_SLPDate4_ApproveDate.Text = ""; CheckConfirmOrRemove(); QueryData();//20091202 } else//解除失敗 { } ResultMsgLabel.Text = string.Format("{0} {1}", strResult == "1" ? "解除成功" : "解除失敗", strErrMsg); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } finally { fmStatus = FormStatus.fmBrowse; } #endregion }
private string ProcessMultiRemove(string strDisNoForAry, Int32 iProcessingAryIndex, string strUserID, string strPageTimeStamp) { #region bool bResult = false; string strDisNo = "", strNextDisNo = ""; string[] strAryDisAry = strDisNoForAry.Split(";".ToCharArray()); string strCallbackResult = ""; string strResult = "", strErrMsg = ""; string strPrefixed = "POP_DisApproveError"; try { //於執行多筆確認、解除時清空,為了於換頁時可以取得最新資料 string SessionIDName = string.Format("{0}_{1}", "ALO191_MST", strPageTimeStamp); Session[SessionIDName] = null; fmStatus = FormStatus.fmProcess; if (iProcessingAryIndex < strAryDisAry.Length) { strDisNo = strAryDisAry[iProcessingAryIndex]; ALOModel.MaintainDisCRMRecord BCO = new ALOModel.MaintainDisCRMRecord(ConnectionDB); ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(strDisNo); ParameterList.Add(strUserID); ParameterList.Add(DateTime.Now); BCO.ProcessCancelConfirm(ParameterList, out strResult, out strErrMsg, null); if (strResult == "1")//解除成功 { bResult = true; } else//解除失敗 { Session[string.Format("{0}_REMOVE_{1}", strPrefixed, strPageTimeStamp)] = strDisNo; bResult = false; } iProcessingAryIndex = iProcessingAryIndex + 1; if (iProcessingAryIndex < strAryDisAry.Length) { strNextDisNo = strAryDisAry[iProcessingAryIndex]; } else { strNextDisNo = "X";//表示已執行到最後一筆 } //0:DIS_NO字串For陣列用- //1:下一筆陣列Index- //2:執行結果- //3:錯誤訊息- //4:要關閉執行狀態的DIS_NO- //5:要開啟執行狀態的DIS_NO- //6:是否有累積執行錯誤之DIS_NO strCallbackResult = string.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}", strDisNoForAry, iProcessingAryIndex, bResult ? "OK" : "NG", string.Format("{0}", strErrMsg), strDisNo, strNextDisNo, Session[string.Format("{0}_REMOVE_{1}", strPrefixed, strPageTimeStamp)] == null ? "0" : "1" ); } } catch (Exception ex) { throw new Exception(string.Format("{0}||{1}", strDisNo, ex.Message)); } return strCallbackResult; #endregion }