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

📄 factoryschedule.cs

📁 这是一个用VS2003平台C#的生产管理系统
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace 生产管理系统
{
	/// <summary>
	/// FactorySchedule 的摘要说明。
	/// </summary>
	public class FactorySchedule : System.Windows.Forms.Form
	{
		private CurrencyManager cmOrders;
		public static int callForm;//确定是由哪个窗体调用工厂日历
		private DataTable tempTable=new DataTable();
		private System.Windows.Forms.ImageList imageList1;
		private System.Windows.Forms.DataGrid dataGrid1;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
		private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
		private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
		private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
		private System.Data.SqlClient.SqlConnection sqlConnection1;
		private System.Data.SqlClient.SqlDataAdapter da1;
		private 生产管理系统.DataSet1 dataSet11;
		private System.Windows.Forms.TextBox txt1;
		private System.Windows.Forms.TextBox txt2;
		private System.Windows.Forms.TextBox txt3;
		private System.Windows.Forms.TextBox txt4;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.TextBox txt7;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Button btnSearch;
		private System.Windows.Forms.TextBox txt6;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.ToolBar toolBar1;
		private System.Windows.Forms.ToolBarButton tBtnFirst;
		private System.Windows.Forms.ToolBarButton tBtnPre;
		private System.Windows.Forms.ToolBarButton tBtnNext;
		private System.Windows.Forms.ToolBarButton tBtnLast;
		private System.Windows.Forms.ToolBarButton tBtnNew;
		private System.Windows.Forms.ToolBarButton tBtnEdit;
		private System.Windows.Forms.ToolBarButton tBtnDelete;
		private System.Windows.Forms.ToolBarButton tBtnSubmit;
		private System.Windows.Forms.ToolBarButton tBtnCancel;
		private System.Windows.Forms.ToolBarButton tBtnQuit;
		private System.Windows.Forms.TextBox txt5;
		private System.ComponentModel.IContainer components;

		public FactorySchedule()
		{
			//
			// 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()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FactorySchedule));
			this.imageList1 = new System.Windows.Forms.ImageList(this.components);
			this.dataGrid1 = new System.Windows.Forms.DataGrid();
			this.dataSet11 = new 生产管理系统.DataSet1();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.txt7 = new System.Windows.Forms.TextBox();
			this.label6 = new System.Windows.Forms.Label();
			this.btnSearch = new System.Windows.Forms.Button();
			this.txt6 = new System.Windows.Forms.TextBox();
			this.label7 = new System.Windows.Forms.Label();
			this.da1 = new System.Data.SqlClient.SqlDataAdapter();
			this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
			this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
			this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
			this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
			this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
			this.txt1 = new System.Windows.Forms.TextBox();
			this.txt2 = new System.Windows.Forms.TextBox();
			this.txt3 = new System.Windows.Forms.TextBox();
			this.txt4 = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.label5 = new System.Windows.Forms.Label();
			this.toolBar1 = new System.Windows.Forms.ToolBar();
			this.tBtnFirst = new System.Windows.Forms.ToolBarButton();
			this.tBtnPre = new System.Windows.Forms.ToolBarButton();
			this.tBtnNext = new System.Windows.Forms.ToolBarButton();
			this.tBtnLast = new System.Windows.Forms.ToolBarButton();
			this.tBtnNew = new System.Windows.Forms.ToolBarButton();
			this.tBtnEdit = new System.Windows.Forms.ToolBarButton();
			this.tBtnDelete = new System.Windows.Forms.ToolBarButton();
			this.tBtnSubmit = new System.Windows.Forms.ToolBarButton();
			this.tBtnCancel = new System.Windows.Forms.ToolBarButton();
			this.tBtnQuit = new System.Windows.Forms.ToolBarButton();
			this.txt5 = new System.Windows.Forms.TextBox();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// imageList1
			// 
			this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
			this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
			this.imageList1.TransparentColor = System.Drawing.SystemColors.ControlLightLight;
			// 
			// dataGrid1
			// 
			this.dataGrid1.CaptionVisible = false;
			this.dataGrid1.DataMember = "工厂日历";
			this.dataGrid1.DataSource = this.dataSet11;
			this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dataGrid1.Location = new System.Drawing.Point(0, 104);
			this.dataGrid1.Name = "dataGrid1";
			this.dataGrid1.ReadOnly = true;
			this.dataGrid1.RowHeaderWidth = 20;
			this.dataGrid1.Size = new System.Drawing.Size(328, 352);
			this.dataGrid1.TabIndex = 27;
			this.dataGrid1.DoubleClick += new System.EventHandler(this.dataGrid1_DoubleClick);
			// 
			// dataSet11
			// 
			this.dataSet11.DataSetName = "DataSet1";
			this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.txt7);
			this.groupBox1.Controls.Add(this.label6);
			this.groupBox1.Controls.Add(this.btnSearch);
			this.groupBox1.Controls.Add(this.txt6);
			this.groupBox1.Controls.Add(this.label7);
			this.groupBox1.Location = new System.Drawing.Point(0, 40);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(576, 56);
			this.groupBox1.TabIndex = 28;
			this.groupBox1.TabStop = false;
			// 
			// txt7
			// 
			this.txt7.Location = new System.Drawing.Point(328, 24);
			this.txt7.Name = "txt7";
			this.txt7.TabIndex = 7;
			this.txt7.Text = "";
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(284, 28);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(48, 16);
			this.label6.TabIndex = 5;
			this.label6.Text = "计划期";
			// 
			// btnSearch
			// 
			this.btnSearch.Image = ((System.Drawing.Image)(resources.GetObject("btnSearch.Image")));
			this.btnSearch.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnSearch.Location = new System.Drawing.Point(16, 24);
			this.btnSearch.Name = "btnSearch";
			this.btnSearch.Size = new System.Drawing.Size(72, 23);
			this.btnSearch.TabIndex = 3;
			this.btnSearch.Text = " 搜索";
			this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
			// 
			// txt6
			// 
			this.txt6.Location = new System.Drawing.Point(168, 24);
			this.txt6.Name = "txt6";
			this.txt6.TabIndex = 6;
			this.txt6.Text = "";
			// 
			// label7
			// 
			this.label7.Location = new System.Drawing.Point(140, 29);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(32, 16);
			this.label7.TabIndex = 4;
			this.label7.Text = "年份";
			// 
			// da1
			// 
			this.da1.DeleteCommand = this.sqlDeleteCommand1;
			this.da1.InsertCommand = this.sqlInsertCommand1;
			this.da1.SelectCommand = this.sqlSelectCommand1;
			this.da1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																						  new System.Data.Common.DataTableMapping("Table", "工厂日历", new System.Data.Common.DataColumnMapping[] {
																																																  new System.Data.Common.DataColumnMapping("年份", "年份"),
																																																  new System.Data.Common.DataColumnMapping("计划期", "计划期"),
																																																  new System.Data.Common.DataColumnMapping("开始日期", "开始日期"),
																																																  new System.Data.Common.DataColumnMapping("结束日期", "结束日期"),
																																																  new System.Data.Common.DataColumnMapping("备注", "备注")})});
			this.da1.UpdateCommand = this.sqlUpdateCommand1;
			// 
			// sqlDeleteCommand1
			// 
			this.sqlDeleteCommand1.CommandText = "DELETE FROM 工厂日历 WHERE (年份 = @Original_年份) AND (计划期 = @Original_计划期) AND (备注 = @O" +
				"riginal_备注 OR @Original_备注 IS NULL AND 备注 IS NULL) AND (开始日期 = @Original_开始日期) A" +
				"ND (结束日期 = @Original_结束日期)";
			this.sqlDeleteCommand1.Connection = this.sqlConnection1;
			this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_年份", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "年份", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_计划期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "计划期", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_备注", System.Data.SqlDbType.VarChar, 255, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "备注", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_开始日期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "开始日期", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_结束日期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "结束日期", System.Data.DataRowVersion.Original, null));
			// 
			// sqlConnection1
			// 
			this.sqlConnection1.ConnectionString = "workstation id=localhost;Integrated Security=SSPI;Database=mrpbook;";
			// 
			// sqlInsertCommand1
			// 
			this.sqlInsertCommand1.CommandText = "INSERT INTO 工厂日历(年份, 计划期, 开始日期, 结束日期, 备注) VALUES (@年份, @计划期, @开始日期, @结束日期, @备注); " +
				"SELECT 年份, 计划期, 开始日期, 结束日期, 备注 FROM 工厂日历 WHERE (年份 = @年份) AND (计划期 = @计划期)";
			this.sqlInsertCommand1.Connection = this.sqlConnection1;
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@年份", System.Data.SqlDbType.Int, 4, "年份"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@计划期", System.Data.SqlDbType.Int, 4, "计划期"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@开始日期", System.Data.SqlDbType.Int, 4, "开始日期"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@结束日期", System.Data.SqlDbType.Int, 4, "结束日期"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@备注", System.Data.SqlDbType.VarChar, 255, "备注"));
			// 
			// sqlSelectCommand1
			// 
			this.sqlSelectCommand1.CommandText = "SELECT 年份, 计划期, 开始日期, 结束日期, 备注 FROM 工厂日历 WHERE (年份 LIKE @Param3) AND (计划期 LIKE @P" +
				"aram4)";
			this.sqlSelectCommand1.Connection = this.sqlConnection1;
			this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param3", System.Data.SqlDbType.VarChar, 10, "年份"));
			this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param4", System.Data.SqlDbType.VarChar, 8, "计划期"));
			// 
			// sqlUpdateCommand1
			// 
			this.sqlUpdateCommand1.CommandText = @"UPDATE 工厂日历 SET 年份 = @年份, 计划期 = @计划期, 开始日期 = @开始日期, 结束日期 = @结束日期, 备注 = @备注 WHERE (年份 = @Original_年份) AND (计划期 = @Original_计划期) AND (备注 = @Original_备注 OR @Original_备注 IS NULL AND 备注 IS NULL) AND (开始日期 = @Original_开始日期) AND (结束日期 = @Original_结束日期); SELECT 年份, 计划期, 开始日期, 结束日期, 备注 FROM 工厂日历 WHERE (年份 = @年份) AND (计划期 = @计划期)";
			this.sqlUpdateCommand1.Connection = this.sqlConnection1;
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@年份", System.Data.SqlDbType.Int, 4, "年份"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@计划期", System.Data.SqlDbType.Int, 4, "计划期"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@开始日期", System.Data.SqlDbType.Int, 4, "开始日期"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@结束日期", System.Data.SqlDbType.Int, 4, "结束日期"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@备注", System.Data.SqlDbType.VarChar, 255, "备注"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_年份", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "年份", System.Data.DataRowVersion.Original, null));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_计划期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "计划期", System.Data.DataRowVersion.Original, null));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_备注", System.Data.SqlDbType.VarChar, 255, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "备注", System.Data.DataRowVersion.Original, null));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_开始日期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "开始日期", System.Data.DataRowVersion.Original, null));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_结束日期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "结束日期", System.Data.DataRowVersion.Original, null));
			// 
			// txt1
			// 
			this.txt1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "工厂日历.年份"));
			this.txt1.Location = new System.Drawing.Point(432, 136);
			this.txt1.Name = "txt1";
			this.txt1.ReadOnly = true;
			this.txt1.TabIndex = 29;
			this.txt1.Text = "";
			// 
			// txt2
			// 
			this.txt2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "工厂日历.计划期"));
			this.txt2.Location = new System.Drawing.Point(432, 176);
			this.txt2.Name = "txt2";
			this.txt2.ReadOnly = true;
			this.txt2.TabIndex = 30;
			this.txt2.Text = "";
			// 
			// txt3
			// 
			this.txt3.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "工厂日历.开始日期"));
			this.txt3.Location = new System.Drawing.Point(432, 216);
			this.txt3.Name = "txt3";
			this.txt3.ReadOnly = true;
			this.txt3.TabIndex = 29;
			this.txt3.Text = "";
			// 
			// txt4
			// 
			this.txt4.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "工厂日历.结束日期"));
			this.txt4.Location = new System.Drawing.Point(432, 256);
			this.txt4.Name = "txt4";
			this.txt4.ReadOnly = true;
			this.txt4.TabIndex = 30;
			this.txt4.Text = "";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(384, 176);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(48, 16);
			this.label1.TabIndex = 32;
			this.label1.Text = "计划期";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(400, 140);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(32, 16);
			this.label2.TabIndex = 32;
			this.label2.Text = "年份";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(376, 256);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(56, 16);
			this.label3.TabIndex = 32;
			this.label3.Text = "结束日期";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(376, 216);

⌨️ 快捷键说明

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