⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 onlinepaysettings.ascx.cs

📁 如果不使用IIS,请先运行 XSP.exe,待提示已侦听 8080端口后
💻 CS
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using DNNLite.Entites.Modules;
using DNNLite.Comm;
using System.Collections.Generic;
using DNNLite.Entites.Tab;

public partial class admin_Portal_PortalSettings_OnlinePaySettings : PortalModuleBase 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            FillPageList(dplOnlinePayPage);

            Configuration cfg = ConfigurationManager.OpenExeConfiguration(Server.MapPath("~/web.config"));

            txtchinabankMd5.Text = cfg.AppSettings.Settings["chinabankmd5"].Value ;
            txtchinabankmid.Text = cfg.AppSettings.Settings["chinabankmid"].Value ;
            txtchinabankrecvurl.Text = cfg.AppSettings.Settings["chinabankrecvurl"].Value ;

            txtMd5PayKey.Text =
                cfg.AppSettings.Settings["md5paykey"].Value;
            txtMd5PayMid.Text = 
                cfg.AppSettings.Settings["md5paymid"].Value;
            txtMd5PayReturnUrl.Text =
                cfg.AppSettings.Settings["md5payrecvurl"].Value;


            dplOnlinePayPage.SelectedValue = cfg.AppSettings.Settings["onlinepayindex"].Value;

        }
    }
    private void FillPageList(DropDownList dpllist)
    {
        dpllist.Items.Add(new ListItem("<没有设置>", "0"));
        IList<TabInfo> tabs = TabInfoController.GetTabs(true, false, true);
        foreach (TabInfo t in tabs)
        {

            ListItem itm = new ListItem("".PadLeft(t.Level * 3, '.') + t.TabName + "    " + t.Title, t.TabId.ToString());
            dpllist.Items.Add(itm);

        }
    }

    

    protected void btnCancelchinabank_Click(object sender, EventArgs e)
    {
        Response.Redirect(EditUrl());
    }
    protected void btnSaveChinabank_Click(object sender, EventArgs e)
    {
        
        Configuration cfg = ConfigurationManager.OpenExeConfiguration( Server.MapPath("~/web.config") );

        cfg.AppSettings.Settings.Remove("onlinepayindex");
        cfg.AppSettings.Settings.Add("onlinepayindex", dplOnlinePayPage.SelectedValue  );

        cfg.AppSettings.Settings.Remove("chinabankmd5");
        cfg.AppSettings.Settings.Remove("chinabankmid");
        cfg.AppSettings.Settings.Remove("chinabankrecvurl");
        
        cfg.AppSettings.Settings.Add("chinabankmd5", txtchinabankMd5.Text) ;
        cfg.AppSettings.Settings.Add("chinabankmid",txtchinabankmid.Text) ;
        cfg.AppSettings.Settings.Add("chinabankrecvurl",txtchinabankrecvurl.Text)  ;


        cfg.AppSettings.Settings.Remove("md5paykey");
        cfg.AppSettings.Settings.Remove("md5paymid");
        cfg.AppSettings.Settings.Remove("md5payrecvurl");

        cfg.AppSettings.Settings.Add("md5paykey", txtMd5PayKey.Text);
        cfg.AppSettings.Settings.Add("md5paymid", txtMd5PayMid.Text);
        cfg.AppSettings.Settings.Add("md5payrecvurl", txtMd5PayReturnUrl.Text);
        


        // Save the configuration file.
        cfg.Save(ConfigurationSaveMode.Modified);

        // Force a reload of the changed section.
        ConfigurationManager.RefreshSection("appSettings");

    }
    
    

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -