private void BindResultData() { List <TotalFile> totalData = _totalFileDal.GetList(_totalFile.LineName, _totalFile.TrainCode); dgvResult.DataSource = null; dgvResult.Rows.Clear(); //var table = totalData.AsEnumerable(); //if (!string.IsNullOrEmpty(_totalFile.LineName)) //{ // table = from r in table // where r.LineName == _totalFile.LineName // select r; //} //if (!string.IsNullOrEmpty(_totalFile.TrainCode)) //{ // table = from r in table // where r.TrainCode == _totalFile.TrainCode // select r; //} if (totalData.Count > 0) { dgvResult.DataSource = totalData; } else { Task.Factory.StartNew(() => { Thread.Sleep(200); MessageBox.Show("未找到数据"); }); } }
//查看中的左边的展示框--中list集合的返回 private List <TotalFile> leftlist(string Train, string txtLineName, string geoFileName) { TotalFile file = new TotalFile(); try { file.LineName = txtLineName; if (Train != null) { file.TrainCode = Train.ToString().Replace("-", "_"); } else { file.TrainCode = ""; } file.GeoFileName = geoFileName; } catch (Exception ex) { throw ex; } IOperator _dbOperator = new DbOperator(); _dbOperator.DbFilePath = Constpath; JumpPointsDAL _jumpDal = new JumpPointsDAL(_dbOperator.DbFilePath); TotalFileDAL _totalFileDal = new TotalFileDAL(_dbOperator.DbFilePath); List <TotalFile> totalData = _totalFileDal.GetList(file.LineName, file.TrainCode);//得到了数据集 return(totalData); }