public bool InsertDataELP(ELPData data) { bool isOk = false; cmd.CommandText = "INSERT INTO ELP VALUES('" + data.Date + "'" + ",'" + data.PointNo + "', '" + data.MeaNo + "', '" + data.Read1 + "', '" + data.Read2 + "', '" + data.Read3 + "'" + ", '" + data.Value + "', '" + data.Initial + "', '" + data.Normal + "', '" + data.ReM + "', '" + data.Sensor + "')"; con.Open(); read = cmd.ExecuteReader(); isOk = read.HasRows ? true : isOk; read.Close(); con.Close(); return(isOk); }
//elp data public List <ELPData> GetELPData(string from = "", string to = "") { List <ELPData> list = new List <ELPData>(); DataTable DataList = new DataTable(); if (from != "") { cmd.CommandText = "SELECT * FROM ELP WHERE [Date] between '" + from + "' AND '" + to + "'"; } else { cmd.CommandText = "SELECT * FROM ELP"; } adapter = new SqlDataAdapter(cmd); adapter.Fill(DataList); foreach (DataRow item in DataList.Rows) { ELPData data = new ELPData(); data.PointNo = item["PointNo"].ToString(); data.Date = item["Date"].ToString(); data.MeaNo = item["MeaNo"].ToString(); data.Read1 = (item["Read1"]).ToString(); data.Read2 = (item["Read2"]).ToString(); data.Read3 = (item["Read3"]).ToString(); data.Value = (item["Value"]).ToString(); data.Initial = (item["Initial"]).ToString(); data.Normal = (item["Normal"]).ToString(); data.ReM = item["ReM"].ToString(); data.Sensor = item["Sensor"].ToString(); list.Add(data); } return(list); }
public static bool UpdateData(string date, string pointNo, string meaNo, string read1, string read2, string read3, string value, string initial, string normal, string reM, string sensor) { bool isOk = false; if (HttpContext.Current.Session["user"] == null) { return(isOk); } PostDataADO post = new PostDataADO(); ELPData data = new ELPData(date, pointNo, meaNo, read1, read2, read3, value, initial, normal, reM, sensor); post.UpdateDataELP(data); isOk = true; return(isOk); }
public bool UpdateDataELP(ELPData data) { bool isOk = false; cmd.CommandText = "UPDATE ELP " + "SET [MeaNo] = '" + data.MeaNo + "',[Read1] = '" + data.Read1 + "',[Read2] = '" + data.Read2 + "',[Read3] = '" + data.Read3 + "',[Value] = '" + data.Value + "',[Initial] = '" + data.Initial + "',[Normal] = '" + data.Normal + "',[ReM] = '" + data.ReM + "',[Sensor] = '" + data.Sensor + "' WHERE [PointNo] = '" + data.PointNo + "' AND datediff(day, [Date], '" + data.Date + "') = 0"; con.Open(); read = cmd.ExecuteReader(); isOk = read.HasRows ? true : isOk; read.Close(); con.Close(); return(isOk); }