public TableData dataToJson() { var blist = BloodOxygenBLL.GetAllList(); TableData td = new TableData(); td.count = blist.Count; td.data = JsonConvert.SerializeObject(blist); return(td); }
public string dataToJson(string username) { List <BloodOxygen> blist = BloodOxygenBLL.GetDatasByName(username); DATA data1 = new DATA(); DATA data2 = new DATA(); DATAT datat = new DATAT(); datat.yang = data1; datat.xue = data2; blist.ForEach((a) => { data1.srange.Add((int)a.T3001005_srange); data1.lrange.Add((int)a.T3001005_lrange); data1.bloodoxygenvalue.Add((int)a.T3001005_value); data2.srange.Add((int)a.T3001009_srange); data2.lrange.Add((int)a.T3001009_lrange); data2.bloodoxygenvalue.Add((int)a.T3001009_value); }); return(JsonConvert.SerializeObject(datat)); }