📄 managesystem.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Admin_ManageSystem : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
BindData();
}
private void BindData()
{
tbxCopyRight.Text = Application["CopyRight"].ToString();
if (Application["Logo"].ToString() == "")
hlnkLogo.Text = @"暂时没有上传Logo";
else
hlnkLogo.NavigateUrl = @"~/image/" + (string)Application["Logo"];
}
protected void btnConfirm_Click(object sender, EventArgs e)
{
eSystemSetting esys = new eSystemSetting();
esys.SettingKey = @"CopyRight";
esys.SettingValue = tbxCopyRight.Text;
if (esys.GetValueByKey() == "")
esys.AddSetting();
else
esys.SetValueByKey();
Application["CopyRight"] = tbxCopyRight.Text;
if (fuldLogo.HasFile)
{
esys.SettingKey = @"Logo";
esys.SettingValue = uploadFile(esys.GetValueByKey());
if (esys.GetValueByKey() == "")
esys.AddSetting();
else
esys.SetValueByKey();
Application["Logo"] = esys.SettingValue;
}
Server.Transfer("ManageSystem.aspx");
}
/// <summary>
/// 上传图标文件
/// </summary>
/// <returns>图标的URL</returns>
private string uploadFile(string strOldValue)
{
string physicalPath = Application["PhysicalPath"].ToString();
if (strOldValue != "")
{
string oldFile = physicalPath + @"\image\" + strOldValue;
if (System.IO.File.Exists(oldFile))
System.IO.File.Delete(oldFile);
}
string returnFile = DateTime.Now.ToString("yyyyMMddhhmmss") +
DateTime.Now.Millisecond.ToString() +
System.IO.Path.GetExtension(fuldLogo.FileName);
string newFile = physicalPath+ @"\image\"+returnFile;
fuldLogo.SaveAs(newFile);
return returnFile;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -