private void Form2_Closing(object sender, CancelEventArgs e) { if (tableQuery != null && tableQuery.Rows.Count > 0) { SmartDeviceProjectBll.Bll.ConnecBll _bll = new SmartDeviceProjectBll.Bll.ConnecBll(); _bll.signOfLi(tableQuery); } }
/// <summary> /// 删除所有内容 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCAll_Click(object sender, EventArgs e) { if (tableQuery != null && tableQuery.Rows.Count > 0) { SmartDeviceProjectBll.Bll.ConnecBll _bll = new SmartDeviceProjectBll.Bll.ConnecBll(); _bll.signOfLi(tableQuery); } this.dataGrid1.DataSource = null; tableQuery = null; }
//添加 private void btnAdd_Click_1(object sender, EventArgs e) { Form3 from = new Form3(storageChois); if (from.ShowDialog() == DialogResult.OK) { SmartDeviceProjectBll.Bll.ConnecBll _bll = new SmartDeviceProjectBll.Bll.ConnecBll(); string lotId = from.getLotId; string orderNum = from.getOrderNum; string ckNum = from.getNum; if (tableQuery == null || tableQuery.Rows.Count < 1) { tableQuery = _bll.GetDataTableOfLot(lotId); if (tableQuery.Rows.Count > 0) { tableQuery.Columns.Add("IBB001", typeof(System.String)); tableQuery.Rows[0][5] = orderNum; tableQuery.Rows[0][4] = ckNum; } } else { DataTable da = new DataTable(); da = _bll.GetDataTableOfLot(lotId); if (da != null && da.Rows.Count > 0) { tableQuery.Rows.Add(da.Rows[0]["BAR001"].ToString(), da.Rows[0]["BAR004"].ToString(), da.Rows[0]["BAR008"].ToString(), da.Rows[0]["BAR007"].ToString(), ckNum, orderNum); } } dataGrid1.DataSource = tableQuery; this.userControlButton1.labSum.Text = "合计:" + tableQuery.Rows.Count + " 条记录"; _bll.signOfLi(lotId); } }