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

📄 filledit.cs

📁 煤矿信息管理系统是基于SuperMap Object
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;

namespace MKIms3
{
	/// <summary>
	/// FillEdit 的摘要说明。
	/// </summary>
	public class FillEdit : System.Windows.Forms.Form
	{
		private DataSet Fill_set;
		private System.Windows.Forms.Button btn_ok;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.DataGrid dataGrid_fill;
		private System.Windows.Forms.PictureBox pictureBox1;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public FillEdit()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

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

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FillEdit));
			this.dataGrid_fill = new System.Windows.Forms.DataGrid();
			this.btn_ok = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid_fill)).BeginInit();
			this.SuspendLayout();
			// 
			// dataGrid_fill
			// 
			this.dataGrid_fill.AlternatingBackColor = System.Drawing.SystemColors.Info;
			this.dataGrid_fill.CaptionText = "岩性与填充库关联列表";
			this.dataGrid_fill.DataMember = "";
			this.dataGrid_fill.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dataGrid_fill.Location = new System.Drawing.Point(184, 0);
			this.dataGrid_fill.Name = "dataGrid_fill";
			this.dataGrid_fill.PreferredColumnWidth = 136;
			this.dataGrid_fill.Size = new System.Drawing.Size(328, 256);
			this.dataGrid_fill.TabIndex = 0;
			// 
			// btn_ok
			// 
			this.btn_ok.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btn_ok.Location = new System.Drawing.Point(408, 260);
			this.btn_ok.Name = "btn_ok";
			this.btn_ok.Size = new System.Drawing.Size(75, 24);
			this.btn_ok.TabIndex = 1;
			this.btn_ok.Text = "提交修改";
			this.btn_ok.Click += new System.EventHandler(this.btn_ok_Click);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 261);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(392, 24);
			this.label1.TabIndex = 2;
			this.label1.Text = "系统提示:如果您对数据进行了修改,请单击“提交修改”以保存结果";
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// pictureBox1
			// 
			this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
			this.pictureBox1.Location = new System.Drawing.Point(6, 6);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(168, 250);
			this.pictureBox1.TabIndex = 3;
			this.pictureBox1.TabStop = false;
			// 
			// FillEdit
			// 
			this.AcceptButton = this.btn_ok;
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(520, 290);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.pictureBox1);
			this.Controls.Add(this.btn_ok);
			this.Controls.Add(this.dataGrid_fill);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.Name = "FillEdit";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "岩性库编辑";
			this.Load += new System.EventHandler(this.FillEdit_Load);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid_fill)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion



		#region 得到数据,修改数据
		private void get_fill()
		{
			DataBase myDB = new DataBase();
			this.Fill_set = myDB.RunProcedure("up_get_fill","Fill_set");
			this.dataGrid_fill.SetDataBinding(Fill_set,"Fill_set");
		}

		private bool update_fill()
		{
			string select = "select  岩性名称 ,岩性编号 as 对应填充符号编号 from 岩性 where 1>2";
			DataBase myDB = new DataBase();
			if(myDB.Run_change(select,Fill_set,"Fill_set"))
			{
				return true;
			}
			else
			{
				return false;
			}
		}

		#endregion

		private void FillEdit_Load(object sender, System.EventArgs e)
		{
			get_fill();
		}

		private void btn_ok_Click(object sender, System.EventArgs e)
		{
			if(update_fill())
			{
				MessageBox.Show("数据修改成功!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
			else
			{
				MessageBox.Show("数据修改失败!","错误信息",MessageBoxButtons.OK,MessageBoxIcon.Error);

			}
		}
	}
}

⌨️ 快捷键说明

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