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

📄 overwritebaseform.cs

📁 一个通用的数据库访问层
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace YariSoft.DBUtil
{
	public class OverwriteBaseForm : System.Windows.Forms.Form
	{
		#region Protected variables
		protected YariSoft.DBUtil.RowOperation result = YariSoft.DBUtil.RowOperation.RO_None;
		protected System.Windows.Forms.Button overwriteButtonAll;
		protected System.Windows.Forms.Button overwriteButton;
		protected System.Windows.Forms.DataGrid dataGrid;
		protected System.Windows.Forms.Label infoLabel;
		#endregion

		#region Local variables
		private System.Windows.Forms.Button cancelButton;
		private System.Windows.Forms.Button skipButtonAll;
		private System.Windows.Forms.Button skipButton;
		private System.Windows.Forms.Panel buttonPanel;
		protected System.Windows.Forms.Label infoLabel2;
		private System.ComponentModel.Container components = null;
		#endregion

		#region Constructor/Destructor
		public OverwriteBaseForm()
		{
			InitializeComponent();
		}

		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}
		#endregion

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.buttonPanel = new System.Windows.Forms.Panel();
			this.cancelButton = new System.Windows.Forms.Button();
			this.skipButtonAll = new System.Windows.Forms.Button();
			this.skipButton = new System.Windows.Forms.Button();
			this.overwriteButtonAll = new System.Windows.Forms.Button();
			this.overwriteButton = new System.Windows.Forms.Button();
			this.dataGrid = new System.Windows.Forms.DataGrid();
			this.infoLabel = new System.Windows.Forms.Label();
			this.infoLabel2 = new System.Windows.Forms.Label();
			this.buttonPanel.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid)).BeginInit();
			this.SuspendLayout();
			// 
			// buttonPanel
			// 
			this.buttonPanel.Controls.AddRange(new System.Windows.Forms.Control[] {
																					  this.cancelButton,
																					  this.skipButtonAll,
																					  this.skipButton,
																					  this.overwriteButtonAll,
																					  this.overwriteButton});
			this.buttonPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.buttonPanel.Location = new System.Drawing.Point(0, 261);
			this.buttonPanel.Name = "buttonPanel";
			this.buttonPanel.Size = new System.Drawing.Size(454, 40);
			this.buttonPanel.TabIndex = 5;
			// 
			// cancelButton
			// 
			this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.cancelButton.Location = new System.Drawing.Point(360, 8);
			this.cancelButton.Name = "cancelButton";
			this.cancelButton.Size = new System.Drawing.Size(85, 25);
			this.cancelButton.TabIndex = 4;
			this.cancelButton.Text = "&Cancel";
			this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
			// 
			// skipButtonAll
			// 
			this.skipButtonAll.Location = new System.Drawing.Point(272, 8);
			this.skipButtonAll.Name = "skipButtonAll";
			this.skipButtonAll.Size = new System.Drawing.Size(85, 25);
			this.skipButtonAll.TabIndex = 3;
			this.skipButtonAll.Text = "S&kip All";
			this.skipButtonAll.Click += new System.EventHandler(this.skipButtonAll_Click);
			// 
			// skipButton
			// 
			this.skipButton.Location = new System.Drawing.Point(184, 8);
			this.skipButton.Name = "skipButton";
			this.skipButton.Size = new System.Drawing.Size(85, 25);
			this.skipButton.TabIndex = 2;
			this.skipButton.Text = "&Skip";
			this.skipButton.Click += new System.EventHandler(this.skipButton_Click);
			// 
			// overwriteButtonAll
			// 
			this.overwriteButtonAll.Location = new System.Drawing.Point(96, 8);
			this.overwriteButtonAll.Name = "overwriteButtonAll";
			this.overwriteButtonAll.Size = new System.Drawing.Size(85, 25);
			this.overwriteButtonAll.TabIndex = 1;
			this.overwriteButtonAll.Text = "Overwrite &All";
			this.overwriteButtonAll.Click += new System.EventHandler(this.overwriteButtonAll_Click);
			// 
			// overwriteButton
			// 
			this.overwriteButton.Location = new System.Drawing.Point(8, 8);
			this.overwriteButton.Name = "overwriteButton";
			this.overwriteButton.Size = new System.Drawing.Size(85, 25);
			this.overwriteButton.TabIndex = 0;
			this.overwriteButton.Text = "&Overwrite";
			this.overwriteButton.Click += new System.EventHandler(this.overwriteButton_Click);
			// 
			// dataGrid
			// 
			this.dataGrid.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.dataGrid.CaptionVisible = false;
			this.dataGrid.DataMember = "";
			this.dataGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dataGrid.Location = new System.Drawing.Point(7, 40);
			this.dataGrid.Name = "dataGrid";
			this.dataGrid.RowHeaderWidth = 0;
			this.dataGrid.Size = new System.Drawing.Size(440, 216);
			this.dataGrid.TabIndex = 6;
			this.dataGrid.TabStop = false;
			// 
			// infoLabel
			// 
			this.infoLabel.AutoSize = true;
			this.infoLabel.Location = new System.Drawing.Point(8, 8);
			this.infoLabel.Name = "infoLabel";
			this.infoLabel.Size = new System.Drawing.Size(267, 13);
			this.infoLabel.TabIndex = 7;
			this.infoLabel.Text = "This table already contains a row with selected keys.";
			// 
			// infoLabel2
			// 
			this.infoLabel2.AutoSize = true;
			this.infoLabel2.Location = new System.Drawing.Point(8, 24);
			this.infoLabel2.Name = "infoLabel2";
			this.infoLabel2.Size = new System.Drawing.Size(187, 13);
			this.infoLabel2.TabIndex = 8;
			this.infoLabel2.Text = "Would you like replace existing row?";
			// 
			// OverwriteBaseForm
			// 
			this.AcceptButton = this.overwriteButton;
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.CancelButton = this.cancelButton;
			this.ClientSize = new System.Drawing.Size(454, 301);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.infoLabel2,
																		  this.infoLabel,
																		  this.dataGrid,
																		  this.buttonPanel});
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "OverwriteBaseForm";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "Overwrite";
			this.buttonPanel.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion
	
		#region Private functions
		private void cancelButton_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void overwriteButton_Click(object sender, System.EventArgs e)
		{
			this.result = YariSoft.DBUtil.RowOperation.RO_Overwrite;
			this.Close();
		}

		private void overwriteButtonAll_Click(object sender, System.EventArgs e)
		{
			this.result = YariSoft.DBUtil.RowOperation.RO_Overwrite_All;
			this.Close();
		}

		private void skipButton_Click(object sender, System.EventArgs e)
		{
			this.result = YariSoft.DBUtil.RowOperation.RO_Skip;
			this.Close();
		}

		private void skipButtonAll_Click(object sender, System.EventArgs e)
		{
			this.result = YariSoft.DBUtil.RowOperation.RO_Skip_All;
			this.Close();
		}
		#endregion
	}
}

⌨️ 快捷键说明

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