/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.dicom model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update dicom set "); strSql.Append("PID=@PID,"); strSql.Append("Period=@Period,"); strSql.Append("Heterogeneity=@Heterogeneity,"); strSql.Append("LobeSplit=@LobeSplit,"); strSql.Append("TreatLobeVolumn=@TreatLobeVolumn,"); strSql.Append("UnTreatLobeVolumn=@UnTreatLobeVolumn,"); strSql.Append("CheckDate=@CheckDate,"); strSql.Append("File=@File"); strSql.Append(" where ID=@ID"); OleDbParameter[] parameters = { new OleDbParameter("@PID", OleDbType.Integer, 4), new OleDbParameter("@Period", OleDbType.Integer, 4), new OleDbParameter("@Heterogeneity", OleDbType.VarChar, 50), new OleDbParameter("@LobeSplit", OleDbType.VarChar, 50), new OleDbParameter("@TreatLobeVolumn", OleDbType.VarChar, 50), new OleDbParameter("@UnTreatLobeVolumn", OleDbType.VarChar, 50), new OleDbParameter("@CheckDate", OleDbType.Date), new OleDbParameter("@File", OleDbType.VarChar, 255), new OleDbParameter("@ID", OleDbType.Integer, 4) }; parameters[0].Value = model.PID; parameters[1].Value = model.Period; parameters[2].Value = model.Heterogeneity; parameters[3].Value = model.LobeSplit; parameters[4].Value = model.TreatLobeVolumn; parameters[5].Value = model.UnTreatLobeVolumn; parameters[6].Value = model.CheckDate; parameters[7].Value = model.File; parameters[8].Value = model.ID; int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.dicom DataRowToModel(DataRow row) { Maticsoft.Model.dicom model = new Maticsoft.Model.dicom(); if (row != null) { if (row["ID"] != null && row["ID"].ToString() != "") { model.ID = int.Parse(row["ID"].ToString()); } if (row["PID"] != null && row["PID"].ToString() != "") { model.PID = int.Parse(row["PID"].ToString()); } if (row["Period"] != null && row["Period"].ToString() != "") { model.Period = int.Parse(row["Period"].ToString()); } if (row["Heterogeneity"] != null) { model.Heterogeneity = row["Heterogeneity"].ToString(); } if (row["LobeSplit"] != null) { model.LobeSplit = row["LobeSplit"].ToString(); } if (row["TreatLobeVolumn"] != null) { model.TreatLobeVolumn = row["TreatLobeVolumn"].ToString(); } if (row["UnTreatLobeVolumn"] != null) { model.UnTreatLobeVolumn = row["UnTreatLobeVolumn"].ToString(); } if (row["CheckDate"] != null && row["CheckDate"].ToString() != "") { model.CheckDate = DateTime.Parse(row["CheckDate"].ToString()); } if (row["File"] != null) { model.File = row["File"].ToString(); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Maticsoft.Model.dicom model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into dicom("); strSql.Append("PID,Period,Heterogeneity,LobeSplit,TreatLobeVolumn,UnTreatLobeVolumn,CheckDate,File)"); strSql.Append(" values ("); strSql.Append("@PID,@Period,@Heterogeneity,@LobeSplit,@TreatLobeVolumn,@UnTreatLobeVolumn,@CheckDate,@File)"); OleDbParameter[] parameters = { new OleDbParameter("@PID", OleDbType.Integer, 4), new OleDbParameter("@Period", OleDbType.Integer, 4), new OleDbParameter("@Heterogeneity", OleDbType.VarChar, 50), new OleDbParameter("@LobeSplit", OleDbType.VarChar, 50), new OleDbParameter("@TreatLobeVolumn", OleDbType.VarChar, 50), new OleDbParameter("@UnTreatLobeVolumn", OleDbType.VarChar, 50), new OleDbParameter("@CheckDate", OleDbType.Date), new OleDbParameter("@File", OleDbType.VarChar, 255) }; parameters[0].Value = model.PID; parameters[1].Value = model.Period; parameters[2].Value = model.Heterogeneity; parameters[3].Value = model.LobeSplit; parameters[4].Value = model.TreatLobeVolumn; parameters[5].Value = model.UnTreatLobeVolumn; parameters[6].Value = model.CheckDate; parameters[7].Value = model.File; int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.dicom GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select ID,PID,Period,Heterogeneity,LobeSplit,TreatLobeVolumn,UnTreatLobeVolumn,CheckDate,File from dicom "); strSql.Append(" where ID=@ID"); OleDbParameter[] parameters = { new OleDbParameter("@ID", OleDbType.Integer, 4) }; parameters[0].Value = ID; Maticsoft.Model.dicom model = new Maticsoft.Model.dicom(); DataSet ds = DbHelperOleDb.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }