/// <summary> /// 更新一条数据 /// </summary> public bool Update(StudentMS.Model.S_R_F model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update S_R_F set "); #warning 系统发现缺少更新的字段,请手工确认如此更新是否正确! strSql.Append("RoleID=@RoleID,"); strSql.Append("FunctionID=@FunctionID"); strSql.Append(" where RoleID=@RoleID and FunctionID=@FunctionID "); SqlParameter[] parameters = { new SqlParameter("@RoleID", SqlDbType.VarChar, 50), new SqlParameter("@FunctionID", SqlDbType.VarChar, 50) }; parameters[0].Value = model.RoleID; parameters[1].Value = model.FunctionID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public StudentMS.Model.S_R_F GetModel(string RoleID, string FunctionID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 RoleID,FunctionID from S_R_F "); strSql.Append(" where RoleID=@RoleID and FunctionID=@FunctionID "); SqlParameter[] parameters = { new SqlParameter("@RoleID", SqlDbType.VarChar, 50), new SqlParameter("@FunctionID", SqlDbType.VarChar, 50) }; parameters[0].Value = RoleID; parameters[1].Value = FunctionID; StudentMS.Model.S_R_F model = new StudentMS.Model.S_R_F(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { model.RoleID = ds.Tables[0].Rows[0]["RoleID"].ToString(); model.FunctionID = ds.Tables[0].Rows[0]["FunctionID"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 增加一条数据 /// </summary> public void Add(StudentMS.Model.S_R_F model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into S_R_F("); strSql.Append("RoleID,FunctionID)"); strSql.Append(" values ("); strSql.Append("@RoleID,@FunctionID)"); SqlParameter[] parameters = { new SqlParameter("@RoleID", SqlDbType.VarChar, 50), new SqlParameter("@FunctionID", SqlDbType.VarChar, 50) }; parameters[0].Value = model.RoleID; parameters[1].Value = model.FunctionID; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }