📄 product.cs
字号:
this.textId.Name = "textId";
this.textId.Size = new System.Drawing.Size(120, 23);
this.textId.TabIndex = 10;
this.textId.Text = "";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.textRemark);
this.groupBox2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.groupBox2.Location = new System.Drawing.Point(240, 72);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(216, 160);
this.groupBox2.TabIndex = 9;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "信息备注";
//
// textRemark
//
this.textRemark.BackColor = System.Drawing.Color.White;
this.textRemark.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textRemark.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetProduct, "Product.ProductRemark"));
this.textRemark.Location = new System.Drawing.Point(8, 24);
this.textRemark.Multiline = true;
this.textRemark.Name = "textRemark";
this.textRemark.Size = new System.Drawing.Size(200, 120);
this.textRemark.TabIndex = 0;
this.textRemark.Text = "";
this.textRemark.TextChanged += new System.EventHandler(this.textRemark_TextChanged);
//
// label5
//
this.label5.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label5.Location = new System.Drawing.Point(16, 216);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(72, 23);
this.label5.TabIndex = 4;
this.label5.Text = "计量单位";
//
// label3
//
this.label3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label3.Location = new System.Drawing.Point(16, 176);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(72, 23);
this.label3.TabIndex = 2;
this.label3.Text = "商品类别";
//
// label2
//
this.label2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label2.Location = new System.Drawing.Point(16, 128);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 23);
this.label2.TabIndex = 1;
this.label2.Text = "商品名称";
//
// label1
//
this.label1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label1.Location = new System.Drawing.Point(16, 88);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 23);
this.label1.TabIndex = 0;
this.label1.Text = "商品编号";
//
// btnAdd
//
this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAdd.Location = new System.Drawing.Point(48, 296);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(56, 24);
this.btnAdd.TabIndex = 22;
this.btnAdd.Text = "添加";
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnDelete
//
this.btnDelete.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDelete.Location = new System.Drawing.Point(184, 296);
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(56, 24);
this.btnDelete.TabIndex = 23;
this.btnDelete.Text = "删除";
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
//
// btnModify
//
this.btnModify.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnModify.Location = new System.Drawing.Point(120, 296);
this.btnModify.Name = "btnModify";
this.btnModify.Size = new System.Drawing.Size(56, 24);
this.btnModify.TabIndex = 25;
this.btnModify.Text = "修改";
this.btnModify.Click += new System.EventHandler(this.btnModify_Click);
//
// btnExit
//
this.btnExit.Location = new System.Drawing.Point(336, 320);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(72, 24);
this.btnExit.TabIndex = 27;
this.btnExit.Text = "退出";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// btnCancel
//
this.btnCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnCancel.Location = new System.Drawing.Point(168, 344);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(72, 24);
this.btnCancel.TabIndex = 28;
this.btnCancel.Text = "取消";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "packet size=4096;integrated security=SSPI;data source=localhost;persist security " +
"info=False;initial catalog=Sell";
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Product", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("ProductID", "ProductID"),
new System.Data.Common.DataColumnMapping("ProductName", "ProductName"),
new System.Data.Common.DataColumnMapping("ProductSort", "ProductSort"),
new System.Data.Common.DataColumnMapping("ProductUnit", "ProductUnit"),
new System.Data.Common.DataColumnMapping("ProductRemark", "ProductRemark")})});
this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = @"DELETE FROM Product WHERE (ProductID = @Original_ProductID) AND (ProductName = @Original_ProductName OR @Original_ProductName IS NULL AND ProductName IS NULL) AND (ProductRemark = @Original_ProductRemark OR @Original_ProductRemark IS NULL AND ProductRemark IS NULL) AND (ProductSort = @Original_ProductSort OR @Original_ProductSort IS NULL AND ProductSort IS NULL) AND (ProductUnit = @Original_ProductUnit OR @Original_ProductUnit IS NULL AND ProductUnit IS NULL)";
this.sqlDeleteCommand1.Connection = this.sqlConnection1;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ProductID", System.Data.SqlDbType.VarChar, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ProductID", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ProductName", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ProductName", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ProductRemark", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ProductRemark", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ProductSort", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ProductSort", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ProductUnit", System.Data.SqlDbType.VarChar, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ProductUnit", System.Data.DataRowVersion.Original, null));
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = @"INSERT INTO Product(ProductID, ProductName, ProductSort, ProductUnit, ProductRemark) VALUES (@ProductID, @ProductName, @ProductSort, @ProductUnit, @ProductRemark); SELECT ProductID, ProductName, ProductSort, ProductUnit, ProductRemark FROM Product WHERE (ProductID = @ProductID)";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ProductID", System.Data.SqlDbType.VarChar, 5, "ProductID"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ProductName", System.Data.SqlDbType.VarChar, 20, "ProductName"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ProductSort", System.Data.SqlDbType.VarChar, 20, "ProductSort"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ProductUnit", System.Data.SqlDbType.VarChar, 5, "ProductUnit"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ProductRemark", System.Data.SqlDbType.VarChar, 50, "ProductRemark"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT ProductID, ProductName, ProductSort, ProductUnit, ProductRemark FROM Produ" +
"ct";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE Product SET ProductID = @ProductID, ProductName = @ProductName, ProductSort = @ProductSort, ProductUnit = @ProductUnit, ProductRemark = @ProductRemark WHERE (ProductID = @Original_ProductID) AND (ProductName = @Original_ProductName OR @Original_ProductName IS NULL AND ProductName IS NULL) AND (ProductRemark = @Original_ProductRemark OR @Original_ProductRemark IS NULL AND ProductRemark IS NULL) AND (ProductSort = @Original_ProductSort OR @Original_ProductSort IS NULL AND ProductSort IS NULL) AND (ProductUnit = @Original_ProductUnit OR @Original_ProductUnit IS NULL AND ProductUnit IS NULL); SELECT ProductID, ProductName, ProductSort, ProductUnit, ProductRemark FROM Product WHERE (ProductID = @ProductID)";
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ProductID", System.Data.SqlDbType.VarChar, 5, "ProductID"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ProductName", System.Data.SqlDbType.VarChar, 20, "ProductName"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ProductSort", System.Data.SqlDbType.VarChar, 20, "ProductSort"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ProductUnit", System.Data.SqlDbType.VarChar, 5, "ProductUnit"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ProductRemark", System.Data.SqlDbType.VarChar, 50, "ProductRemark"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ProductID", System.Data.SqlDbType.VarChar, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ProductID", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ProductName", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ProductName", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ProductRemark", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ProductRemark", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ProductSort", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ProductSort", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ProductUnit", System.Data.SqlDbType.VarChar, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ProductUnit", System.Data.DataRowVersion.Original, null));
//
// Product
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(512, 381);
this.Controls.Add(this.btnApply);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnAdd);
this.Controls.Add(this.btnDelete);
this.Controls.Add(this.btnModify);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnCancel);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Product";
this.Text = "商品信息维护";
this.Load += new System.EventHandler(this.Product_Load);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.objDataSetProduct)).EndInit();
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
public void ErrorHandle(System.Exception E)
{
MessageBox.Show(E.ToString());
}
private void ButtonPositonChange()
{
this.btnPrevious.Enabled=true;
this.btnNext.Enabled=true;
this.btnFirst.Enabled=true;
this.btnLast.Enabled=true;
if(this.BindingContext[this.objDataSetProduct,"Product"].Position==0)
{
this.btnFirst.Enabled=false;
this.btnPrevious.Enabled=false;
}
if(this.BindingContext[this.objDataSetProduct,"Product"].Position==this.BindingContext[this.objDataSetProduct,"Product"].Count-1)
{
this.btnNext.Enabled=false;
this.btnLast.Enabled=false;
}
}
private void DatasetPostionChange()
{
this.lblDatasetPosition.Text=(this.BindingContext[this.objDataSetProduct,"Product"].Position+1)+"的"+
(this.BindingContext[this.objDataSetProduct,"Product"].Count);
}
private void TextEnableControl(bool valid)
{
if(valid)
{
this.textId.Enabled=true;
this.textName.Enabled=true;
this.textSpecity.Enabled=true;
this.textUnit.Enabled=true;
this.textRemark.Enabled=true;
}
else
{
this.textId.Enabled=false;
this.textName.Enabled=false;
this.textSpecity.Enabled=false;
this.textUnit.Enabled=false;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -