/// <summary> /// 更新一条数据 /// </summary> public bool Update(ALS.Model.pressure_data model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update pressure_data set "); strSql.Append("surgery_no=@surgery_no,"); strSql.Append("time_stamp=@time_stamp,"); strSql.Append("in_blood_pressure=@in_blood_pressure,"); strSql.Append("plasma_inlet_pressure=@plasma_inlet_pressure,"); strSql.Append("arterial_pressure=@arterial_pressure,"); strSql.Append("venous_pressure=@venous_pressure,"); strSql.Append("plasma_pressure=@plasma_pressure,"); strSql.Append("transmembrane_pressure=@transmembrane_pressure,"); strSql.Append("plasma2_pressure=@plasma2_pressure"); strSql.Append(" where surgery_no=@surgery_no and time_stamp=@time_stamp and in_blood_pressure=@in_blood_pressure and plasma_inlet_pressure=@plasma_inlet_pressure and arterial_pressure=@arterial_pressure and venous_pressure=@venous_pressure and plasma_pressure=@plasma_pressure and transmembrane_pressure=@transmembrane_pressure and plasma2_pressure=@plasma2_pressure "); MySqlParameter[] parameters = { new MySqlParameter("@surgery_no", MySqlDbType.VarChar, 255), new MySqlParameter("@time_stamp", MySqlDbType.VarChar, 255), new MySqlParameter("@in_blood_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@plasma_inlet_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@arterial_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@venous_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@plasma_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@transmembrane_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@plasma2_pressure", MySqlDbType.VarChar, 255) }; parameters[0].Value = model.surgery_no; parameters[1].Value = model.time_stamp; parameters[2].Value = model.in_blood_pressure; parameters[3].Value = model.plasma_inlet_pressure; parameters[4].Value = model.arterial_pressure; parameters[5].Value = model.venous_pressure; parameters[6].Value = model.plasma_pressure; parameters[7].Value = model.transmembrane_pressure; parameters[8].Value = model.plasma2_pressure; int rows = DbHelperMySQL_Data.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public ALS.Model.pressure_data DataRowToModel(DataRow row) { ALS.Model.pressure_data model = new ALS.Model.pressure_data(); if (row != null) { if (row["surgery_no"] != null) { model.surgery_no = row["surgery_no"].ToString(); } if (row["time_stamp"] != null) { model.time_stamp = row["time_stamp"].ToString(); } if (row["in_blood_pressure"] != null) { model.in_blood_pressure = row["in_blood_pressure"].ToString(); } if (row["plasma_inlet_pressure"] != null) { model.plasma_inlet_pressure = row["plasma_inlet_pressure"].ToString(); } if (row["arterial_pressure"] != null) { model.arterial_pressure = row["arterial_pressure"].ToString(); } if (row["venous_pressure"] != null) { model.venous_pressure = row["venous_pressure"].ToString(); } if (row["plasma_pressure"] != null) { model.plasma_pressure = row["plasma_pressure"].ToString(); } if (row["transmembrane_pressure"] != null) { model.transmembrane_pressure = row["transmembrane_pressure"].ToString(); } if (row["plasma2_pressure"] != null) { model.plasma2_pressure = row["plasma2_pressure"].ToString(); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(ALS.Model.pressure_data model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into pressure_data("); strSql.Append("surgery_no,time_stamp,in_blood_pressure,plasma_inlet_pressure,arterial_pressure,venous_pressure,plasma_pressure,transmembrane_pressure,plasma2_pressure)"); strSql.Append(" values ("); strSql.Append("@surgery_no,@time_stamp,@in_blood_pressure,@plasma_inlet_pressure,@arterial_pressure,@venous_pressure,@plasma_pressure,@transmembrane_pressure,@plasma2_pressure)"); MySqlParameter[] parameters = { new MySqlParameter("@surgery_no", MySqlDbType.VarChar, 255), new MySqlParameter("@time_stamp", MySqlDbType.VarChar, 255), new MySqlParameter("@in_blood_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@plasma_inlet_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@arterial_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@venous_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@plasma_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@transmembrane_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@plasma2_pressure", MySqlDbType.VarChar, 255) }; parameters[0].Value = model.surgery_no; parameters[1].Value = model.time_stamp; parameters[2].Value = model.in_blood_pressure; parameters[3].Value = model.plasma_inlet_pressure; parameters[4].Value = model.arterial_pressure; parameters[5].Value = model.venous_pressure; parameters[6].Value = model.plasma_pressure; parameters[7].Value = model.transmembrane_pressure; parameters[8].Value = model.plasma2_pressure; int rows = DbHelperMySQL_Data.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public ALS.Model.pressure_data GetModel(string surgery_no, string time_stamp, string in_blood_pressure, string plasma_inlet_pressure, string arterial_pressure, string venous_pressure, string plasma_pressure, string transmembrane_pressure, string plasma2_pressure) { StringBuilder strSql = new StringBuilder(); strSql.Append("select surgery_no,time_stamp,in_blood_pressure,plasma_inlet_pressure,arterial_pressure,venous_pressure,plasma_pressure,transmembrane_pressure,plasma2_pressure from pressure_data "); strSql.Append(" where surgery_no=@surgery_no and time_stamp=@time_stamp and in_blood_pressure=@in_blood_pressure and plasma_inlet_pressure=@plasma_inlet_pressure and arterial_pressure=@arterial_pressure and venous_pressure=@venous_pressure and plasma_pressure=@plasma_pressure and transmembrane_pressure=@transmembrane_pressure and plasma2_pressure=@plasma2_pressure "); MySqlParameter[] parameters = { new MySqlParameter("@surgery_no", MySqlDbType.VarChar, 255), new MySqlParameter("@time_stamp", MySqlDbType.VarChar, 255), new MySqlParameter("@in_blood_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@plasma_inlet_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@arterial_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@venous_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@plasma_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@transmembrane_pressure", MySqlDbType.VarChar, 255), new MySqlParameter("@plasma2_pressure", MySqlDbType.VarChar, 255) }; parameters[0].Value = surgery_no; parameters[1].Value = time_stamp; parameters[2].Value = in_blood_pressure; parameters[3].Value = plasma_inlet_pressure; parameters[4].Value = arterial_pressure; parameters[5].Value = venous_pressure; parameters[6].Value = plasma_pressure; parameters[7].Value = transmembrane_pressure; parameters[8].Value = plasma2_pressure; ALS.Model.pressure_data model = new ALS.Model.pressure_data(); DataSet ds = DbHelperMySQL_Data.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public ALS.Model.pressure_data GetModel(string surgery_no) { StringBuilder strSql = new StringBuilder(); strSql.Append("select surgery_no,time_stamp,in_blood_pressure,plasma_inlet_pressure,arterial_pressure,venous_pressure,plasma_pressure,transmembrane_pressure from pressure_data "); strSql.Append(" where surgery_no=@surgery_no "); MySqlParameter[] parameters = { new MySqlParameter("@surgery_no", MySqlDbType.VarChar, 255) }; parameters[0].Value = surgery_no; ALS.Model.pressure_data model = new ALS.Model.pressure_data(); DataSet ds = DbHelperMySQL_Data.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }