U9 UI插件中獲取Btn按鈕事件

namespace UFIDA.U9.Cust.AP_PayReqBillHeadUI
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Collections.Specialized;
    using UFSoft.UBF.UI.ControlModel;
    using UFSoft.UBF.UI.WebControlAdapter;
    using UFSoft.UBF.UI.WebControls.ClientCallBack;
    using UFSoft.UBF.UI.WebControls.Association;
    using System.Web.UI.WebControls.WebParts;
    using UFSoft.UBF.UI.IView;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using UFSoft.UBF.UI.Controls;
    using UFSoft.UBF.UI.WebControls;


    using UFIDA.U9.UI.PDHelper;
    using UFIDA.U9.FI.AP.PayReqFundUIModel;
    using UFSoft.UBF.Util.DataAccess;
    using System.Data;
    using UFSoft.UBF.UI.ActionProcess;
    using UFSoft.UBF.UI.WebControls.Association.Adapter;


    public partial class PayReqFundMainUIFormWebPart : UFSoft.UBF.UI.Custom.ExtendedPartBase
    {
        
        public override void AfterInit(UFSoft.UBF.UI.IView.IPart part, EventArgs args)
        {
            this.Do_AfterInit(part, args);;
        }
        //請款明細對應應付單<br>" + ds.Tables[0].Rows[0]["DocNo"] + ",付款日期還未到提示功能
        //public override void AfterEventProcess(IPart Part, string eventName, object sender, EventArgs args)
        public override void  BeforeEventProcess(IPart Part, string eventName, object sender, EventArgs args, out bool executeDefault)


    {
            UFSoft.UBF.UI.WebControlAdapter.UFWebButton4ToolbarAdapter webButton = sender as UFSoft.UBF.UI.WebControlAdapter.UFWebButton4ToolbarAdapter;
            //保存按鈕
            if (_strongPart.Model.PayReqFundHead.FocusedRecord.DocumentType_Code == "001")
            {
                if (webButton != null && webButton.Action == "SaveClick")
                {
                    foreach (UFIDA.U9.FI.AP.PayReqFundUIModel.PayReqFundHead_PayReqFundUses_PayReqFundDetailForUIsRecord ma in _strongPart.Model.PayReqFundHead_PayReqFundUses_PayReqFundDetailForUIs.Records)
                    {
                        //PayRFDate
                        //_strongPart.Model.PayReqFundHead.FocusedRecord.PayRFDate
                        //ma.LineNum
                        //ma.APBillHead
                        string sql = "select top 1 head.ID,head.DocNo,lin.Maturity from AP_APBillHead head ";
                        sql += " left join AP_APBillLine lin on head.ID=lin.APBillHead ";
                        sql += " where head.ID='" + ma.APBillHead + "' ";
                        sql += " group by head.ID,head.DocNo,lin.Maturity";
                        DataSet ds = new DataSet();
                        DataAccessor.RunSQL(DataAccessor.GetConn(), sql, null, out ds);
                        if (_strongPart.Model.PayReqFundHead.FocusedRecord.PayRFDate < Convert.ToDateTime(ds.Tables[0].Rows[0]["Maturity"]))
                        {
                                                            //顯示提示窗口   
                            if (((UFIDA.U9.FI.AP.PayReqFundUIModel.PayReqFundMainUIFormWebPart)_strongPart).CurrentState["PuOrderID"] == null)
                            {
                                //throw new Exception("提示:該應付單付款日期還未到是否繼續請款!");
                                NameValueCollection name = new NameValueCollection();
                                name.Add("Meno", "請款明細對應應付單<br>" + ds.Tables[0].Rows[0]["DocNo"] + ",付款日期還未到!");
                                this._strongPart.ShowAtlasModalDialog(webButton, "23171438-9c2f-439f-8623-5951c4331c61", "應付單付款日期未到提示!", "300", "180", "" + _strongPart.Model.PayReqFundHead.FocusedRecord.ID + "", name, false, false, false);
                                executeDefault = false;  //把按鈕事件變爲不繼續執行
                                return;
                            }
                                    
                        }
                    }
                }
            }


  base.BeforeEventProcess(Part, eventName, sender, args, out executeDefault);
}


        public override void AfterEventProcess(IPart Part, string eventName, object sender, EventArgs args)
        {
            UFSoft.UBF.UI.WebControlAdapter.UFWebButton4ToolbarAdapter webButton = sender as UFSoft.UBF.UI.WebControlAdapter.UFWebButton4ToolbarAdapter;
            //保存按鈕
            if (webButton != null && webButton.Action == "SaveClick")
            {
                if (_strongPart.CurrentState["PuOrderID"] != null)
                {
                    _strongPart.CurrentState["PuOrderID"] = null;
                    _strongPart.CurrentState["Closes"] = null;
                    return;
                    //_strongPart.BtnSubmit_Click(sender, args);


                    //  _strongPart.BtnRevocate_Click(sender, args);//收回事件
                }
            }
            base.AfterEventProcess(Part, eventName, sender, args);
        }
    }
}
發佈了23 篇原創文章 · 獲贊 14 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章