c#之tcbs method方法示例

wisdomone1發表於2011-09-17
2011年9月17日 星期六 14時49分

private bool AccountStatusValidation(string[] statusCode, bool validStatus, Acct acct)
        {

             //判斷方法引數statuscode是否為空
            if (statusCode != null)
            {
                for (int i = 0; i < statusCode.Length; i++)
                {
                      //二支判斷
                    if (statusCode[i] == acct.CurrAcctStatCd)
                    {
                          //三支判斷 如果方法引數為true
                        if (validStatus)
                        {
                            return true;//此方法返回true
                        }
                        //CoreMessageBox.Show(MessageBoxOption.Error, 99999L, "This account has a status of {0} and is not valid for this transaction.", new object[] { AcctStat.All[acct.CurrAcctStatCd].AcctStatDesc });
                      
                        CoreMessageBox.Show(MessageBoxOption.Error, 99999L, "賬戶當前的狀態為【{0}】,不允許執行此交易。", new object[] { AcctStat.All[acct.CurrAcctStatCd].AcctStatDesc });
                        return false;//如果方法引數validstatus為false,此方法返回false
                    }
                }
                if (validStatus)
                {
                    //CoreMessageBox.Show(MessageBoxOption.Error, 99999L, "This account has a status of {0} and is not valid for this transaction.", new object[] { AcctStat.All[acct.CurrAcctStatCd].AcctStatDesc });
                    CoreMessageBox.Show(MessageBoxOption.Error, 99999L, "賬戶當前的狀態為【{0}】,不允許執行此交易", new object[] { AcctStat.All[acct.CurrAcctStatCd].AcctStatDesc });
                    return false;
                }
            }
            return true;
        }

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-707780/,如需轉載,請註明出處,否則將追究法律責任。

相關文章