?? outstorage.cs
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace WindowsApplication4
{
/// <summary>
/// Form1 的摘要說明。
/// </summary>
public class OutStorage : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox textNum2;
private System.Windows.Forms.TextBox textDate;
private System.Windows.Forms.TextBox textAmount;
private System.Windows.Forms.TextBox textMan;
private System.Windows.Forms.Button add_button;
private System.Windows.Forms.Button send_button;
private System.Windows.Forms.Button cancel_button;
private System.Data.SqlClient.SqlDataAdapter OutStgAdapter;
private System.Data.SqlClient.SqlConnection sqlConnection1;
private DataTable OutStgInfo=new DataTable();
private DataSet OutStgset=new DataSet();
private CurrencyManager OSReport;
private SqlTransaction OutStgTran;
private SqlConnection MyConn = new SqlConnection("server=.;Trusted_Connection=yes;user=sa;pwd=1;database=storage");
private string str="";
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textExp;
private System.Windows.Forms.TextBox textDep;
private string oldtxtAmount="";//重新編輯前的還庫數(shù)量值
private bool change=false;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;//還庫數(shù)量值狀態(tài)更改標識
/// <summary>
/// 必需的設計器變量。
/// </summary>
private System.ComponentModel.Container components = null;
public OutStorage()
{
//
// Windows 窗體設計器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調用后添加任何構造函數(shù)代碼
//
}
/// <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.cancel_button = new System.Windows.Forms.Button();
this.send_button = new System.Windows.Forms.Button();
this.add_button = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textExp = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.textMan = new System.Windows.Forms.TextBox();
this.textAmount = new System.Windows.Forms.TextBox();
this.textDep = new System.Windows.Forms.TextBox();
this.textDate = new System.Windows.Forms.TextBox();
this.textNum2 = new System.Windows.Forms.TextBox();
this.OutStgAdapter = 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.dataGrid1 = new System.Windows.Forms.DataGrid();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.SuspendLayout();
//
// cancel_button
//
this.cancel_button.Font = new System.Drawing.Font("宋體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.cancel_button.Location = new System.Drawing.Point(368, 104);
this.cancel_button.Name = "cancel_button";
this.cancel_button.Size = new System.Drawing.Size(72, 24);
this.cancel_button.TabIndex = 3;
this.cancel_button.Text = "取消";
this.cancel_button.Click += new System.EventHandler(this.cancel_button_Click);
//
// send_button
//
this.send_button.Font = new System.Drawing.Font("宋體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.send_button.Location = new System.Drawing.Point(368, 64);
this.send_button.Name = "send_button";
this.send_button.Size = new System.Drawing.Size(72, 24);
this.send_button.TabIndex = 2;
this.send_button.Text = "提交";
this.send_button.Click += new System.EventHandler(this.send_button_Click);
//
// add_button
//
this.add_button.Font = new System.Drawing.Font("宋體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.add_button.Location = new System.Drawing.Point(368, 24);
this.add_button.Name = "add_button";
this.add_button.Size = new System.Drawing.Size(72, 24);
this.add_button.TabIndex = 0;
this.add_button.Text = "新增";
this.add_button.Click += new System.EventHandler(this.add_button_Click);
//
// label6
//
this.label6.Location = new System.Drawing.Point(16, 88);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(64, 16);
this.label6.TabIndex = 4;
this.label6.Text = "經辦人:";
//
// label5
//
this.label5.Location = new System.Drawing.Point(176, 56);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(56, 16);
this.label5.TabIndex = 3;
this.label5.Text = "*數(shù)量:";
//
// label4
//
this.label4.Location = new System.Drawing.Point(8, 56);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(64, 16);
this.label4.TabIndex = 2;
this.label4.Text = "使用部門:";
//
// label3
//
this.label3.Location = new System.Drawing.Point(176, 24);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(80, 16);
this.label3.TabIndex = 1;
this.label3.Text = "出庫日期:";
//
// label2
//
this.label2.Location = new System.Drawing.Point(24, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 16);
this.label2.TabIndex = 0;
this.label2.Text = "*設備號:";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.textExp);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.textMan);
this.groupBox1.Controls.Add(this.textAmount);
this.groupBox1.Controls.Add(this.textDep);
this.groupBox1.Controls.Add(this.textDate);
this.groupBox1.Controls.Add(this.textNum2);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.add_button);
this.groupBox1.Controls.Add(this.send_button);
this.groupBox1.Controls.Add(this.cancel_button);
this.groupBox1.Location = new System.Drawing.Point(24, 176);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(456, 160);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "出庫信息管理";
//
// textExp
//
this.textExp.Location = new System.Drawing.Point(80, 120);
this.textExp.Name = "textExp";
this.textExp.Size = new System.Drawing.Size(240, 21);
this.textExp.TabIndex = 11;
this.textExp.Text = "";
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 120);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 24);
this.label1.TabIndex = 10;
this.label1.Text = "備注:";
//
// textMan
//
this.textMan.Location = new System.Drawing.Point(80, 88);
this.textMan.Name = "textMan";
this.textMan.Size = new System.Drawing.Size(240, 21);
this.textMan.TabIndex = 9;
this.textMan.Text = "";
//
// textAmount
//
this.textAmount.Location = new System.Drawing.Point(240, 56);
this.textAmount.Name = "textAmount";
this.textAmount.Size = new System.Drawing.Size(80, 21);
this.textAmount.TabIndex = 8;
this.textAmount.Text = "";
this.textAmount.Leave += new System.EventHandler(this.textAmount_Leave);
//
// textDep
//
this.textDep.Location = new System.Drawing.Point(80, 56);
this.textDep.Name = "textDep";
this.textDep.Size = new System.Drawing.Size(80, 21);
this.textDep.TabIndex = 7;
this.textDep.Text = "";
//
// textDate
//
this.textDate.Location = new System.Drawing.Point(240, 24);
this.textDate.Name = "textDate";
this.textDate.Size = new System.Drawing.Size(80, 21);
this.textDate.TabIndex = 6;
this.textDate.Text = "";
//
// textNum2
//
this.textNum2.Location = new System.Drawing.Point(80, 24);
this.textNum2.Name = "textNum2";
this.textNum2.Size = new System.Drawing.Size(80, 21);
this.textNum2.TabIndex = 5;
this.textNum2.Text = "";
//
// OutStgAdapter
//
this.OutStgAdapter.DeleteCommand = this.sqlDeleteCommand1;
this.OutStgAdapter.InsertCommand = this.sqlInsertCommand1;
this.OutStgAdapter.SelectCommand = this.sqlSelectCommand1;
this.OutStgAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "storage_out", 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("數(shù)量", "數(shù)量"),
new System.Data.Common.DataColumnMapping("經辦人", "經辦人"),
new System.Data.Common.DataColumnMapping("備注", "備注")})});
this.OutStgAdapter.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = @"DELETE FROM storage_out WHERE (出庫日期 = @Original_出庫日期) AND (使用部門 = @Original_使用部門 OR @Original_使用部門 IS NULL AND 使用部門 IS NULL) AND (備注 = @Original_備注 OR @Original_備注 IS NULL AND 備注 IS NULL) AND (數(shù)量 = @Original_數(shù)量) AND (經辦人 = @Original_經辦人 OR @Original_經辦人 IS NULL AND 經辦人 IS NULL) AND (設備號 = @Original_設備號)";
this.sqlDeleteCommand1.Connection = this.sqlConnection1;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_出庫日期", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "出庫日期", System.Data.DataRowVersion.Original, null));
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -