?? buyfrm.cs
字號:
this.textAccount.Text = "";
//
// textSupply
//
this.textSupply.Location = new System.Drawing.Point(104, 128);
this.textSupply.Name = "textSupply";
this.textSupply.Size = new System.Drawing.Size(88, 21);
this.textSupply.TabIndex = 14;
this.textSupply.Text = "";
//
// textCost
//
this.textCost.Location = new System.Drawing.Point(336, 128);
this.textCost.Name = "textCost";
this.textCost.Size = new System.Drawing.Size(88, 21);
this.textCost.TabIndex = 15;
this.textCost.Text = "";
//
// textMan
//
this.textMan.Location = new System.Drawing.Point(104, 168);
this.textMan.Name = "textMan";
this.textMan.Size = new System.Drawing.Size(88, 21);
this.textMan.TabIndex = 16;
this.textMan.Text = "";
//
// textShow
//
this.textShow.Location = new System.Drawing.Point(336, 168);
this.textShow.Name = "textShow";
this.textShow.Size = new System.Drawing.Size(88, 21);
this.textShow.TabIndex = 17;
this.textShow.Text = "";
//
// textDate
//
this.textDate.Location = new System.Drawing.Point(104, 208);
this.textDate.Name = "textDate";
this.textDate.Size = new System.Drawing.Size(320, 21);
this.textDate.TabIndex = 18;
this.textDate.Text = "";
//
// creat_button
//
this.creat_button.Font = new System.Drawing.Font("宋體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.creat_button.Location = new System.Drawing.Point(104, 256);
this.creat_button.Name = "creat_button";
this.creat_button.Size = new System.Drawing.Size(72, 24);
this.creat_button.TabIndex = 19;
this.creat_button.Text = "生成";
this.creat_button.Click += new System.EventHandler(this.creat_button_Click);
//
// esc_button
//
this.esc_button.Font = new System.Drawing.Font("宋體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.esc_button.Location = new System.Drawing.Point(280, 256);
this.esc_button.Name = "esc_button";
this.esc_button.Size = new System.Drawing.Size(72, 24);
this.esc_button.TabIndex = 20;
this.esc_button.Text = "退出";
this.esc_button.Click += new System.EventHandler(this.esc_button_Click);
//
// buyAdapter
//
this.buyAdapter.DeleteCommand = this.sqlDeleteCommand1;
this.buyAdapter.InsertCommand = this.sqlInsertCommand1;
this.buyAdapter.SelectCommand = this.sqlSelectCommand1;
this.buyAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "buyTable", 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("價格", "價格"),
new System.Data.Common.DataColumnMapping("制表人", "制表人"),
new System.Data.Common.DataColumnMapping("備注", "備注"),
new System.Data.Common.DataColumnMapping("報表時間", "報表時間")})});
this.buyAdapter.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = @"DELETE FROM buyTable WHERE (報表時間 = @Original_報表時間) AND (價格 = @Original_價格 OR @Original_價格 IS NULL AND 價格 IS NULL) AND (供應商 = @Original_供應商 OR @Original_供應商 IS NULL AND 供應商 IS NULL) AND (制表人 = @Original_制表人 OR @Original_制表人 IS NULL AND 制表人 IS NULL) AND (備注 = @Original_備注 OR @Original_備注 IS NULL AND 備注 IS NULL) AND (最大庫存 = @Original_最大庫存 OR @Original_最大庫存 IS NULL AND 最大庫存 IS NULL) AND (現有庫存 = @Original_現有庫存 OR @Original_現有庫存 IS NULL AND 現有庫存 IS NULL) AND (設備號 = @Original_設備號 OR @Original_設備號 IS NULL AND 設備號 IS NULL) AND (購買數量 = @Original_購買數量 OR @Original_購買數量 IS NULL AND 購買數量 IS NULL)";
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));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_價格", System.Data.SqlDbType.VarChar, 10, 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, 10, 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, 10, 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, 10, 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, 10, 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, 10, 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, 10, 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, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "購買數量", System.Data.DataRowVersion.Original, null));
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=727CE26111204C4;packet size=4096;user id=sa;data source=\".\";persis" +
"t security info=False;initial catalog=storage";
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO buyTable(設備號, 現有庫存, 最大庫存, 購買數量, 供應商, 價格, 制表人, 備注, 報表時間) VALUES (@設備號," +
" @現有庫存, @最大庫存, @購買數量, @供應商, @價格, @制表人, @備注, @報表時間); SELECT 設備號, 現有庫存, 最大庫存, 購買數量" +
", 供應商, 價格, 制表人, 備注, 報表時間 FROM buyTable WHERE (報表時間 = @報表時間)";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@設備號", System.Data.SqlDbType.VarChar, 10, "設備號"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@現有庫存", System.Data.SqlDbType.VarChar, 10, "現有庫存"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@最大庫存", System.Data.SqlDbType.VarChar, 10, "最大庫存"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@購買數量", System.Data.SqlDbType.VarChar, 10, "購買數量"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@供應商", System.Data.SqlDbType.VarChar, 10, "供應商"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@價格", System.Data.SqlDbType.VarChar, 10, "價格"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@制表人", System.Data.SqlDbType.VarChar, 10, "制表人"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@備注", System.Data.SqlDbType.VarChar, 10, "備注"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@報表時間", System.Data.SqlDbType.DateTime, 8, "報表時間"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT 設備號, 現有庫存, 最大庫存, 購買數量, 供應商, 價格, 制表人, 備注, 報表時間 FROM buyTable";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE buyTable SET 設備號 = @設備號, 現有庫存 = @現有庫存, 最大庫存 = @最大庫存, 購買數量 = @購買數量, 供應商 = @供應商, 價格 = @價格, 制表人 = @制表人, 備注 = @備注, 報表時間 = @報表時間 WHERE (報表時間 = @Original_報表時間) AND (價格 = @Original_價格 OR @Original_價格 IS NULL AND 價格 IS NULL) AND (供應商 = @Original_供應商 OR @Original_供應商 IS NULL AND 供應商 IS NULL) AND (制表人 = @Original_制表人 OR @Original_制表人 IS NULL AND 制表人 IS NULL) AND (備注 = @Original_備注 OR @Original_備注 IS NULL AND 備注 IS NULL) AND (最大庫存 = @Original_最大庫存 OR @Original_最大庫存 IS NULL AND 最大庫存 IS NULL) AND (現有庫存 = @Original_現有庫存 OR @Original_現有庫存 IS NULL AND 現有庫存 IS NULL) AND (設備號 = @Original_設備號 OR @Original_設備號 IS NULL AND 設備號 IS NULL) AND (購買數量 = @Original_購買數量 OR @Original_購買數量 IS NULL AND 購買數量 IS NULL); SELECT 設備號, 現有庫存, 最大庫存, 購買數量, 供應商, 價格, 制表人, 備注, 報表時間 FROM buyTable WHERE (報表時間 = @報表時間)";
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@設備號", System.Data.SqlDbType.VarChar, 10, "設備號"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@現有庫存", System.Data.SqlDbType.VarChar, 10, "現有庫存"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@最大庫存", System.Data.SqlDbType.VarChar, 10, "最大庫存"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@購買數量", System.Data.SqlDbType.VarChar, 10, "購買數量"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@供應商", System.Data.SqlDbType.VarChar, 10, "供應商"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@價格", System.Data.SqlDbType.VarChar, 10, "價格"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@制表人", System.Data.SqlDbType.VarChar, 10, "制表人"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@備注", System.Data.SqlDbType.VarChar, 10, "備注"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@報表時間", System.Data.SqlDbType.DateTime, 8, "報表時間"));
this.sqlUpdateCommand1.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));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_價格", System.Data.SqlDbType.VarChar, 10, 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, 10, 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, 10, 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, 10, 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, 10, 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, 10, 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, 10, 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, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "購買數量", System.Data.DataRowVersion.Original, null));
//
// buyFrm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(456, 326);
this.Controls.Add(this.esc_button);
this.Controls.Add(this.creat_button);
this.Controls.Add(this.textDate);
this.Controls.Add(this.textShow);
this.Controls.Add(this.textMan);
this.Controls.Add(this.textCost);
this.Controls.Add(this.textSupply);
this.Controls.Add(this.textAccount);
this.Controls.Add(this.textMaxNum);
this.Controls.Add(this.textNowNum);
this.Controls.Add(this.textNum);
this.Controls.Add(this.label10);
this.Controls.Add(this.label9);
this.Controls.Add(this.label8);
this.Controls.Add(this.label7);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "buyFrm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "采購計劃";
this.Load += new System.EventHandler(this.buyFrm_Load);
this.ResumeLayout(false);
}
#endregion
private void buyFrm_Load(object sender, System.EventArgs e)
{
this.textNum.Focus();
this.textDate.Text=DateTime.Now.ToString();
}
private void esc_button_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void creat_button_Click(object sender, System.EventArgs e)
{
if(this.textNum.Text.Trim()==""||this.textAccount.Text.Trim()=="")
{
MessageBox.Show("設備號,購買數量不能為空");
return;
}
DataTable buyInfo=new DataTable();
buyAdapter.UpdateCommand.Connection=MyConn;
buyAdapter.InsertCommand.Connection=MyConn;
buyAdapter.SelectCommand.Connection=MyConn;
MyConn.Open();
buyAdapter.Fill(buySet);
DataRow buyInfoRow = this.buySet.Tables[0].NewRow();//建立新記錄
buyInfoRow["設備號"] = this.textNum.Text.Trim();
buyInfoRow["現有庫存"] = this.textNowNum.Text.Trim();
buyInfoRow["最大庫存"] = this.textMaxNum.Text.Trim();
buyInfoRow["購買數量"] = this.textAccount.Text.Trim();
buyInfoRow["供應商"] = this.textSupply.Text.Trim();
buyInfoRow["價格"] = this.textCost.Text.Trim();
buyInfoRow["制表人"] = this.textMan.Text.Trim();
buyInfoRow["備注"] = this.textShow.Text.Trim();
buyInfoRow["報表時間"] = this.textDate.Text.Trim();
this.buySet.Tables[0].Rows.Add(buyInfoRow);
this.buyAdapter.Update(buySet);
MessageBox.Show("OK");
return;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -