首页 > 其他分享 >SM260331btnQD

SM260331btnQD

时间:2025-01-05 18:43:56浏览次数:1  
标签:string id CPDLMXID ClientScript SM260331btnQD msg page

using System;
using Salien.Utility.SUWF;
using Salien.Utility;
using ClsPub;

namespace SM260331btnQD
{
    public class SM260331btnQD : ISuwfBus
    {
        private SlnSuwfPage _page;
        public void Initial(SlnSuwfPage page)
        {
            this._page = page;
            PUB.BindButtonEvent(_page, "btnQD", new EventHandler(BtnQD_Click));
        }

        #region 点击“确定”事件
        private void BtnQD_Click(object sender, EventArgs e)
        {
            string strPK = _page.GetRowDataPrimaryKeys();

            if (string.IsNullOrEmpty(strPK))
            {
                _page.ClientScript.RegisterStartupScript(this.GetType(), "mfscript1", "<script>alert('请选择网格数据');</script>");
                return;
            }
            string CPDLMXID = _page.GetValueByName("CPDLMXID");
            if (SlnString.IsNull(CPDLMXID))
            {
                _page.ClientScript.RegisterStartupScript(this.GetType(), "mfscript1", "<script>alert('CPDLMXID为空');</script>");
                return;
            }
            string sql = "insert into SM_ZP_CPGX_CPDLMX_TB(ID, CPGXID, CPDLMXID)";
            sql = sql + "select seqSM_ZP_CPGX_CPDLMX.nextval,id," + CPDLMXID + " from SM_ZP_CPGX_TB where id in (" + strPK + ")";
            _page.GetValueByName("sys_userid");
            try
            {
                string msg = SlnDataAccess.ExecuteSQL(sql);
                if (msg == "")
                {
                    msg = "添加成功";
                    SlnDataAccess.ExecuteSQL($@"insert into sm_zp_cpgxczxq_tb(id, cpdlmxid, cpgxid, czrq, czrid, djlx)
                            select sm_zp_cpgxczxq.nextval,{CPDLMXID},id,sysdate,{_page.GetValueByName("sys_userid")},0
                            from SM_ZP_CPGX_TB where id in (" + strPK + ")");
                   // RDIFramework.Utilities.LogHelper.WriteLog(new Exception(sql));
                    CloseWindow(_page);
                    this._page.ShowMessage(msg);
                }
                else
                {
                    msg = "添加失败[" + msg + "]";
                    this._page.ShowMessage(msg);
                }
                /*  string strJS = "<script>window.parent.opener.location.href=window.parent.opener.location.href;closeWin();</script>";
                _page.ClientScript.RegisterStartupScript(_page.ClientScript.GetType(), "yylscript", strJS);
                _page.ShowMessage("执行成功");*/

                return;
            }
            catch (Exception ex)
            {
                _page.ShowMessage(ex.Message);
            }
        }
        #endregion 生成交付单按钮

        /// <summary>
        /// 关闭页面并刷新父页面
        /// </summary>
        public void CloseWindow(SlnSuwfPage _page)
        {
            string strjs = @"<script>
                                var pWin = getParentWin();
                               pWin.document.all.btnQuery.click();
                               closeWin();
                               </script>";
            _page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ButtonClickScript", strjs);
        }
    }
}

 

标签:string,id,CPDLMXID,ClientScript,SM260331btnQD,msg,page
From: https://www.cnblogs.com/nuaaydh/p/18653721

相关文章