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

📄 backuprestoremanage.cs

📁 c#编写的汽车销售公司erp进销存系统
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using CallCenter.BusinessLayer;

namespace CallCenter.BusinessInterfaces.MainForms
{
	/// <summary>
	/// BackupRestoreManage 的摘要说明。
	/// </summary>
	public class BackupRestoreManage : System.Windows.Forms.UserControl
	{
		private DevExpress.XtraEditors.PanelControl panelControl1;
		private DevExpress.XtraEditors.TextEdit textEdit1;
		private DevExpress.XtraEditors.TextEdit textEdit2;
		private DevExpress.XtraEditors.SimpleButton simpleButton1;
		private DevExpress.XtraEditors.SimpleButton simpleButton2;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private DevExpress.XtraEditors.SimpleButton simpleButton3;
		private DevExpress.XtraEditors.SimpleButton simpleButton4;
		private System.Windows.Forms.SaveFileDialog saveFileDialog1;
		private System.Windows.Forms.OpenFileDialog openFileDialog1;
		/// <summary> 
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public BackupRestoreManage()
		{
			// 该调用是 Windows.Forms 窗体设计器所必需的。
			InitializeComponent();

			// TODO: 在 InitializeComponent 调用后添加任何初始化

		}

		/// <summary> 
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region 组件设计器生成的代码
		/// <summary> 
		/// 设计器支持所需的方法 - 不要使用代码编辑器 
		/// 修改此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.panelControl1 = new DevExpress.XtraEditors.PanelControl();
			this.simpleButton4 = new DevExpress.XtraEditors.SimpleButton();
			this.simpleButton3 = new DevExpress.XtraEditors.SimpleButton();
			this.label2 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.simpleButton2 = new DevExpress.XtraEditors.SimpleButton();
			this.simpleButton1 = new DevExpress.XtraEditors.SimpleButton();
			this.textEdit2 = new DevExpress.XtraEditors.TextEdit();
			this.textEdit1 = new DevExpress.XtraEditors.TextEdit();
			this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
			this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
			((System.ComponentModel.ISupportInitialize)(this.panelControl1)).BeginInit();
			this.panelControl1.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.textEdit2.Properties)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).BeginInit();
			this.SuspendLayout();
			// 
			// panelControl1
			// 
			this.panelControl1.Controls.Add(this.simpleButton4);
			this.panelControl1.Controls.Add(this.simpleButton3);
			this.panelControl1.Controls.Add(this.label2);
			this.panelControl1.Controls.Add(this.label1);
			this.panelControl1.Controls.Add(this.simpleButton2);
			this.panelControl1.Controls.Add(this.simpleButton1);
			this.panelControl1.Controls.Add(this.textEdit2);
			this.panelControl1.Controls.Add(this.textEdit1);
			this.panelControl1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.panelControl1.Location = new System.Drawing.Point(0, 0);
			this.panelControl1.Name = "panelControl1";
			this.panelControl1.Size = new System.Drawing.Size(656, 360);
			this.panelControl1.TabIndex = 0;
			this.panelControl1.Text = "panelControl1";
			// 
			// simpleButton4
			// 
			this.simpleButton4.Location = new System.Drawing.Point(496, 88);
			this.simpleButton4.Name = "simpleButton4";
			this.simpleButton4.Size = new System.Drawing.Size(32, 23);
			this.simpleButton4.TabIndex = 7;
			this.simpleButton4.Text = "...";
			this.simpleButton4.Click += new System.EventHandler(this.simpleButton4_Click);
			// 
			// simpleButton3
			// 
			this.simpleButton3.Location = new System.Drawing.Point(496, 48);
			this.simpleButton3.Name = "simpleButton3";
			this.simpleButton3.Size = new System.Drawing.Size(32, 23);
			this.simpleButton3.TabIndex = 6;
			this.simpleButton3.Text = "...";
			this.simpleButton3.Click += new System.EventHandler(this.simpleButton3_Click);
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(8, 88);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(80, 23);
			this.label2.TabIndex = 5;
			this.label2.Text = "恢复路径";
			this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 48);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(80, 23);
			this.label1.TabIndex = 4;
			this.label1.Text = "备份路径";
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// simpleButton2
			// 
			this.simpleButton2.Location = new System.Drawing.Point(544, 88);
			this.simpleButton2.Name = "simpleButton2";
			this.simpleButton2.TabIndex = 3;
			this.simpleButton2.Text = "恢复数据库";
			this.simpleButton2.Click += new System.EventHandler(this.simpleButton2_Click);
			// 
			// simpleButton1
			// 
			this.simpleButton1.Location = new System.Drawing.Point(544, 48);
			this.simpleButton1.Name = "simpleButton1";
			this.simpleButton1.TabIndex = 2;
			this.simpleButton1.Text = "备份数据库";
			this.simpleButton1.Click += new System.EventHandler(this.simpleButton1_Click);
			// 
			// textEdit2
			// 
			this.textEdit2.EditValue = "";
			this.textEdit2.Location = new System.Drawing.Point(96, 88);
			this.textEdit2.Name = "textEdit2";
			// 
			// textEdit2.Properties
			// 
			this.textEdit2.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
			this.textEdit2.Size = new System.Drawing.Size(400, 21);
			this.textEdit2.TabIndex = 1;
			// 
			// textEdit1
			// 
			this.textEdit1.EditValue = "";
			this.textEdit1.Location = new System.Drawing.Point(96, 48);
			this.textEdit1.Name = "textEdit1";
			// 
			// textEdit1.Properties
			// 
			this.textEdit1.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
			this.textEdit1.Size = new System.Drawing.Size(400, 21);
			this.textEdit1.TabIndex = 0;
			// 
			// BackupRestoreManage
			// 
			this.Controls.Add(this.panelControl1);
			this.Name = "BackupRestoreManage";
			this.Size = new System.Drawing.Size(656, 360);
			((System.ComponentModel.ISupportInitialize)(this.panelControl1)).EndInit();
			this.panelControl1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.textEdit2.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void simpleButton3_Click(object sender, System.EventArgs e)
		{
			try
			{
				this.saveFileDialog1.Filter="所有文件(*.bak)|*.bak";
				this.saveFileDialog1.Title="备份文件";
				DialogResult dresult=this.saveFileDialog1.ShowDialog();
				if(dresult==DialogResult.OK)
				{
					this.textEdit1.Text=this.saveFileDialog1.FileName;
					
				}
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}

		private void simpleButton1_Click(object sender, System.EventArgs e)
		{
			try
			{
				SysoperatorBLL sbll=new SysoperatorBLL();
				sbll.BackupDatabase(this.textEdit1.Text);
				MessageBox.Show("备份成功");
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}

		private void simpleButton4_Click(object sender, System.EventArgs e)
		{
			try
			{
				this.openFileDialog1.Filter="所有文件(*.bak)|*.bak";
				this.openFileDialog1.Title="恢复文件";
				DialogResult dresult=this.openFileDialog1.ShowDialog();
				if(dresult==DialogResult.OK)
				{
					this.textEdit2.Text=this.openFileDialog1.FileName;
					
				}
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}

		private void simpleButton2_Click(object sender, System.EventArgs e)
		{
			try
			{
				SysoperatorBLL sbll=new SysoperatorBLL();
				sbll.RestoreDatabase(this.textEdit2.Text);
				MessageBox.Show("恢复成功");
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}
	}
}

⌨️ 快捷键说明

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