Files
yavsc/yavscModel/Blogs/BlogManager.cs
Paul Schneider 87edbaffe5 * cldr.js:
* Web.config:
* ListItem.cs:
* styles.json:
* globalize.js:
* event.js:
* Auth.aspx:
* Book.aspx:
* Login.aspx:
* jquery-2.1.4.js:
* map-load.gif:
* Book.aspx:
* Circle.cs:
* Auth.aspx:
* mapstyle.css:
* date.js:
* Login.aspx:
* mdd_help.htm:
* BlogHelper.cs:
* fit-bounds.png:
* unresolved.js:
* jquery-2.1.4.min.js:
* mapstyle-ie.css:
* FreeDate.cs:
* BookEdit.cs:
* number.js:
* BlogManager.cs:
* plural.js:
* jquery-2.1.4.min.map:
* jquery.googlemaps.js:
* supplemental.js:
* BlogProvider.cs:
* mapstyle.min.css:
* pin-pink.png:
* message.js:
* ChooseADate.aspx:
* pin-azure.png:
* currency.js:
* jquery-2.1.4-vsdoc.js:
* pin-green.png:
* MarkdownDeepLib.min.js:
* flag-azure.png:
* flag-green.png:
* needle-pink.png:
* ChooseADate.aspx:
* niddle-green.png:
* ChooseCalendar.aspx:
* current-location.png:
* jquery.googlemaps.min.js:
* ErrorMessage.aspx:
* ChooseCalendar.aspx:
* relative-time.js:
* GoogleErrorMessage.aspx:
* popup-template-marker.html:
* popup-template-circle.html:
* popup-template-polygon.html:
* popup-template-polyline.html:
* popup-template-rectangle.html:

* Web.csproj:
* YavscModel.csproj:
* YavscClient.csproj:
* fortune.csproj:
* WebControls.csproj:
* SalesCatalog.csproj:
* ITContentProvider.csproj:
* NpgsqlMRPProviders.csproj:
* NpgsqlBlogProvider.csproj:
* NpgsqlContentProvider.csproj: Moves to Mono framework

* NpgsqlCircleProvider.cs: Makes Circles private, or not

* OAuth2.cs:
* CircleController.cs:
* AccountController.cs:
* NpgsqlContentProvider.cs: Impacts htmldoc

* NpgsqlMembershipProvider.cs: Makes possible to change the UserName

* NpgsqlRoleProvider.cs: Drops this SQL code, which is actually
  maintained in Web/instdbws.sql

* PeopleApi.cs:
* GoogleController.cs:
* PaypalController.cs: Refactoring

* Global.asax.cs: Dropped an useless url mapping

* MarkdownHelper.cs: Package update

* App.master:
* NoLogin.master: Site's favicon update

* Circles.aspx: TO BE FIXED :-D

* UserPost.aspx: Comment only when logged in

* instdbws.sql: Circle public

* packages.config: package update
2015-07-15 03:36:12 +02:00

172 lines
4.9 KiB
C#

using System;
using Yavsc.Model.Blogs;
using Yavsc.Model.RolesAndMembers;
using System.Web;
using System.Web.Security;
using Yavsc.Model.Circles;
using System.Web.Mvc;
namespace Yavsc.Model.Blogs
{
/// <summary>
/// Blog manager.
/// </summary>
public static class BlogManager
{
/// <summary>
/// Removes the comment.
/// </summary>
/// <returns>The comment.</returns>
/// <param name="cmtid">Cmtid.</param>
public static long RemoveComment (long cmtid)
{
return Provider.RemoveComment (cmtid);
}
/// <summary>
/// Comment the specified from, postid, content and visible.
/// </summary>
/// <param name="from">From.</param>
/// <param name="postid">Postid.</param>
/// <param name="content">Content.</param>
/// <param name="visible">If set to <c>true</c> visible.</param>
public static void Comment (string from, long postid, string content, bool visible)
{
provider.Comment (from, postid, content);
}
static BlogProvider provider;
/// <summary>
/// Gets the provider.
/// </summary>
/// <value>The provider.</value>
public static BlogProvider Provider {
get {
if (provider == null)
provider = BlogHelper.GetProvider ();
return provider;
}
}
/// <summary>
/// Gets the post.
/// </summary>
/// <returns>The post.</returns>
/// <param name="username">Username.</param>
/// <param name="title">Title.</param>
public static BlogEntry GetPost (string username, string title)
{
return Provider.GetPost (username, title);
}
/// <summary>
/// Gets the post.
/// </summary>
/// <returns>The post.</returns>
/// <param name="postid">Postid.</param>
public static BlogEntry GetPost (long postid)
{
return Provider.GetPost (postid);
}
/// <summary>
/// Post the specified username, title, content and visible.
/// </summary>
/// <param name="username">Username.</param>
/// <param name="title">Title.</param>
/// <param name="content">Content.</param>
/// <param name="visible">If set to <c>true</c> visible.</param>
/// <param name="cids">sets the circles.</param>
public static long Post (string username, string title, string content, bool visible, long [] cids)
{
return Provider.Post (username, title, content, visible, cids);
}
/// <summary>
/// Updates the post.
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="title">Title.</param>
/// <param name="content">Content.</param>
/// <param name="visible">If set to <c>true</c> visible.</param>
/// <param name="cids">sets the circles.</param>
public static void UpdatePost (long postid, string title, string content, bool visible,long [] cids)
{
Provider.UpdatePost (postid, title, content, visible,cids);
}
/// <summary>
/// Finds the post.
/// </summary>
/// <returns>The post.</returns>
/// <param name="readersName">Readers name.</param>
/// <param name="pattern">Pattern.</param>
/// <param name="searchflags">Searchflags.</param>
/// <param name="pageIndex">Page index.</param>
/// <param name="pageSize">Page size.</param>
/// <param name="totalRecords">Total records.</param>
public static BlogEntryCollection FindPost (string readersName, string pattern, FindBlogEntryFlags searchflags, int pageIndex, int pageSize, out int totalRecords)
{
return Provider.FindPost (readersName, pattern, searchflags, pageIndex, pageSize, out totalRecords);
}
/// <summary>
/// Removes the post.
/// </summary>
/// <param name="username">Username.</param>
/// <param name="title">Title.</param>
public static void RemovePost (string username, string title)
{
if (!Roles.IsUserInRole ("Admin")) {
string rguser = Membership.GetUser ().UserName;
if (rguser != username) {
throw new AccessViolationException (
string.Format (
"{1}, Vous n'avez pas le droit de suprimer des billets du Blog de {0}",
username, rguser));
}
}
Provider.RemovePost (username, title);
}
/// <summary>
/// Lasts the posts.
/// </summary>
/// <returns>The posts.</returns>
/// <param name="pageIndex">Page index.</param>
/// <param name="pageSize">Page size.</param>
/// <param name="totalRecords">Total records.</param>
public static BlogEntryCollection LastPosts (int pageIndex, int pageSize, out int totalRecords)
{
return Provider.LastPosts (pageIndex, pageSize, out totalRecords);
}
/// <summary>
/// Gets the comments.
/// </summary>
/// <returns>The comments.</returns>
/// <param name="postid">Postid.</param>
/// <param name="getHidden">If set to <c>true</c> get hidden.</param>
public static Comment[] GetComments (long postid, bool getHidden = true)
{
return Provider.GetComments (postid, getHidden);
}
/// <summary>
/// Tag the specified post by postid.
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="tag">Tag.</param>
/// <returns>The tag identifier</returns>
public static long Tag (long postid, string tag)
{
return Provider.Tag (postid, tag);
}
}
}