/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.VideoAttribValue model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update VideoAttribValue set "); strSql.Append("GUID=@GUID,"); strSql.Append("VideoDetailGUID=@VideoDetailGUID,"); strSql.Append("VideoAttribConfigGUID=@VideoAttribConfigGUID,"); strSql.Append("VideoAttribValueValue=@VideoAttribValueValue"); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@GUID", SqlDbType.NVarChar, -1), new SqlParameter("@VideoDetailGUID", SqlDbType.NVarChar, -1), new SqlParameter("@VideoAttribConfigGUID", SqlDbType.NVarChar, -1), new SqlParameter("@VideoAttribValueValue", SqlDbType.NVarChar, -1), new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = model.GUID; parameters[1].Value = model.VideoDetailGUID; parameters[2].Value = model.VideoAttribConfigGUID; parameters[3].Value = model.VideoAttribValueValue; parameters[4].Value = model.ID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.VideoAttribValue DataRowToModel(DataRow row) { Maticsoft.Model.VideoAttribValue model = new Maticsoft.Model.VideoAttribValue(); if (row != null) { if (row["ID"] != null && row["ID"].ToString() != "") { model.ID = int.Parse(row["ID"].ToString()); } if (row["GUID"] != null) { model.GUID = row["GUID"].ToString(); } if (row["VideoDetailGUID"] != null) { model.VideoDetailGUID = row["VideoDetailGUID"].ToString(); } if (row["VideoAttribConfigGUID"] != null) { model.VideoAttribConfigGUID = row["VideoAttribConfigGUID"].ToString(); } if (row["VideoAttribValueValue"] != null) { model.VideoAttribValueValue = row["VideoAttribValueValue"].ToString(); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Maticsoft.Model.VideoAttribValue model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into VideoAttribValue("); strSql.Append("GUID,VideoDetailGUID,VideoAttribConfigGUID,VideoAttribValueValue)"); strSql.Append(" values ("); strSql.Append("@GUID,@VideoDetailGUID,@VideoAttribConfigGUID,@VideoAttribValueValue)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@GUID", SqlDbType.NVarChar, -1), new SqlParameter("@VideoDetailGUID", SqlDbType.NVarChar, -1), new SqlParameter("@VideoAttribConfigGUID", SqlDbType.NVarChar, -1), new SqlParameter("@VideoAttribValueValue", SqlDbType.NVarChar, -1) }; parameters[0].Value = model.GUID; parameters[1].Value = model.VideoDetailGUID; parameters[2].Value = model.VideoAttribConfigGUID; parameters[3].Value = model.VideoAttribValueValue; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.VideoAttribValue GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ID,GUID,VideoDetailGUID,VideoAttribConfigGUID,VideoAttribValueValue from VideoAttribValue "); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = ID; Maticsoft.Model.VideoAttribValue model = new Maticsoft.Model.VideoAttribValue(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }