midwestSS
2008-11-10T04:21:36Z
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
2008-11-10T12:04:26Z
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
2008-11-10T12:11:13Z
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
2008-11-10T12:56:37Z
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
2008-11-10T14:09:45Z
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
2008-11-10T18:21:45Z
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
2008-11-10T19:05:08Z
Hi Bro,

Thanks for the update, I will try to implement this tonight :cheesy:
mdlesk
  •  mdlesk
  • 71.6% (Friendly)
  • YAF Forumling Topic Starter
2008-11-10T19:13:07Z
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
2008-11-10T19:16:35Z
/* 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
{
/// <summary>
/// Gets the database size
/// </summary>
/// <returns>intager value for database size</returns>
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;
}
}
/// <summary>
/// Returns Search results
/// </summary>
/// <param name="ToSearch"></param>
/// <param name="sf">Field to search</param>
/// <param name="sw">Search what</param>
/// <param name="fid"></param>
/// <param name="UserID">ID of user</param>
/// <returns>Results</returns>
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
/// <summary>
/// Gets a list of categories????
/// </summary>
/// <param name="boardID">BoardID</param>
/// <returns>DataSet with categories</returns>
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
/// <summary>
/// Gets a list of access mask properities
/// </summary>
/// <param name="boardID">ID of Board</param>
/// <param name="accessMaskID">ID of access mask</param>
/// <returns></returns>
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 );
}
}
/// <summary>
/// Deletes an access mask
/// </summary>
/// <param name="accessMaskID">ID of access mask</param>
/// <returns></returns>
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;
}
}
/// <summary>
/// Saves changes to a access mask
/// </summary>
/// <param name="accessMaskID">ID of access mask</param>
/// <param name="boardID">ID of board</param>
/// <param name="name">Name of access mask</param>
/// <param name="readAccess">Read Access?</param>
/// <param name="postAccess">Post Access?</param>
/// <param name="replyAccess">Reply Access?</param>
/// <param name="priorityAccess">Priority Access?</param>
/// <param name="pollAccess">Poll Access?</param>
/// <param name="voteAccess">Vote Access?</param>
/// <param name="moderatorAccess">Moderator Access?</param>
/// <param name="editAccess">Edit Access?</param>
/// <param name="deleteAccess">Delete Access?</param>
/// <param name="uploadAccess">Upload Access?</param>
/// <param name="downloadAccess">Download Access?</param>
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
/// <summary>
/// Gets list of active users
/// </summary>
/// <param name="boardID">BoardID</param>
/// <param name="Guests"></param>
/// <returns>Returns a DataTable of active users</returns>
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 );
}
}

/// <summary>
/// Gets the list of active users within a certain forum
/// </summary>
/// <param name="forumID">forumID</param>
/// <returns>DataTable of all ative users in a forum</returns>
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 );
}
}
/// <summary>
/// Gets the list of active users in a topic
/// </summary>
/// <param name="topicID">ID of topic </param>
/// <returns>DataTable of all users that are in a topic</returns>
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 );
}
}

/// <summary>
/// Gets the activity statistics for a board
/// </summary>
/// <param name="boardID">boardID</param>
/// <returns>DataRow of activity stata</returns>
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
/// <summary>
/// Gets a list of attachments
/// </summary>
/// <param name="messageID">messageID</param>
/// <param name="attachmentID">attachementID</param>
/// <param name="boardID">boardID</param>
/// <returns>DataTable with attachement list</returns>
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 );
}
}
/// <summary>
/// saves attachment
/// </summary>
/// <param name="messageID">messageID</param>
/// <param name="fileName">File Name</param>
/// <param name="bytes">number of bytes</param>
/// <param name="contentType">type of attchment</param>
/// <param name="stream">stream of bytes</param>
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
/// <summary>
/// Delete attachment
/// </summary>
/// <param name="attachmentID">ID of attachment to delete</param>
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
}


/// <summary>
/// Attachement dowload
/// </summary>
/// <param name="attachmentID">ID of attachemnt to download</param>
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
/// <summary>
/// List of Baned IP's
/// </summary>
/// <param name="boardID">ID of board</param>
/// <param name="ID">ID</param>
/// <returns>DataTable of banned IPs</returns>
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 );
}
}
/// <summary>
/// Saves baned ip in database
/// </summary>
/// <param name="ID">ID</param>
/// <param name="boardID">BoardID</param>
/// <param name="Mask">Mask</param>
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 );
}
}
/// <summary>
/// Deletes Banned IP
/// </summary>
/// <param name="ID">ID of banned ip to delete</param>
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
/// <summary>
/// Gets a list of information about a board
/// </summary>
/// <param name="boardID">board id</param>
/// <returns>DataTable</returns>
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 );
}
}
/// <summary>
/// Gets posting statistics
/// </summary>
/// <param name="boardID">BoardID</param>
/// <returns>DataRow of Poststats</returns>
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];
}
}
}
/// <summary>
/// Recalculates topic and post numbers and updates last post for all forums in all boards
/// </summary>
static public void board_resync()
{
board_resync( null );
}
/// <summary>
/// Recalculates topic and post numbers and updates last post for specified board
/// </summary>
/// <param name="boardID">BoardID of board to do re-sync for, if null, all boards are re-synced</param>
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 );
}
}
/// <summary>
/// Gets statistica about number of posts etc.
/// </summary>
/// <returns>DataRow</returns>
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];
}
}
}
/// <summary>
/// Saves board information
/// </summary>
/// <param name="boardID">BoardID</param>
/// <param name="name">Name of Board</param>
/// <param name="allowThreaded">Boolen value, allowThreaded</param>
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 );
}
}

/// <summary>
/// Creates a new board
/// </summary>
/// <param name="adminUsername">Membership Provider User Name</param>
/// <param name="adminUserKey">Membership Provider User Key</param>
/// <param name="boardName">Name of new board</param>
/// <param name="boardMembershipName">Membership Provider Application Name for new board</param>
/// <param name="boardRolesName">Roles Provider Application Name for new board</param>
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 );
}
}
/// <summary>
/// Deletes a board
/// </summary>
/// <param name="boardID">ID of board to delete</param>
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
/// <summary>
/// Deletes a category
/// </summary>
/// <param name="CategoryID">ID of category to delete</param>
/// <returns>Bool value indicationg if category was deleted</returns>
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;
}
}
/// <summary>
/// Gets a list of forums in a category
/// </summary>
/// <param name="boardID">boardID</param>
/// <param name="categoryID">categotyID</param>
/// <returns>DataTable with a list of forums in a category</returns>
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 );
}
}
/// <summary>
/// Gets a list of forum categories
/// </summary>
/// <param name="boardID"></param>
/// <param name="userID"></param>
/// <param name="categoryID"></param>
/// <returns></returns>
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 );
}
}
/// <summary>
/// Lists categories very simply (for URL rewriting)
/// </summary>
/// <param name="StartID"></param>
/// <param name="Limit"></param>
/// <returns></returns>
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 );
}
}
/// <summary>
/// Saves changes to a category
/// </summary>
/// <param name="boardID">BoardID</param>
/// <param name="CategoryID">CategoryID so save changes to</param>
/// <param name="Name">Name of the category</param>
/// <param name="SortOrder">Sort Order</param>
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
/// <summary>
/// Saves a new email into the table for verification
/// </summary>
/// <param name="UserID">ID of user to verify</param>
/// <param name="Hash">Hash of user</param>
/// <param name="Email">email of user</param>
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 );
}
}
/// <summary>
/// Updates a hash
/// </summary>
/// <param name="hash">New hash</param>
/// <returns>DataTable with user information</returns>
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 );
}
}
/// <summary>
/// Gets a check email entry based on email or all if no email supplied
/// </summary>
/// <param name="email">Associated email</param>
/// <returns>DataTable with check email information</returns>
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
/// <summary>
/// Saves a vote in the database
/// </summary>
/// <param name="choiceID">Choice of the vote</param>
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
2008-11-10T19:19:43Z
That was my db.cs following your directions. i hate compiling
mdlesk
  •  mdlesk
  • 71.6% (Friendly)
  • YAF Forumling Topic Starter
2008-11-10T19:28:29Z
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
2008-11-11T03:15:15Z
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
2008-11-11T03:27:57Z
Try the one attached to this post.
File Attachment(s):
DLESKTECH ShoutBox v 1.1.0.2.zip (17kb) downloaded 86 time(s).
midwestSS
2008-11-11T03:44:48Z
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
2008-11-11T03:46:48Z
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?

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

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved