近日.NET C#編碼感悟

wisdomone1發表於2011-12-30
 
    金融軟體系統的安全性是很重要的.近應客戶及公司領導方的設計思路.對TCBS所有相關與交易的UI介面進行了改造,以期實現全方位監管使用者登陸及操作金融資訊系統的功能.便於後期金融銀行相關工作的開展.

摘舉編寫修改的TCBS部分程式碼如下述

 系統日切介面,下個工作日命令按鈕處理事件

private void btnNextBussDay_Click(object sender, EventArgs e)
        {
            Cursor currCursor = Cursor.Current;
            try
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    this.calPostDt.SelectedDate = new DateTime?(this._nextPostDate);
                    this.txtChCaryDt.Value = this._nextCarryOverDate.ToString(FI.DateFormat);
                    this.CheckStateChange("NextBusReadOnly", EventArgs.Empty);
                    BankOptionValueObj bankOptionValueObj = this.cmbSysSts.SelectedItem as BankOptionValueObj;

                    //////20111229 zxy 星期四 新增 (jx設計的特殊交易及非金融性交易相關處理邏輯) IF用於處理系統處理BATCH批處理狀態
                    if (bankOptionValueObj.BankOptionValue != "ONLINE")
                    {
                        this.cmbSysSts.DataSource = null;

                        
                         ///20111229 zxy 星期四 新增 (jx設計的特殊交易及非金融性交易相關處理邏輯)
                        BankOptionValueObjCollection.SetParameters("XGGR", "日切下個工作日", long.MinValue, null, null, null, "INQ", null);
                        BankOptionValueObjCollection bankOptionValueObjCol = BankOptionValueObjCollection.GetBankOptionValueObjCollection("SS", new object[] { BankOptionValueObjFetch.Basic });
                       



                        this.cmbSysSts.DataBinding(bankOptionValueObjCol, "BankOptionValueDesc", "BANKOPTIONVALUE");
                        int index = 0;
                        foreach (BankOptionValueObj bankOps in this.cmbSysSts.Items)
                        {
                            if (bankOps.BankOptionValue == "ONLINE")
                            {
                                break;
                            }
                            index++;
                        }
                        this.cmbSysSts.SelectedIndex = index;
                    }
                }
                catch (Exception excp)
                {
                    base.ShowDetailException(excp);
                }
            }
            finally
            {
                Cursor.Current = currCursor;
            }
        }

上述介面呼叫之BO相關程式碼
protected override void Director_Fetch(object criteria)
        {
            try
            {
                using (DataAccessManager dam = new DataAccessManager())
                {
                    this.SvrFetch(dam, criteria);
                    
                    ///20111230 zxy 星期五 新增 (jx設計的特殊交易及非金融性交易相關處理邏輯)
                    if (_txnTypCd != null)
                    {
                        NmonTxn.SvrGetNmonTxn(dam, _txnTypCd, _txnNote, _relPersNbr, long.MinValue, _relMediumId, _mediaAcctSeqNo, _relAcctNbr, long.MinValue, _dataBaseActvCd, _apprHistColl, new object[] { });
                    }
                 }
            }
            catch (DataAccessException excp)
            {
                throw new CoreBusinessException(99999L, excp, "Exception occurred while attempting a {0} fetch. Key: {1}", new string[] { "BankOptionValueObjCollection", ((Criteria) criteria).Key });
            }
        }

        ///20111230 zxy 星期五 新增 (jx設計的特殊交易及非金融性交易相關處理邏輯)
        public static void SetParameters(string txnTypCd, string txnNote, long relPersNbr, string relMediumId, string mediaAcctSeqNo, string relAcctNbr, string dataBaseActvCd, ApprHistCollection apprHistColl)
        {
            _txnTypCd = txnTypCd;
            _txnNote = txnNote;
            _mediaAcctSeqNo = mediaAcctSeqNo;
            _relPersNbr = relPersNbr;
            _relMediumId = relMediumId;
            _relAcctNbr = relAcctNbr;
            _dataBaseActvCd = dataBaseActvCd;
            _apprHistColl = apprHistColl;
        }



小結

 某些BO由眾多UI介面呼叫,在修改前一定要想法弄清哪些介面呼叫它,
方可實施對其BO的修改

TCBS bo的程式碼處理邏輯要梳理清晰

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

相關文章