/// <summary> /// 绑定曲伸Fit记录 /// </summary> /// <param name="patientId"></param> public void BindFitResultQPower(string patientId) { FitResultQList = new ObservableCollection<FitResultQ>(); DataTable tbl = new DataTable(); tbl.Columns.Add("Index", typeof(string)); //行号 0 tbl.Columns.Add("Time", typeof(string)); //训练时间 1 tbl.Columns.Add("MaxtValue", typeof(string)); //最大值 2 tbl.Columns.Add("MinValue", 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.ProtrusiveOrBendStrengthEvaluation) 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) { FitResultQList.Clear(); if (tbl.Rows.Count > 0) { for (int i = 0; i < tbl.Rows.Count; i++) { DataRow dr = tbl.Rows[i]; FitResultQ item = new FitResultQ(); item.DayIndex = dr[0].ToString(); item.DayTime = dr[1].ToString(); item.MaxValue = dr[2].ToString(); item.MinValue = dr[3].ToString(); item.ModeId = dr[4].ToString(); FitResultQList.Add(item); } } } }
private void gvProtrusiveOrBendFit_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (gvProtrusiveOrBendFit.SelectedIndex != -1) { gvRotationFit.SelectedIndex = -1; } FitResultQ = this.gvProtrusiveOrBendFit.SelectedItem as FitResultQ; if (FitResultQ != null) { fitDialog = new ShowFitChartDialog(); fitDialog.Parent = this; ShowFitChartView child = new ShowFitChartView(FitResultQ.DayTime, FitResultQ.ModeId); child.DayTime = FitResultQ.DayTime; child.ModeId = FitResultQ.ModeId; child.FitName = EnumHelper.GetEnumItemName(Convert.ToInt32(FitResultQ.ModeId), typeof(FitModeEnum)).ToString(); child.Close += new EventHandler(FitResultQchild_Close); fitDialog.Content = child; fitDialog.Show(); } }