private void ResultViewForm_Load(object sender, EventArgs e) { dgvResult.AutoGenerateColumns = false; dgvData.AutoGenerateColumns = false; _dbOperator = new DbOperator(); _dbOperator.DbFilePath = Application.StartupPath + "\\Result.mdb"; _jumpDal = new JumpPointsDAL(_dbOperator.DbFilePath); _totalFileDal = new TotalFileDAL(_dbOperator.DbFilePath); BindResultData(); jumpPoints.Clear(); _chartScatterConfig.AxesXStep = 10; _chartScatterConfig.AxesYStep = 50; _chartScatterConfig.ChartTitle = "跳变值散点图"; _chartScatterConfig.AxesXTitle = "里程"; _chartScatterConfig.AxesYTitle = "采样点差值"; _chartColumnConfig.AxesXMin = -400; _chartColumnConfig.AxesXStep = 10; _chartColumnConfig.AxesXMax = 400; _chartColumnConfig.AxesYMin = 0; _chartColumnConfig.AxesYStep = 1; _chartColumnConfig.ChartTitle = "跳变值柱状图"; _chartColumnConfig.AxesXTitle = "差值区间"; _chartColumnConfig.AxesYTitle = "跳变点个数"; }
//查看中的左边的展示框--中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); }
public string SaveIndexPoint(string json) { //公共方法 ResultInfo resultInfo = new ResultInfo(); try { //此处需要改动,传入应该是一个list的json JObject obj = (JObject)JsonConvert.DeserializeObject(json); string geofile = Convert.ToString(obj["geofile"]); string LineName = Convert.ToString(obj["LineName"]); //线路名 string Train = Convert.ToString(obj["Train"]); //轨检车型号 int jumpvalue = Convert.ToInt32(obj["jumpvalue"].ToString()); List <JumpPoints> listPoints = GadgetList(geofile, jumpvalue); if (listPoints.Count > 0) { TotalFileDAL totalFileDal = new TotalFileDAL(Constpath); TotalFile file = new TotalFile(); file.TotalLength = totalLength; file.LineName = LineName; if (Train != null) { file.TrainCode = Train; } file.GeoFileName = geofile; file.ResultTableName = "Result" + file.LineName + file.TrainCode + DateTime.Now.ToString("yyyyMMddHHmmss"); totalFileDal.Add(file); JumpPointsDAL jumpDal = new JumpPointsDAL(Constpath); jumpDal.CreateTable(Constpath, file.ResultTableName); jumpDal.DeleteAll(file.ResultTableName); for (int i = 0; i < listPoints.Count; i++) { jumpDal.Add(listPoints[i], file.ResultTableName); } resultInfo.flag = 1; resultInfo.msg = "成功"; resultInfo.data = Application.StartupPath + "\\" + Constpath; } else { } } catch (Exception ex) { throw ex; } return(JsonConvert.SerializeObject(resultInfo)); }
//查看中左下方的页面的展示 private List <JumpPoints> leftBelowList(string tableName, string Train, string txtLineName, string geofile)//返回的是结果集 //string tableName = "";//geo文件 // { List <TotalFile> totalData = leftlist(Train, txtLineName, geofile); List <JumpPoints> jumpPoints = new List <JumpPoints>(); if (totalData.Count > 0) { IOperator _dbOperator = new DbOperator(); _dbOperator.DbFilePath = Constpath; JumpPointsDAL _jumpDal = new JumpPointsDAL(_dbOperator.DbFilePath); jumpPoints = _jumpDal.Load(tableName); } return(jumpPoints); }
/// <summary> /// 保存索引点按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnWriteData_Click(object sender, EventArgs e) { try { if (listPoints.Count > 0) { btnWriteData.Enabled = false; TotalFileDAL totalFileDal = new TotalFileDAL(folderPath); TotalFile file = new TotalFile(); file.TotalLength = totalLength; file.LineName = this.txtLineName.Text.Trim(); if (cbxTrain.SelectedItem != null && !string.IsNullOrEmpty(cbxTrain.SelectedItem.ToString())) { file.TrainCode = this.cbxTrain.SelectedItem.ToString(); } file.GeoFileName = geoFileName; file.ResultTableName = "Result" + file.LineName + file.TrainCode + DateTime.Now.ToString("yyyyMMddHHmmss"); totalFileDal.Add(file); JumpPointsDAL jumpDal = new JumpPointsDAL(folderPath); jumpDal.CreateTable(folderPath, file.ResultTableName); jumpDal.DeleteAll(file.ResultTableName); for (int i = 0; i < listPoints.Count; i++) { jumpDal.Add(listPoints[i], file.ResultTableName); } MessageBox.Show("保存完成!"); btnWriteData.Enabled = true; } else { MessageBox.Show("不存在跳变点,请先计算!"); } } catch (Exception ex) { btnWriteData.Enabled = true; MessageBox.Show("保存数据出错:" + ex.Message); } }