示例#1
0
        /// <summary>
        /// 绑定训练记录
        /// </summary>
        /// <param name="patientId">病人ID</param>
        public void BindExerciserecord(string patientId)
        {
            ExItemDemoList = new ObservableCollection<ExItemDemo>();
            DataTable tbl = new DataTable();
            tbl.Columns.Add("ExItemId", typeof(string));      // 动作ID   0 
            tbl.Columns.Add("ExItemName", typeof(string));    // 动作名称 1 

            var list = from od in MySession.Query<Exerciserecord>()
                       where od.PatientId == patientId
                       select od;
            var temp = from a in list
                       group a by new
                       {
                           a.PatientId,
                           a.ActionId
                       } into p
                       select new
                       {
                           pid = p.Key.PatientId,
                           ActionId = p.Key.ActionId
                       };

            foreach (var item in temp)
            {
                string result = GetActionTypeName(item.ActionId.ToString());
                tbl.Rows.Add(item.ActionId, result);
            }

            if (tbl.Rows.Count > 0)
            {
                ExItemDemoList.Clear();
                if (tbl.Rows.Count > 0)
                {
                    for (int i = 0; i < tbl.Rows.Count; i++)
                    {
                        DataRow dr = tbl.Rows[i];
                        ExItemDemo item = new ExItemDemo();
                        item.ExItemId = dr[0].ToString();
                        item.ExItemName = dr[1].ToString();
                        ExItemDemoList.Add(item);
                    }
                }
            }

            gvItem.ItemsSource = ExItemDemoList;
        }
示例#2
0
 private void gvItem_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     int index = gvItem.SelectedIndex;
     if (index != -1)
     {
         myItem = gvItem.SelectedItem as ExItemDemo;
     }
 }