/*
* Box Socialâ„¢
* http://boxsocial.net/
* Copyright © 2007, David Lachlan Smith
*
* $Id:$
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* 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, see .
*/
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using BoxSocial.Internals;
using BoxSocial.IO;
using BoxSocial.Groups;
namespace BoxSocial.Applications.Gallery
{
///
/// Represents a group's gallery
///
public class GroupGallery : Gallery
{
///
/// Initialises a new instance of the GroupGallery class
///
/// Core token
/// Group owning
public GroupGallery(Core core, UserGroup owner)
: base(core, owner)
{
}
///
/// Initialises a new instance of the GroupGallery class
///
/// Core token
/// Group owning
/// Raw data row
/// Raw data contains icon
public GroupGallery(Core core, UserGroup owner, DataRow galleryRow, bool hasIcon)
: base(core, (Primitive)owner, galleryRow, hasIcon)
{
}
///
/// Initialises a new instance of the GroupGallery class
///
/// Core token
/// Group owning
/// Gallery Id
public GroupGallery(Core core, UserGroup owner, long galleryId)
: base(core, owner, galleryId)
{
}
///
/// Updates gallery information
///
/// Database
/// Gallery owner
/// Parent gallery
/// If greater than 0, the index of new gallery cover photo
/// Number of items added to the gallery
/// Number of bytes added to the gallery
public static new void UpdateGalleryInfo(Mysql db, Primitive owner, Gallery parent, long itemId, int items, long bytes)
{
db.BeginTransaction();
db.UpdateQuery(string.Format("UPDATE group_info SET group_gallery_items = group_gallery_items + {1}, group_bytes = group_bytes + {2} WHERE group_id = {0}",
owner.Id, items, bytes));
}
}
}