/// <summary> /// 绑定旋转Fit记录 /// </summary> /// <param name="patientId"></param> public void BindFitResultXPower(string patientId) { FitResultXList = new ObservableCollection<FitResultX>(); DataTable tbl = new DataTable(); tbl.Columns.Add("Index", typeof(string)); //行号 0 tbl.Columns.Add("Time", typeof(string)); //训练时间 1 tbl.Columns.Add("LeftValue", typeof(string)); // 左 2 tbl.Columns.Add("RightValue", typeof(string)); // 右 3 tbl.Columns.Add("ModeId", typeof(string)); //模式名称 4 int count = 0; var listX = from od in MySession.Query<FitRecord>() where od.PatientID == patientId && od.ModeID == Convert.ToInt32(FitModeEnum.RotationStrengthEvaluation) select od; var temp = from a in listX group a by new { a.PatientID, a.CreateTime, a.MaxAngle, a.MinAngle, a.ModeID } into p select new { pid = p.Key.PatientID, exerciseDate = p.Max(b => b.CreateTime), p.Key.MaxAngle, p.Key.MinAngle, p.Key.ModeID }; foreach (var item in temp) { count++; tbl.Rows.Add(count.ToString(), Convert.ToDateTime(item.exerciseDate).ToString("yyyy-MM-dd"), item.MaxAngle, item.MinAngle, item.ModeID); } //按照日期查询数据库 if (tbl.Rows.Count > 0) { FitResultXList.Clear(); if (tbl.Rows.Count > 0) { for (int i = 0; i < tbl.Rows.Count; i++) { DataRow dr = tbl.Rows[i]; FitResultX item = new FitResultX(); item.DayIndex = dr[0].ToString(); item.DayTime = dr[1].ToString(); item.LeftValue = dr[2].ToString(); item.RightValue = dr[3].ToString(); item.ModeId = dr[4].ToString(); FitResultXList.Add(item); } } } }
private void gvRotationFit_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (gvRotationFit.SelectedIndex != -1) { gvProtrusiveOrBendFit.SelectedIndex = -1; } FitResultX = this.gvRotationFit.SelectedItem as FitResultX; if (FitResultX != null) { fitDialog = new ShowFitChartDialog(); fitDialog.Parent = this; ShowFitChartView child = new ShowFitChartView(FitResultX.DayTime, FitResultX.ModeId); child.DayTime = FitResultX.DayTime; child.ModeId = FitResultX.ModeId; child.FitName = EnumHelper.GetEnumItemName(Convert.ToInt32(FitResultX.ModeId), typeof(FitModeEnum)).ToString(); child.Close += new EventHandler(FitResultXchild_Close); fitDialog.Content = child; fitDialog.Show(); } }