📄 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="";//重新编辑前的还库数量值
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;//还库数量值状态更改标识
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public OutStorage()
{
//
// 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.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 = "*数量:";
//
// 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.label2);
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("数量", "数量"),
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 (数量 = @Original_数量) 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 + -