📄 selllistfrm.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace BookStore.Forms
{
public partial class SellListFrm : Form
{
//存储从Search窗体传回的信息
public static string[] headInfo = new string[] { null, null, null, null, null, null, null };
private DataTable newTable;
public SellListFrm()
{
InitializeComponent();
SetStatusControl();
}
private void toolbar_ButtonClick(object sender, ToolBarButtonClickEventArgs e)
{
if (e.Button.ToolTipText == "搜索")
{
Search newFrm = new Search();
newFrm.ShowDialog();
SetHeadData();
SetBodyInfo();
}
}
private void SetStatusControl()
{
newTable = new DataTable();
newTable.Columns.Add("销售单号", typeof(int));
newTable.Columns.Add("商品序号", typeof(int));
newTable.Columns.Add("商品名称", typeof(string));
newTable.Columns.Add("单价", typeof(decimal));
newTable.Columns.Add("数量", typeof(int));
newTable.Columns.Add("金额", typeof(decimal));
this.dg_SellDetail.DataSource = newTable;
newTable.Rows.Add(newTable.NewRow());
}
private void SetHeadData()
{
this.tb_SellID.Text = headInfo[0];
this.tb_CustomerName.Text = headInfo[1];
this.tb_Employee.Text = headInfo[2];
this.tb_TotalPrice.Text = headInfo[3];
this.tb_SellTime.Text = headInfo[4];
this.tb_Tax.Text = headInfo[5];
this.tb_NoTax.Text = headInfo[6];
}
private void SetBodyInfo()
{
if (tb_SellID.Text != "")
{
int SellID = int.Parse(this.tb_SellID.Text.ToString().Trim());
DataTable tempTable = new DataTable();
string select = "select sellID,ProductsID,ProductName,UnitPrice,Quantity,TotalPrice from sellDetails where sellID=" + SellID;
tempTable = DataAccess.Narnu.GetDataTableBySql(select);
for (int i = 0; i < tempTable.Rows.Count; i++)
{
newTable.Rows.Add(newTable.NewRow());
for (int j = 0; j < tempTable.Columns.Count; j++)
{
newTable.Rows[i][j] = tempTable.Rows[i][j].ToString().Trim();
}
}
}
else
{
MessageBox.Show("你没有选择任何销售单!");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -