?? factoryschedule.cs
字號:
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;packet size=4096;user id=sa;data source=NICOLAS;persist security info=False;initial catalog=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 + -