//反填 public ZG FanNewsZX(int Id) { string sql = $"select * from ZhengGe where ZGid={Id}"; var dt = DBHelper.ExecuteQuery(sql, System.Data.CommandType.Text); string str = JsonConvert.SerializeObject(dt); ZG z = JsonConvert.DeserializeObject <List <ZG> >(str).FirstOrDefault(); return(z); }
private void button1_Click(object sender, EventArgs e) { Action UDP = new Action(() => { while (true) { try { double x = 0; bytes = listener.Receive(ref groupEP); Thread.Sleep(1); if (i < (bytes.GetLength(0) - 1)) { i++; } if (i > 65535) { i = 0; } Heart_rate = bytes[i]; if (Heart_rate < 90 && Heart_rate > 50) { B.Add(Heart_rate); } x = Heart_rate_curve.Points.Count; Heart_rate_curve.AddPoint(x, B[(B.Count - 1)]); ZG.AxisChange(); ZG.Invalidate(); } catch { } } }); UDP.BeginInvoke(null, null); }
//修改 public int ZGUpd(ZG z) { string sql = $"Update ZhengGe set ZGlei='{z.ZGlei}',ZGTitle='{z.ZGTitle}',ZGmiao='{z.ZGmiao}',ZGimg='{z.ZGimg}',ZGShiPin='{z.ZGShiPin}',ZGnei='{z.ZGnei}',ZGjLY='{z.ZGjLY}',ZGurl='{z.ZGurl}' where ZGid={z.ZGid}"; return(DBHelper.ExecuteNonQuery(sql, System.Data.CommandType.Text)); }
//添加 public int ZGAdd(ZG z) { string sql = $"insert into ZhengGe(ZGlei,ZGTitle,ZGmiao,ZGimg,ZGShiPin,ZGnei,ZGjLY,ZGurl) values('{z.ZGlei}','{z.ZGTitle}','{z.ZGmiao}','{z.ZGimg}','{z.ZGShiPin}','{z.ZGnei}','{z.ZGjLY}','{z.ZGlei}')"; return(DBHelper.ExecuteNonQuery(sql, System.Data.CommandType.Text)); }