内容发布更新时间 : 2024/11/2 16:38:11星期一 下面是文章的全部内容请认真阅读。
湖南文理学院本科毕业设计(论文) 第5章 系统实现
}
if (flag == 2) {
string ID =
Stock.Rows[this.dgvStock.CurrentCell.RowIndex ][0].ToString().Trim(); strUpdate = \ Stock set StockName ='\
txtStockName.Text.Trim() + \ \
cmbStockManagerNum.Text.ToString().Trim() + \txtStockManager.Text.Trim() +
\
txtStockManagerTel.Text.Trim() + \where StockID=\
this.link.UpdateDataBase(strUpdate); dgvStock.DataSource = Stock; dgvStock.Refresh(); }
if (flag == 3) {
string ID =
Stock.Rows[this.dgvStock.CurrentCell.RowIndex][0].ToString().Trim();
strUpdate = \ from Stock Where StockID=\ this.link.UpdateDataBase(strUpdate); dgvStock.DataSource = Stock; dgvStock.Refresh(); }
flag = -1;
}
private void btnCancel_Click(object sender, EventArgs e) {
this.changeEnabled();
this.bindControls (Stock,dgvStock .CurrentCell.RowIndex ); if(flag ==1)
for (int i=0;i -35- 湖南文理学院本科毕业设计(论文) 第5章 系统实现 } private void dgvStock_MouseUp(object sender, MouseEventArgs e) { int row = dgvStock.CurrentCell.RowIndex; try { this.bindControls(Stock, row); } catch { MessageBox.Show(\出错信息\ } } private void dgvStock_DoubleClick(object sender, EventArgs e) { } private void dgvStock_CellClick(object sender, DataGridViewCellEventArgs e) { if (this.dgvStock.ReadOnly == true)//判断如果是在进货单中生成的窗体则响应DataGrid的双击事件 { int intCurrentRowNumber = this.dgvStock.CurrentCell.RowIndex; string sendStokerID; sendStokerID = this.dgvStock[ 0,e.RowIndex].Value.ToString().Trim(); //stock_ProStock.stockID = sendStokerID; this.Close(); } } } -36- 湖南文理学院本科毕业设计(论文) 第5章 系统实现 3库存汇总信息及代码,如图5.5 图5.5 库存汇总信息 public partial class stock_StockHistoryStatistic : Form { public stock_StockHistoryStatistic() { InitializeComponent(); } DataSet newDataset=new DataSet (); DataTable newTable=new DataTable (); LinkDataBase link=new LinkDataBase (); string SendStr = \ ProStockBak.StockID,Stock.StockName,Stock.StockAddress,Stock.StockManager,Stock.StockManagerTEL\ \ProStockBak.StockID=Stock.StockID \ //填充仓库名称及设置表格格式 private void fillCombox() { string str = \ StockName from Stock \ DataTable tempTable=new DataTable (); tempTable = this.link.SelectDataBase(str); for (int i = 0; i < tempTable.Rows.Count; i++) cmbStockNO.Items.Add(tempTable.Rows[i][0].ToString().Trim()); -37- 湖南文理学院本科毕业设计(论文) 第5章 系统实现 } private void stock_StockHistoryStatistic_Load(object sender, EventArgs e) { fillCombox (); DataGridStateControl(); } //---------绑定数据并设置表格各列的属性 private void DataGridStateControl() { newTable.Columns.Add(\仓库编号\ newTable.Columns.Add(\仓库名称\ newTable.Columns.Add(\仓库地址\ newTable.Columns.Add(\仓库管理人\ newTable.Columns.Add(\电话\ newTable.Columns.Add(\库存总数量\ newTable.Columns.Add(\时间\ dgvStockStatistic.DataSource =newTable; DataGridViewCellStyle style = new DataGridViewCellStyle(); style.BackColor = Color.Beige; style.ForeColor = Color.Brown; dgvStockStatistic.AlternatingRowsDefaultCellStyle = style; dgvStockStatistic.SelectionMode = DataGridViewSelectionMode.FullRowSelect; for (int i = 0; i < newTable.Columns.Count; i++) dgvStockStatistic.Columns[i].Width = 130; } private void btnDisplay_Click(object sender, EventArgs e) { string str1 = dtpEndTime.Value.ToShortDateString().Trim().ToString() + \ DateTime dtEnd = DateTime.Parse(str1.Trim()); DataTable tempTable=new DataTable (); str1 = dtpStartTime.Value.ToShortDateString().Trim().ToString() + \00:00:00\ -38- 湖南文理学院本科毕业设计(论文) 第5章 系统实现 DateTime dtStart = DateTime.Parse(str1.Trim()); string TimeInterval = \where BakDateTime between '\ tempTable = this.link.SelectDataBase(TimeInterval); DataTable tempTable1=new DataTable(); DataTable tempTable2 = new DataTable(); newTable.Clear (); for (int i=0 ;i //统计仓库中货物的数量 str1 = \ProStockBak,Stock where ProStockBak.StockID = Stock.StockID and Stock.StockName='\ cmbStockNO.Text.ToString().Trim() + \ ProStockBak.BakDateTime = '\ \ newDataset = this.link.SelectDataBase(str1, \ tempTable1 = this.newDataset.Tables[0]; int num = 0; if(tempTable1 .Rows .Count!=0) num = int.Parse (tempTable1.Rows[0][0].ToString ().Trim ()); newDataset = this.link.SelectDataBase( SendStr + \ Stock.StockName='\ \ ProStockBak.BakDateTime ='\tempTable.Rows[i][0].ToString().Trim() + \ tempTable2=this.newDataset.Tables[0]; newTable.Rows.Add(newTable.NewRow()); int k = tempTable1.Rows.Count; for(int j=0;j newTable.Rows[i][0] = tempTable2.Rows[j][1]; newTable.Rows[i][1] = tempTable2.Rows[j][2].ToString().Trim(); newTable.Rows[i][2] = tempTable2.Rows[j][3].ToString().Trim(); newTable.Rows[i][3] = tempTable2.Rows[j][4].ToString().Trim(); newTable.Rows[i][4] = tempTable2.Rows[j][5].ToString().Trim(); newTable.Rows[i][5] = num; -39-