YAFLogo

midwestSS
15 years ago
ahh ok there in lies the issue im going to have. i dont know how to recompile. I have installed VS2005 on my Xp machine, downloaded the source. but it gives me errors about the YAF project not being installed.. so i gave up trying to understand how to compile a long time ago.
mdlesk
  • mdlesk
  • 71.6% (Friendly)
  • YAF Forumling Topic Starter
15 years ago
Have you considered trying to use the latest version. I was experiencing issues with 1.9.1 so I decided to go to 1.9.3 and a lot of my issues were resolved.
mdlesk
  • mdlesk
  • 71.6% (Friendly)
  • YAF Forumling Topic Starter
15 years ago
Would it be better if I compile all of the class code: DB functions and everything else in a DLL and you just add it as a reference? I am considering doing this for future releases. I was trying to keep all of the code together, but this is an option that would require anyone to recompile or modify any of the classes. All that would be needed to place add the control at the appropriate section. Please let me know your opinions. As always this will be a GPL and I will start a separate project for all of the DLESKTECH controls.
mdlesk
  • mdlesk
  • 71.6% (Friendly)
  • YAF Forumling Topic Starter
15 years ago
I have uploaded a new version of the control. It's only a minor change in the code that points to the smiley location. If you are experiencing issue with your smilies displaying then make sure you perform this upgrade.
midwestSS
15 years ago
adding it pre compiled would be AWESOME! personally, for the 'compiled challenged' , thats a great thing to do. I am so out of the loop on programing and it makes me feel like moron.. i have to learn how to program all over again. i downloaded vs 2008 for web apps, but i was having the same issues there
midwestSS
15 years ago
ok.. i tried to compile again, and got this error
Error 1 Member modifier 'static' must precede the member type and name C:\Documents and Settings\me\Desktop\yaf\YAF-v1.9.3-RC2-SRC\YAF.Classes\YAF.Classes.Data\DB.cs 73 3 YAF.Classes.Data
vash
  • vash
  • 100% (Exalted)
  • YAF Commander
15 years ago
Hi Bro,

Thanks for the update, I will try to implement this tonight :cheesy:
mdlesk
  • mdlesk
  • 71.6% (Friendly)
  • YAF Forumling Topic Starter
15 years ago
midwestSS wrote:

ok.. i tried to compile again, and got this error
Error 1 Member modifier 'static' must precede the member type and name C:\Documents and Settings\me\Desktop\yaf\YAF-v1.9.3-RC2-SRC\YAF.Classes\YAF.Classes.Data\DB.cs 73 3 YAF.Classes.Data



