/// <summary> /// 得到一个对象实体 /// </summary> public LPWeb.Model.GroupFolder GetModel(int GroupId, int FolderId) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 GroupId,FolderId from GroupFolder "); strSql.Append(" where GroupId=@GroupId and FolderId=@FolderId "); SqlParameter[] parameters = { new SqlParameter("@GroupId", SqlDbType.Int, 4), new SqlParameter("@FolderId", SqlDbType.Int, 4) }; parameters[0].Value = GroupId; parameters[1].Value = FolderId; LPWeb.Model.GroupFolder model = new LPWeb.Model.GroupFolder(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["GroupId"].ToString() != "") { model.GroupId = int.Parse(ds.Tables[0].Rows[0]["GroupId"].ToString()); } if (ds.Tables[0].Rows[0]["FolderId"].ToString() != "") { model.FolderId = int.Parse(ds.Tables[0].Rows[0]["FolderId"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(LPWeb.Model.GroupFolder model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update GroupFolder set "); strSql.Append("GroupId=@GroupId,"); strSql.Append("FolderId=@FolderId"); strSql.Append(" where GroupId=@GroupId and FolderId=@FolderId "); SqlParameter[] parameters = { new SqlParameter("@GroupId", SqlDbType.Int, 4), new SqlParameter("@FolderId", SqlDbType.Int, 4) }; parameters[0].Value = model.GroupId; parameters[1].Value = model.FolderId; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(LPWeb.Model.GroupFolder model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into GroupFolder("); strSql.Append("GroupId,FolderId)"); strSql.Append(" values ("); strSql.Append("@GroupId,@FolderId)"); SqlParameter[] parameters = { new SqlParameter("@GroupId", SqlDbType.Int, 4), new SqlParameter("@FolderId", SqlDbType.Int, 4) }; parameters[0].Value = model.GroupId; parameters[1].Value = model.FolderId; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }