ZhiYeJianKang_PeiXun/Song.Site/Manage/Sys/DataBaseBackup_Edit.aspx.cs

98 lines
2.8 KiB
C#
Raw Normal View History

2025-02-20 15:41:53 +08:00
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;
using System.IO;
using WeiSha.Common;
using Song.ServiceInterfaces;
using Song.Entities;
namespace Song.Site.Manage.Sys
{
public partial class DataBaseBackup_Edit : Extend.CustomPage
{
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
private string backfile = WeiSha.Common.Request.QueryString["id"].Decrypt().String ?? "";
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
full();
}
}
private void full()
{
try
{
if (backfile != String.Empty)
{
FileInfo file = new FileInfo(backfile);
//<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
this.tbName.Text = file.Name.Substring(0, file.Name.LastIndexOf('.'));
//<2F>ļ<EFBFBD><C4BC><EFBFBD>С
lbSize.Text = (file.Length / 1024).ToString() + " Kb";
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
lbTime.Text = file.CreationTime.ToString();
}
}
catch (Exception ex)
{
Message.ExceptionShow(ex);
}
}
/// <summary>
/// <20>޸<EFBFBD>
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnEnter_Click(object sender, EventArgs e)
{
try
{
FileInfo file = new FileInfo(backfile);
//<2F><><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
string path = file.FullName;
path = path.Substring(0, path.LastIndexOf('\\') + 1);
//<2F><>׺<EFBFBD><D7BA>
string ext = file.Extension.ToLower();
if (ext == "backup" || ext == "bak")
{
//Ŀ<><C4BF><EFBFBD>ļ<EFBFBD>
string newBack = path + tbName.Text + ext;
file.MoveTo(newBack);
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//this.Response.Redirect("DataBaseBackup_Edit.aspx?id=" + Server.UrlEncode(newBack));
Master.AlertCloseAndRefresh("<22><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>");
}
catch (Exception ex)
{
Message.ExceptionShow(ex);
}
}
/// <summary>
/// ɾ<><C9BE><EFBFBD>¼<EFBFBD>
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnDelete_Click(object sender, EventArgs e)
{
//Business.Do<IPosition>().Delete(id);
//Master.AlertAndClose("<22>ɹ<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>");
}
}
}