Can you post your CS file you are getting this error on and I will take a look at it.
midwestSS
15 years ago
/* Yet Another Forum.NET
* Copyright (C) 2003-2005 Bjørnar Henden
* Copyright (C) 2006-2008 Jaben Cargman
http://www.yetanotherforum.net/ 
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

using System;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.Security;

namespace YAF.Classes.Data
{
public static class DB
{
///
/// Gets the database size
///

/// intager value for database size
static public int DBSize()
{
using ( SqlCommand cmd = new SqlCommand( "select sum(cast(size as integer))/128 from sysfiles" ) )
{
cmd.CommandType = CommandType.Text;
return ( int )DBAccess.ExecuteScalar( cmd );
}
}


#region Forum

static public DataRow pageload( object sessionID, object boardID, object userKey, object ip, object location, object browser,
object platform, object categoryID, object forumID, object topicID, object messageID, object donttrack )
{
int nTries = 0;
while ( true )
{
try
{
using ( SqlCommand cmd = DBAccess.GetCommand( "pageload" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "SessionID", sessionID );
cmd.Parameters.AddWithValue( "BoardID", boardID );
cmd.Parameters.AddWithValue( "UserKey", userKey );
cmd.Parameters.AddWithValue( "IP", ip );
cmd.Parameters.AddWithValue( "Location", location );
cmd.Parameters.AddWithValue( "Browser", browser );
cmd.Parameters.AddWithValue( "Platform", platform );
cmd.Parameters.AddWithValue( "CategoryID", categoryID );
cmd.Parameters.AddWithValue( "ForumID", forumID );
cmd.Parameters.AddWithValue( "TopicID", topicID );
cmd.Parameters.AddWithValue( "MessageID", messageID );
cmd.Parameters.AddWithValue( "DontTrack", donttrack );
using ( DataTable dt = DBAccess.GetData( cmd ) )
{
if ( dt.Rows.Count > 0 )
return dt.Rows [0];
else
return null;
}
}
}
catch ( SqlException x )
{
if ( x.Number == 1205 && nTries < 3 )
{
/// Transaction (Process ID XXX) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
}
else
throw new ApplicationException( string.Format( "Sql Exception with error number {0} (Tries={1})", x.Number, nTries ), x );
}
++nTries;
}
}
///
/// Returns Search results
///

///
/// Field to search
/// Search what
///
/// ID of user
/// Results
static public DataTable GetSearchResult( string toSearchWhat, string toSearchFromWho, SearchWhatFlags searchFromWhoMethod, SearchWhatFlags searchWhatMethod, int forumIDToStartAt, int userID, int boardId, int maxResults, bool useFullText )
{
bool bFirst = true;
System.Text.StringBuilder forumIds = new System.Text.StringBuilder();

if ( toSearchWhat == "*" )
{
toSearchWhat = "";
}

if ( forumIDToStartAt != 0 )
{
DataTable dt = forum_listall_sorted( boardId, userID, null, false, forumIDToStartAt );

bFirst = true;
foreach ( DataRow dr in dt.Rows )
{
if ( bFirst ) bFirst = false;
else forumIds.Append( "," );

forumIds.Append( Convert.ToString( Convert.ToInt32( dr ["ForumID"] ) ) );
}
}

// fix quotes for SQL insertion...
toSearchWhat = toSearchWhat.Replace( "'", "''" ).Trim();
toSearchFromWho = toSearchFromWho.Replace( "'", "''" ).Trim();

string searchSql = ( maxResults == 0 ) ? "SELECT" : ( "SELECT TOP " + maxResults.ToString() );

searchSql += " a.ForumID, a.TopicID, a.Topic, b.UserID, IsNull(c.Username, b.Name) as Name, c.MessageID, c.Posted, c.Message, c.Flags ";
searchSql += "from {databaseOwner}.{objectQualifier}topic a left join {databaseOwner}.{objectQualifier}message c on a.TopicID = c.TopicID left join {databaseOwner}.{objectQualifier}user b on c.UserID = b.UserID join {databaseOwner}.{objectQualifier}vaccess x on x.ForumID=a.ForumID ";
searchSql += String.Format( "where x.ReadAccess<>0 AND x.UserID={0} AND c.IsApproved = 1 AND a.TopicMovedID IS NULL AND a.IsDeleted = 0 AND c.IsDeleted = 0 ", userID );

string [] words;

if ( !String.IsNullOrEmpty( toSearchFromWho ) )
{
searchSql += "AND (";
bFirst = true;

// generate user search sql...
switch ( searchFromWhoMethod )
{
case SearchWhatFlags.AllWords:
words = toSearchFromWho.Replace("\"","").Split( ' ' );
foreach ( string word in words )
{
if ( !bFirst ) searchSql += " AND "; else bFirst = false;
searchSql += string.Format( " ((c.Username IS NULL AND b.Name LIKE N'%{0}%') OR (c.Username LIKE N'%{0}%'))", word );
}
break;
case SearchWhatFlags.AnyWords:
words = toSearchFromWho.Split( ' ' );
foreach ( string word in words )
{
if ( !bFirst ) searchSql += " OR "; else bFirst = false;
searchSql += string.Format( " ((c.Username IS NULL AND b.Name LIKE N'%{0}%') OR (c.Username LIKE N'%{0}%'))", word );
}
break;
case SearchWhatFlags.ExactMatch:
searchSql += string.Format( " ((c.Username IS NULL AND b.Name = N'{0}') OR (c.Username = N'{0}'))", toSearchFromWho );
break;
}
searchSql += ") ";
}


if ( !String.IsNullOrEmpty( toSearchWhat ) )
{
searchSql += "AND (";
bFirst = true;

// generate message and topic search sql...
switch ( searchWhatMethod )
{
case SearchWhatFlags.AllWords:
words = toSearchWhat.Replace("\"","").Split( ' ' );
if ( useFullText )
{
string ftInner = "";

// make the inner FULLTEXT search
foreach ( string word in words )
{
if ( !bFirst ) ftInner += " AND "; else bFirst = false;
ftInner += String.Format( @"""{0}""", word );
}
// make final string...
searchSql += string.Format( "( CONTAINS (c.Message, N' {0} ') OR CONTAINS (a.Topic, N' {0} ') )", ftInner );
}
else
{
foreach ( string word in words )
{
if ( !bFirst ) searchSql += " AND "; else bFirst = false;
searchSql += String.Format( "(c.Message like N'%{0}%' OR a.Topic LIKE N'%{0}%')", word );
}
}
break;
case SearchWhatFlags.AnyWords:
words = toSearchWhat.Split( ' ' );

if ( useFullText )
{
string ftInner = "";

// make the inner FULLTEXT search
foreach ( string word in words )
{
if ( !bFirst ) ftInner += " OR "; else bFirst = false;
ftInner += String.Format( @"""{0}""", word );
}
// make final string...
searchSql += string.Format( "( CONTAINS (c.Message, N' {0} ') OR CONTAINS (a.Topic, N' {0} ') )", ftInner );
}
else
{
foreach ( string word in words )
{
if ( !bFirst ) searchSql += " OR "; else bFirst = false;
searchSql += String.Format( "c.Message LIKE N'%{0}%' OR a.Topic LIKE N'%{0}%'", word );
}
}
break;
case SearchWhatFlags.ExactMatch:
if ( useFullText )
{
searchSql += string.Format( "( CONTAINS (c.Message, N' \"{0}\" ') OR CONTAINS (a.Topic, N' \"{0}\" ') )", toSearchWhat );
}
else
{
searchSql += string.Format( "c.Message LIKE N'%{0}%' OR a.Topic LIKE N'%{0}%' ", toSearchWhat );
}
break;
}
searchSql += ") ";
}

// Ederon : 6/16/2007 - forum IDs start above 0, if forum id is 0, there is no forum filtering
if ( forumIDToStartAt > 0 && forumIds.Length > 0 )
{
searchSql += string.Format( "AND a.ForumID IN ({0})", forumIds.ToString() );
}

searchSql += " ORDER BY c.Posted DESC";

using ( SqlCommand cmd = DBAccess.GetCommand( searchSql, true ) )
{
return DBAccess.GetData( cmd );
}
}

#endregion

#region DLESKTECH_ShoutBox
public static DataTable DLESKTECH_ShoutBox_GetMessages()
{
using (SqlCommand cmd = DBAccess.GetCommand("DLESKTECH_ShoutBox_GetMessages"))
{
cmd.CommandType = CommandType.StoredProcedure;
return DBAccess.GetData(cmd);
}
}

public static bool DLESKTECH_ShoutBox_SaveMessage(string message,string usernName,int userID, object ip)
{
using (SqlCommand cmd = DBAccess.GetCommand("DLESKTECH_ShoutBox_SaveMessage"))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("Message", message);
cmd.Parameters.AddWithValue("UserName", usernName);
cmd.Parameters.AddWithValue("UserID", userID);
cmd.Parameters.AddWithValue("IP", ip);
DBAccess.ExecuteNonQuery(cmd);
return true;
}
}
Sho
#endregion

#region DataSets
///
/// Gets a list of categories????
///

/// BoardID
/// DataSet with categories
static public DataSet ds_forumadmin( object boardID )
{
using ( YafDBConnManager connMan = new YafDBConnManager() )
{
using ( DataSet ds = new DataSet() )
{
using ( SqlTransaction trans = connMan.OpenDBConnection.BeginTransaction( DBAccess.IsolationLevel ) )
{
using ( SqlDataAdapter da = new SqlDataAdapter( DBAccess.GetObjectName( "category_list" ), connMan.DBConnection ) )
{
da.SelectCommand.Transaction = trans;
da.SelectCommand.Parameters.AddWithValue( "BoardID", boardID );
da.SelectCommand.CommandType = CommandType.StoredProcedure;
da.Fill( ds, DBAccess.GetObjectName( "Category" ) );
da.SelectCommand.CommandText = DBAccess.GetObjectName( "forum_list" );
da.Fill( ds, DBAccess.GetObjectName( "ForumUnsorted" ) );

DataTable dtForumListSorted = ds.Tables [DBAccess.GetObjectName( "ForumUnsorted" )].Clone();
dtForumListSorted.TableName = DBAccess.GetObjectName( "Forum" );
ds.Tables.Add( dtForumListSorted );
dtForumListSorted.Dispose();
forum_list_sort_basic( ds.Tables [DBAccess.GetObjectName( "ForumUnsorted" )], ds.Tables [DBAccess.GetObjectName( "Forum" )], 0, 0 );
ds.Tables.Remove( DBAccess.GetObjectName( "ForumUnsorted" ) );
ds.Relations.Add( "FK_Forum_Category", ds.Tables [DBAccess.GetObjectName( "Category" )].Columns ["CategoryID"], ds.Tables [DBAccess.GetObjectName( "Forum" )].Columns ["CategoryID"] );
trans.Commit();
}

return ds;
}
}
}
}
#endregion

#region yaf_AccessMask
///
/// Gets a list of access mask properities
///

/// ID of Board
/// ID of access mask
///
static public DataTable accessmask_list( object boardID, object accessMaskID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "accessmask_list" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "BoardID", boardID );
cmd.Parameters.AddWithValue( "AccessMaskID", accessMaskID );
return DBAccess.GetData( cmd );
}
}
///
/// Deletes an access mask
///

/// ID of access mask
///
static public bool accessmask_delete( object accessMaskID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "accessmask_delete" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "AccessMaskID", accessMaskID );
return ( int )DBAccess.ExecuteScalar( cmd ) != 0;
}
}
///
/// Saves changes to a access mask
///

/// ID of access mask
/// ID of board
/// Name of access mask
/// Read Access?
/// Post Access?
/// Reply Access?
/// Priority Access?
/// Poll Access?
/// Vote Access?
/// Moderator Access?
/// Edit Access?
/// Delete Access?
/// Upload Access?
/// Download Access?
static public void accessmask_save( object accessMaskID, object boardID, object name, object readAccess, object postAccess, object replyAccess, object priorityAccess, object pollAccess, object voteAccess, object moderatorAccess, object editAccess, object deleteAccess, object uploadAccess, object downloadAccess )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "accessmask_save" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "AccessMaskID", accessMaskID );
cmd.Parameters.AddWithValue( "BoardID", boardID );
cmd.Parameters.AddWithValue( "Name", name );
cmd.Parameters.AddWithValue( "ReadAccess", readAccess );
cmd.Parameters.AddWithValue( "PostAccess", postAccess );
cmd.Parameters.AddWithValue( "ReplyAccess", replyAccess );
cmd.Parameters.AddWithValue( "PriorityAccess", priorityAccess );
cmd.Parameters.AddWithValue( "PollAccess", pollAccess );
cmd.Parameters.AddWithValue( "VoteAccess", voteAccess );
cmd.Parameters.AddWithValue( "ModeratorAccess", moderatorAccess );
cmd.Parameters.AddWithValue( "EditAccess", editAccess );
cmd.Parameters.AddWithValue( "DeleteAccess", deleteAccess );
cmd.Parameters.AddWithValue( "UploadAccess", uploadAccess );
cmd.Parameters.AddWithValue( "DownloadAccess", downloadAccess );
DBAccess.ExecuteNonQuery( cmd );
}
}
#endregion

#region yaf_Active
///
/// Gets list of active users
///

/// BoardID
///
/// Returns a DataTable of active users
static public DataTable active_list( object boardID, object Guests )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "active_list" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "BoardID", boardID );
cmd.Parameters.AddWithValue( "Guests", Guests );
return DBAccess.GetData( cmd );
}
}

///
/// Gets the list of active users within a certain forum
///

/// forumID
/// DataTable of all ative users in a forum
static public DataTable active_listforum( object forumID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "active_listforum" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "ForumID", forumID );
return DBAccess.GetData( cmd );
}
}
///
/// Gets the list of active users in a topic
///

/// ID of topic
/// DataTable of all users that are in a topic
static public DataTable active_listtopic( object topicID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "active_listtopic" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "TopicID", topicID );
return DBAccess.GetData( cmd );
}
}

///
/// Gets the activity statistics for a board
///

/// boardID
/// DataRow of activity stata
static public DataRow active_stats( object boardID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "active_stats" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "BoardID", boardID );
using ( DataTable dt = DBAccess.GetData( cmd ) )
{
return dt.Rows [0];
}
}
}
#endregion

#region yaf_Attachment
///
/// Gets a list of attachments
///

/// messageID
/// attachementID
/// boardID
/// DataTable with attachement list
static public DataTable attachment_list( object messageID, object attachmentID, object boardID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "attachment_list" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "MessageID", messageID );
cmd.Parameters.AddWithValue( "AttachmentID", attachmentID );
cmd.Parameters.AddWithValue( "BoardID", boardID );
return DBAccess.GetData( cmd );
}
}
///
/// saves attachment
///

/// messageID
/// File Name
/// number of bytes
/// type of attchment
/// stream of bytes
static public void attachment_save( object messageID, object fileName, object bytes, object contentType, System.IO.Stream stream )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "attachment_save" ) )
{
byte [] fileData = null;
if ( stream != null )
{
fileData = new byte [stream.Length];
stream.Seek( 0, System.IO.SeekOrigin.Begin );
stream.Read( fileData, 0, ( int )stream.Length );
}
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "MessageID", messageID );
cmd.Parameters.AddWithValue( "FileName", fileName );
cmd.Parameters.AddWithValue( "Bytes", bytes );
cmd.Parameters.AddWithValue( "ContentType", contentType );
cmd.Parameters.AddWithValue( "FileData", fileData );
DBAccess.ExecuteNonQuery( cmd );
}
}
//ABOT CHANGE 16.04.04
///
/// Delete attachment
///

/// ID of attachment to delete
static public void attachment_delete( object attachmentID )
{
bool UseFileTable = false;

using ( DataTable dt = YAF.Classes.Data.DB.registry_list( "UseFileTable" ) )
foreach ( DataRow dr in dt.Rows )
UseFileTable = Convert.ToBoolean( Convert.ToInt32( dr ["Value"] ) );

//If the files are actually saved in the Hard Drive
if ( !UseFileTable )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "attachment_list" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "AttachmentID", attachmentID );
DataTable tbAttachments = DBAccess.GetData( cmd );
string sUpDir = HttpContext.Current.Server.MapPath( YAF.Classes.Config.UploadDir );
foreach ( DataRow row in tbAttachments.Rows )
System.IO.File.Delete( String.Format( "{0}{1}.{2}", sUpDir, row ["MessageID"], row ["FileName"] ) );
}

}
using ( SqlCommand cmd = DBAccess.GetCommand( "attachment_delete" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "AttachmentID", attachmentID );
DBAccess.ExecuteNonQuery( cmd );
}
//End ABOT CHANGE 16.04.04
}


///
/// Attachement dowload
///

/// ID of attachemnt to download
static public void attachment_download( object attachmentID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "attachment_download" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "AttachmentID", attachmentID );
DBAccess.ExecuteNonQuery( cmd );
}
}
#endregion

#region yaf_BannedIP
///
/// List of Baned IP's
///

/// ID of board
/// ID
/// DataTable of banned IPs
static public DataTable bannedip_list( object boardID, object ID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "bannedip_list" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "BoardID", boardID );
cmd.Parameters.AddWithValue( "ID", ID );
return DBAccess.GetData( cmd );
}
}
///
/// Saves baned ip in database
///

/// ID
/// BoardID
/// Mask
static public void bannedip_save( object ID, object boardID, object Mask )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "bannedip_save" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "ID", ID );
cmd.Parameters.AddWithValue( "BoardID", boardID );
cmd.Parameters.AddWithValue( "Mask", Mask );
DBAccess.ExecuteNonQuery( cmd );
}
}
///
/// Deletes Banned IP
///

/// ID of banned ip to delete
static public void bannedip_delete( object ID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "bannedip_delete" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "ID", ID );
DBAccess.ExecuteNonQuery( cmd );
}
}
#endregion

#region yaf_Board
///
/// Gets a list of information about a board
///

/// board id
/// DataTable
static public DataTable board_list( object boardID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "board_list" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "BoardID", boardID );
return DBAccess.GetData( cmd );
}
}
///
/// Gets posting statistics
///

/// BoardID
/// DataRow of Poststats
static public DataRow board_poststats( object boardID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "board_poststats" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "BoardID", boardID );
using ( DataTable dt = DBAccess.GetData( cmd ) )
{
return dt.Rows [0];
}
}
}
///
/// Recalculates topic and post numbers and updates last post for all forums in all boards
///

static public void board_resync()
{
board_resync( null );
}
///
/// Recalculates topic and post numbers and updates last post for specified board
///

/// BoardID of board to do re-sync for, if null, all boards are re-synced
static public void board_resync( object boardID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "board_resync" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "BoardID", boardID );
DBAccess.ExecuteNonQuery( cmd );
}
}
///
/// Gets statistica about number of posts etc.
///

/// DataRow
static public DataRow board_stats()
{
return board_stats( null );
}
static public DataRow board_stats( object boardID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "board_stats" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "BoardID", boardID );

using ( DataTable dt = DBAccess.GetData( cmd ) )
{
return dt.Rows [0];
}
}
}
///
/// Saves board information
///

/// BoardID
/// Name of Board
/// Boolen value, allowThreaded
static public void board_save( object boardID, object name, object allowThreaded )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "board_save" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "BoardID", boardID );
cmd.Parameters.AddWithValue( "Name", name );
cmd.Parameters.AddWithValue( "AllowThreaded", allowThreaded );
DBAccess.ExecuteNonQuery( cmd );
}
}

///
/// Creates a new board
///

/// Membership Provider User Name
/// Membership Provider User Key
/// Name of new board
/// Membership Provider Application Name for new board
/// Roles Provider Application Name for new board
static public void board_create( object adminUsername, object adminUserKey, object boardName, object boardMembershipName, object boardRolesName )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "board_create" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "BoardName", boardName );
cmd.Parameters.AddWithValue( "MembershipAppName", boardMembershipName );
cmd.Parameters.AddWithValue( "RolesAppName", boardRolesName );
cmd.Parameters.AddWithValue( "UserName", adminUsername );
cmd.Parameters.AddWithValue( "UserKey", adminUserKey );
cmd.Parameters.AddWithValue( "IsHostAdmin", 0 );
DBAccess.ExecuteNonQuery( cmd );
}
}
///
/// Deletes a board
///

/// ID of board to delete
static public void board_delete( object boardID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "board_delete" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "BoardID", boardID );
DBAccess.ExecuteNonQuery( cmd );
}
}
#endregion

#region yaf_Category
///
/// Deletes a category
///

/// ID of category to delete
/// Bool value indicationg if category was deleted
static public bool category_delete( object CategoryID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "category_delete" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "CategoryID", CategoryID );
return ( int )DBAccess.ExecuteScalar( cmd ) != 0;
}
}
///
/// Gets a list of forums in a category
///

/// boardID
/// categotyID
/// DataTable with a list of forums in a category
static public DataTable category_list( object boardID, object categoryID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "category_list" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "BoardID", boardID );
cmd.Parameters.AddWithValue( "CategoryID", categoryID );
return DBAccess.GetData( cmd );
}
}
///
/// Gets a list of forum categories
///

///
///
///
///
static public DataTable category_listread( object boardID, object userID, object categoryID )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "category_listread" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "BoardID", boardID );
cmd.Parameters.AddWithValue( "UserID", userID );
cmd.Parameters.AddWithValue( "CategoryID", categoryID );
return DBAccess.GetData( cmd );
}
}
///
/// Lists categories very simply (for URL rewriting)
///

///
///
///
static public DataTable category_simplelist( int startID, int limit )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "category_simplelist" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "StartID", startID );
cmd.Parameters.AddWithValue( "Limit", limit );
return DBAccess.GetData( cmd );
}
}
///
/// Saves changes to a category
///

/// BoardID
/// CategoryID so save changes to
/// Name of the category
/// Sort Order
static public void category_save( object boardID, object categoryId, object name, object categoryImage, object sortOrder )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "category_save" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "BoardID", boardID );
cmd.Parameters.AddWithValue( "CategoryID", categoryId );
cmd.Parameters.AddWithValue( "Name", name );
cmd.Parameters.AddWithValue( "CategoryImage", categoryImage );
cmd.Parameters.AddWithValue( "SortOrder", sortOrder );
DBAccess.ExecuteNonQuery( cmd );
}
}
#endregion

#region yaf_CheckEmail
///
/// Saves a new email into the table for verification
///

/// ID of user to verify
/// Hash of user
/// email of user
static public void checkemail_save( object userID, object hash, object email )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "checkemail_save" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "UserID", userID );
cmd.Parameters.AddWithValue( "Hash", hash );
cmd.Parameters.AddWithValue( "Email", email );
DBAccess.ExecuteNonQuery( cmd );
}
}
///
/// Updates a hash
///

/// New hash
/// DataTable with user information
static public DataTable checkemail_update( object hash )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "checkemail_update" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "Hash", hash );
return DBAccess.GetData( cmd );
}
}
///
/// Gets a check email entry based on email or all if no email supplied
///

/// Associated email
/// DataTable with check email information
static public DataTable checkemail_list( object email )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "checkemail_list" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "Email", email );
return DBAccess.GetData( cmd );
}
}

#endregion

#region yaf_Choice
///
/// Saves a vote in the database
///

/// Choice of the vote
static public void choice_vote( object choiceID, object userID, object remoteIP )
{
using ( SqlCommand cmd = DBAccess.GetCommand( "choice_vote" ) )
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue( "ChoiceID", choiceID );
cmd.Parameters.AddWithValue( "UserID", userID );
cmd.Parameters.AddWithValue( "RemoteIP", remoteIP );
DBAccess.ExecuteNonQuery( cmd );
}
}
#endregion

#region...
midwestSS
15 years ago
That was my db.cs following your directions. i hate compiling
mdlesk
  • mdlesk
  • 71.6% (Friendly)
  • YAF Forumling Topic Starter
15 years ago
Remove the Sho:

#region DLESKTECH_ShoutBox
public static DataTable DLESKTECH_ShoutBox_GetMessages()
{
using (SqlCommand cmd = DBAccess.GetCommand("DLESKTECH_ShoutBox_GetMessages")
{
cmd.CommandType = CommandType.StoredProcedure;
return DBAccess.GetData(cmd);
}
}

public static bool DLESKTECH_ShoutBox_SaveMessage(string message,string usernName,int userID, object ip)
{
using (SqlCommand cmd = DBAccess.GetCommand("DLESKTECH_ShoutBox_SaveMessage")
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("Message", message);
cmd.Parameters.AddWithValue("UserName", usernName);
cmd.Parameters.AddWithValue("UserID", userID);
cmd.Parameters.AddWithValue("IP", ip);
DBAccess.ExecuteNonQuery(cmd);
return true;
}
}
Sho
#endregion
vash
  • vash
  • 100% (Exalted)
  • YAF Commander
15 years ago
It seems that the download file for ShoutBox v 1.1.0.2.zip is corrupted. 😞
mdlesk
  • mdlesk
  • 71.6% (Friendly)
  • YAF Forumling Topic Starter
15 years ago
Try the one attached to this post.
midwestSS
15 years ago
mdlesk wrote:

Remove the Sho:

#region DLESKTECH_ShoutBox
public static DataTable DLESKTECH_ShoutBox_GetMessages()
{
using (SqlCommand cmd = DBAccess.GetCommand("DLESKTECH_ShoutBox_GetMessages")
{
cmd.CommandType = CommandType.StoredProcedure;
return DBAccess.GetData(cmd);
}
}

public static bool DLESKTECH_ShoutBox_SaveMessage(string message,string usernName,int userID, object ip)
{
using (SqlCommand cmd = DBAccess.GetCommand("DLESKTECH_ShoutBox_SaveMessage")
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("Message", message);
cmd.Parameters.AddWithValue("UserName", usernName);
cmd.Parameters.AddWithValue("UserID", userID);
cmd.Parameters.AddWithValue("IP", ip);
DBAccess.ExecuteNonQuery(cmd);
return true;
}
}
Sho
#endregion




thanks! that did help. knocked down the number of errors from 121 down to 109.
the YAF.Classes.Data.dll looks like it rebuilt, is that the only .dll file that is supposed to rebuilt for this mod?
midwestSS
15 years ago
mdlesk wrote:

Remove the Sho:

#region DLESKTECH_ShoutBox
public static DataTable DLESKTECH_ShoutBox_GetMessages()
{
using (SqlCommand cmd = DBAccess.GetCommand("DLESKTECH_ShoutBox_GetMessages")
{
cmd.CommandType = CommandType.StoredProcedure;
return DBAccess.GetData(cmd);
}
}

public static bool DLESKTECH_ShoutBox_SaveMessage(string message,string usernName,int userID, object ip)
{
using (SqlCommand cmd = DBAccess.GetCommand("DLESKTECH_ShoutBox_SaveMessage")
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("Message", message);
cmd.Parameters.AddWithValue("UserName", usernName);
cmd.Parameters.AddWithValue("UserID", userID);
cmd.Parameters.AddWithValue("IP", ip);
DBAccess.ExecuteNonQuery(cmd);
return true;
}
}
Sho
#endregion




thanks! that did help. knocked down the number of errors from 121 down to 109.
the YAF.Classes.Data.dll looks like it rebuilt, is that the only .dll file that is supposed to rebuilt for this mod?
YAF Logo Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved
About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button