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

📄 downservers.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
字号:
namespace PowerEasy.WebSite.Admin.Accessories
{
    using PowerEasy.Accessories;
    using PowerEasy.Common;
    using PowerEasy.Controls;
    using PowerEasy.Model.Accessories;
    using PowerEasy.Web.UI;
    using System;
    using System.Web.UI.WebControls;

    public class DownServers : AdminPage
    {
        protected AlternateLiteral AltrTitle;
        protected DropDownList DropShowType;
        protected Button EBtnSubmit;
        protected ExtendedSiteMapPath SmpNavigator;
        protected TextBox TxtServerLogo;
        protected TextBox TxtServerName;
        protected TextBox TxtServerUrl;
        protected PowerEasy.Controls.RequiredFieldValidator ValrServerName;
        protected PowerEasy.Controls.RequiredFieldValidator ValrServerUrl;

        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            if (this.Page.IsValid)
            {
                DownServerInfo downServerInfo = new DownServerInfo();
                downServerInfo.ServerId = BasePage.RequestInt32("ServerID");
                downServerInfo.ServerName = this.TxtServerName.Text;
                downServerInfo.ServerLogo = this.TxtServerLogo.Text;
                if (DataValidator.IsUrl(this.TxtServerUrl.Text))
                {
                    downServerInfo.ServerUrl = new Uri(this.TxtServerUrl.Text);
                }
                else
                {
                    AdminPage.WriteErrMsg("<li>对不起,请输入正确格式的下载服务器地址!</li>", "DownServer.aspx");
                }
                downServerInfo.ShowType = DataConverter.CLng(this.DropShowType.SelectedValue);
                bool flag = false;
                string str2 = BasePage.RequestString("Action", "Add");
                if (str2 != null)
                {
                    if (!(str2 == "Add"))
                    {
                        if (str2 == "Modify")
                        {
                            flag = DownServer.Update(downServerInfo);
                        }
                    }
                    else
                    {
                        flag = DownServer.Add(downServerInfo);
                    }
                }
                if (flag)
                {
                    AdminPage.WriteSuccessMsg("<li>已经成功保存下载服务器信息!</li>", "DownServerManage.aspx");
                }
                else
                {
                    AdminPage.WriteErrMsg("<li>下载服务器信息保存失败!</li>", "DownServerManage.aspx");
                }
            }
        }

        private void InitData(int serverId)
        {
            if (serverId > 0)
            {
                DownServerInfo downServerById = DownServer.GetDownServerById(serverId, true);
                this.TxtServerName.Text = downServerById.ServerName;
                this.TxtServerLogo.Text = downServerById.ServerLogo;
                this.TxtServerUrl.Text = downServerById.ServerUrl.ToString();
                this.DropShowType.SelectedValue = downServerById.ShowType.ToString();
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                int serverId = BasePage.RequestInt32("ServerID");
                if (BasePage.RequestString("Action", "Add") == "Modify")
                {
                    this.InitData(serverId);
                }
            }
        }
    }
}

⌨️ 快捷键说明

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