📄 viewitem.cs
字号:
this.sqlDeleteCommand2.CommandText = "DELETE FROM Vip WHERE (vipid = @Original_会员ID) AND (consume = @Original_积分) AND (" +
"discount = @Original_折扣) AND (vipname = @Original_姓名) AND (vipphone = @Original_" +
"联系电话 OR @Original_联系电话 IS NULL AND vipphone IS NULL)";
this.sqlDeleteCommand2.Connection = this.sqlConnection_Staff;
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_会员ID", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "会员ID", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_积分", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(8)), ((System.Byte)(2)), "积分", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_折扣", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(8)), ((System.Byte)(2)), "折扣", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_姓名", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "姓名", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_联系电话", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "联系电话", System.Data.DataRowVersion.Original, null));
//
// sqlSelectCommand2
//
this.sqlSelectCommand2.CommandText = "SELECT commid AS 商品ID, commname AS 商品名, commkind AS 商品类型, purprice AS 进价, salepri" +
"ce AS 售价, branchid AS 仓库, stocks AS 存货量 FROM Commodity";
this.sqlSelectCommand2.Connection = this.sqlConnection_Staff;
//
// sqlInsertCommand2
//
this.sqlInsertCommand2.CommandText = @"INSERT INTO Commodity(commid, commname, commkind, purprice, saleprice, branchid, stocks) VALUES (@commid, @commname, @commkind, @purprice, @saleprice, @branchid, @stocks); SELECT commid AS 商品ID, commname AS 商品名, commkind AS 商品类型, purprice AS 进价, saleprice AS 售价, branchid AS 仓库, stocks AS 存货量 FROM Commodity WHERE (commid = @商品ID)";
this.sqlInsertCommand2.Connection = this.sqlConnection_Staff;
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@commid", System.Data.SqlDbType.VarChar, 10, "商品ID"));
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@commname", System.Data.SqlDbType.VarChar, 10, "商品名"));
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@commkind", System.Data.SqlDbType.VarChar, 10, "商品类型"));
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@purprice", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(8)), ((System.Byte)(2)), "进价", System.Data.DataRowVersion.Current, null));
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@saleprice", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(8)), ((System.Byte)(2)), "售价", System.Data.DataRowVersion.Current, null));
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@branchid", System.Data.SqlDbType.VarChar, 10, "仓库"));
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@stocks", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(8)), ((System.Byte)(2)), "存货量", System.Data.DataRowVersion.Current, null));
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@商品ID", System.Data.SqlDbType.VarChar, 10, "商品ID"));
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE Commodity SET commid = @commid, commname = @commname, commkind = @commkind, purprice = @purprice, saleprice = @saleprice, branchid = @branchid, stocks = @stocks WHERE (commid = @Original_商品ID) AND (branchid = @Original_仓库) AND (commkind = @Original_商品类型) AND (commname = @Original_商品名) AND (purprice = @Original_进价 OR @Original_进价 IS NULL AND purprice IS NULL) AND (saleprice = @Original_售价 OR @Original_售价 IS NULL AND saleprice IS NULL) AND (stocks = @Original_存货量); SELECT commid AS 商品ID, commname AS 商品名, commkind AS 商品类型, purprice AS 进价, saleprice AS 售价, branchid AS 仓库, stocks AS 存货量 FROM Commodity WHERE (commid = @商品ID)";
this.sqlUpdateCommand1.Connection = this.sqlConnection_Staff;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@commid", System.Data.SqlDbType.VarChar, 10, "商品ID"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@commname", System.Data.SqlDbType.VarChar, 10, "商品名"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@commkind", System.Data.SqlDbType.VarChar, 10, "商品类型"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@purprice", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(8)), ((System.Byte)(2)), "进价", System.Data.DataRowVersion.Current, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@saleprice", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(8)), ((System.Byte)(2)), "售价", System.Data.DataRowVersion.Current, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@branchid", System.Data.SqlDbType.VarChar, 10, "仓库"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@stocks", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(8)), ((System.Byte)(2)), "存货量", System.Data.DataRowVersion.Current, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_商品ID", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "商品ID", 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.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(8)), ((System.Byte)(2)), "进价", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_售价", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(8)), ((System.Byte)(2)), "售价", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_存货量", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(8)), ((System.Byte)(2)), "存货量", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@商品ID", System.Data.SqlDbType.VarChar, 10, "商品ID"));
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = @"DELETE FROM Commodity WHERE (commid = @Original_商品ID) AND (branchid = @Original_仓库) AND (commkind = @Original_商品类型) AND (commname = @Original_商品名) AND (purprice = @Original_进价 OR @Original_进价 IS NULL AND purprice IS NULL) AND (saleprice = @Original_售价 OR @Original_售价 IS NULL AND saleprice IS NULL) AND (stocks = @Original_存货量)";
this.sqlDeleteCommand1.Connection = this.sqlConnection_Staff;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_商品ID", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "商品ID", 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.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(8)), ((System.Byte)(2)), "进价", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_售价", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(8)), ((System.Byte)(2)), "售价", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_存货量", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(8)), ((System.Byte)(2)), "存货量", System.Data.DataRowVersion.Original, null));
//
// ViewItem
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(680, 397);
this.Controls.Add(this.dataGrid_View);
this.Controls.Add(this.tbID);
this.Controls.Add(this.label1);
this.Controls.Add(this.groupBox1);
this.ForeColor = System.Drawing.Color.Red;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "ViewItem";
this.Text = "查看信息_总部";
((System.ComponentModel.ISupportInitialize)(this.dataGrid_View)).EndInit();
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataSetView)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void bView_Click(object sender, System.EventArgs e)
{
String ID=tbID.Text.ToString().Trim();
if(ID.Length==0)
{
MessageBox.Show("ID不能为空!");
return;
}
dataSetView.Clear();
switch(choose)
{
case 1:
{
sqlDataAdapter_Staff.SelectCommand.CommandText=
"SELECT staffid AS 员工ID, staffname AS 姓名, gender AS 性别, staffkind AS 职称, salary AS 工资, staffphone AS 联系电话 FROM Staff where staffid= '"+ID+"'";
sqlDataAdapter_Staff.Fill(dataSetView);
break;
}
case 2:
{
sqlDataAdapter_Comm.SelectCommand.CommandText=
"SELECT commid AS CID, comname AS 名称, commkind AS 类型, saleprice AS 售价, purprice AS 进价, stocks AS 库存量, warehouse AS 所在分店 FROM Commodity where commid='"+ID+"'";
sqlDataAdapter_Comm.Fill(dataSetView);
break;
}
case 3:
{
sqlDataAdapter_Vip.SelectCommand.CommandText=
"SELECT vipid AS 会员ID, vidname AS 姓名, vipphone AS 联系电话, discount AS 折扣, consume AS 积分 FROM Vip where vipid='"+ID+"'";
sqlDataAdapter_Vip.Fill(dataSetView);
break;
}
}
dataGrid_View.DataSource=dataSetView.Tables[0];
dataGrid_View.Refresh();
}
private void btExit_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void bViewAll_Click(object sender, System.EventArgs e)
{
dataSetView.Clear();
switch(choose)
{
case 1:
{
sqlDataAdapter_Staff.Fill(dataSetView);
break;
}
case 2:
{
sqlDataAdapter_Comm.Fill(dataSetView);
dataGrid_View.DataSource=dataSetView.Tables[0];
break;
}
case 3:
{
sqlDataAdapter_Vip.Fill(dataSetView);
DataTable temp=dataSetView.Tables[0];
break;
}
}
dataGrid_View.DataSource=dataSetView.Tables[0];
dataGrid_View.Refresh();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -