///判斷是否為該廠商結算日 //ParameterList:string UserID,string PurchaseNo,string Item,string Period ,string VirtualCode //商品Item = VirtualCode public bool ClosePurchaseOrderDetail(ArrayList ParameterList, DbTransaction RootDBT) { bool IsRootTranscation = false; try { string UserID = ParameterList[0].ToString(); string PurchaseNo = ParameterList[1].ToString(); string Item = ParameterList[2].ToString(); string Period = ParameterList[3].ToString(); string VirtualCode = ParameterList[4].ToString(); ArrayList SQLParameters = new ArrayList(); SQLParameters.Clear(); SQLParameters.Add(PurchaseNo); SQLParameters.Add(Item); SQLParameters.Add(Period); SQLParameters.Add(VirtualCode); DataRow dr = GetPurchaseOrderDetail(SQLParameters); //判斷是否有傳入Root Transcation IsRootTranscation = (RootDBT == null) ? true : false; #region 啟動交易或指定RootTranscation if (IsRootTranscation) { //獨立呼叫啟動Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion PURDBO.MaintainPurchaseOrder dbo = new PURDBO.MaintainPurchaseOrder(strConn); SQLParameters.Clear(); SQLParameters.Add(UserID); SQLParameters.Add("A"); dbo.ClosePurchaseOrderDetail(SQLParameters, dr, DBT); return true; } catch (Exception ex) { #region 交易失敗 if (IsRootTranscation) { //獨立呼叫Transcation失敗 DBT.Rollback(); } #endregion throw ex; } }