private void RefreshDt(string dtName) { DataSet ds = null; switch (dtName) { case "设备表": { ds = devBll.GetAllList(); break; } case "控制任务表": { ds = ctlTaskBll.GetAllList(); break; } case "料框数据表": { ds = palletBll.GetAllList(); break; } case "电芯数据表": { ds = batteryBll.GetAllList(); break; } case "管理任务表": { ds = manTaskBll.GetAllList(); break; } default: break; } if (ds != null && ds.Tables.Count > 0) { this.dataGridViewDt.DataSource = ds.Tables[0]; } }
private void DeleteEventHandler(object sender, DeleteEventArgs e) { int deleteSure = this.View.AskMessBox("您确定要删除选中数据么?"); if (deleteSure == 0) { switch (e.EnumDataList) { case EnumDataList.管理任务表: for (int i = 0; i < e.ListID.Count(); i++) { bool deleteStatus = bllManaTask.Delete(e.ListID[i]); } DataSet dsManaTask = bllManaTask.GetAllList(); if (dsManaTask != null && dsManaTask.Tables.Count > 0) { DataTable dtManaTask = dsManaTask.Tables[0]; this.View.RefreshDataList(dtManaTask, e.EnumDataList); } break; case EnumDataList.控制接口表: for (int i = 0; i < e.ListID.Count(); i++) { bool deleteStatus = bllControlInter.Delete(e.ListID[i]); } DataSet dsControlInter = bllControlInter.GetAllList(); if (dsControlInter != null && dsControlInter.Tables.Count > 0) { DataTable dtControlInter = dsControlInter.Tables[0]; this.View.RefreshDataList(dtControlInter, e.EnumDataList); } break; case EnumDataList.控制任务表: for (int i = 0; i < e.ListID.Count(); i++) { bool deleteStatus = bllControlTask.Delete(e.ListID[i]); } DataSet dsControlTask = bllControlTask.GetAllList(); if (dsControlTask != null && dsControlTask.Tables.Count > 0) { DataTable dtControlTask = dsControlTask.Tables[0]; this.View.RefreshDataList(dtControlTask, e.EnumDataList); } break; case EnumDataList.库存列表: for (int i = 0; i < e.ListID.Count(); i++) { bool deleteStatus = bllStockList.Delete(e.ListID[i]); } DataSet dsStockList = bllStockList.GetAllList(); if (dsStockList != null && dsStockList.Tables.Count > 0) { DataTable dtStockList = dsStockList.Tables[0]; this.View.RefreshDataList(dtStockList, e.EnumDataList); } break; default: break; } } }