本文整理汇总了C#中PhotoPost类的典型用法代码示例。如果您正苦于以下问题:C# PhotoPost类的具体用法?C# PhotoPost怎么用?C# PhotoPost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PhotoPost类属于命名空间,在下文中一共展示了PhotoPost类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Fill
public static Post Fill( PhotoPost post, MvcContext ctx, IPhotoPostService postService ) {
Post p = new Post();
p.Title = post.Title;
p.Description = post.Description;
p.ImgUrl = post.ImgUrl;
p.ImgMediumUrl = post.ImgMediumUrl;
p.ImgThumbUrl = post.ImgThumbUrl;
p.Creator = post.Creator.Name;
p.Created = post.Created.ToShortDateString();
p.Hits = post.Hits;
if (post.PhotoAlbum == null || post.PhotoAlbum.Id == 0)
p.Album = alang( ctx, "defaultAlbum" );
else
p.Album = post.PhotoAlbum.Name;
p.AlbumLink = ctx.link.To( new PhotoController().Album, post.PhotoAlbum.Id );
String lnk = string.Format( " | <a href=\"{0}\">{1}《{2}》</a> ", p.AlbumLink, alang( ctx, "returnAlbum" ), p.Album );
p.AlbumAndLink = lnk;// strUtil.HasText( p.Album ) ? lnk : "";
p.Tags = post.Tag.List.Count > 0 ? "tag:" + post.Tag.HtmlString : "";
String prevnext = getPreNextHtml( ctx, post, postService );
String nextLink = getNextLink( ctx, post, postService );
p.PrevNext = prevnext;
p.NextLink = nextLink;
return p;
}
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:35,代码来源:Post.cs
示例2: getViewsAndReplies
private static String getViewsAndReplies( PhotoPost post )
{
String result = "";
if (post.Hits > 0) result += lang.get( "view" ) + ":" + post.Hits;
if (post.Replies > 0) result += " " + lang.get( "re" ) + ":" + post.Replies;
return result;
}
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:7,代码来源:PostVo.cs
示例3: addPhotoPosts
private void addPhotoPosts( MvcContext ctx )
{
User creator = ctx.viewer.obj as User;
PhotoApp app = getPhotoAppByUser( creator );
PhotoAlbum album = createUserAlbum( creator, app );
List<PhotoSysCategory> cats = PhotoSysCategory.findAll();
for (int i = 0; i < 20; i++) {
PhotoPost x = new PhotoPost();
x.AppId = app.Id;
x.DataUrl = Img.CopyToUploadPath( "/__installer/pic/pic" + i + ".jpg" );
x.Title = Path.GetFileName( x.DataUrl );
if (cats.Count > 0) {
int idxCat = getCatIndex( cats.Count, i );
x.SysCategoryId = cats[idxCat].Id;
}
x.PhotoAlbum = album;
x.Creator = creator;
x.CreatorUrl = creator.Url;
x.OwnerId = creator.Id;
x.OwnerType = creator.GetType().FullName;
x.OwnerUrl = creator.Url;
postService.CreatePost( x, app );
}
}
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:32,代码来源:WaterfallInstaller.cs
示例4: CreatePost
public virtual Result CreatePost( Result uploadResult, String photoName, int albumId, MvcContext ctx )
{
String path = uploadResult.Info.ToString();
if (strUtil.IsNullOrEmpty( photoName )) {
photoName = Path.GetFileNameWithoutExtension( path );
}
photoName = strUtil.CutString( photoName, 30 );
PhotoAlbum album = getAlbum( albumId, ctx.viewer.obj as User );
PhotoPost photo = new PhotoPost();
photo.AppId = album.AppId;
photo.Creator = (User)ctx.viewer.obj;
photo.CreatorUrl = ctx.viewer.obj.Url;
photo.OwnerId = ctx.owner.Id;
photo.OwnerUrl = ctx.owner.obj.Url;
photo.OwnerType = ctx.owner.obj.GetType().FullName;
photo.Title = photoName;
photo.DataUrl = path;
photo.PhotoAlbum = album;
photo.Ip = ctx.Ip;
Result result = db.insert( photo );
if (result.IsValid) {
this.updatePostCount( ctx.app.obj as PhotoApp );
}
return result;
}
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:27,代码来源:PhotoPostService.cs
示例5: BindPostSingle
public static void BindPostSingle(MvcContext ctx, IBlock block, PhotoPost x, List<long> likedIds) {
block.Set( "x.Link", PhotoLink.ToPost( x.Id ) );
block.Set( "x.Title", x.Title );
block.Set( "x.Description", x.Description );
block.Set( "x.Pic", x.ImgThumbUrl );
block.Set( "x.PicS", x.ImgSmallUrl );
block.Set( "x.PicM", x.ImgMediumUrl );
block.Set( "x.PicO", x.ImgUrl );
int width = x.SizeSX == null ? 170 : x.SizeSX.Width;
int height = x.SizeSX == null ? 170 : x.SizeSX.Height;
int cfgWidth = getCfgWidth();
if (width > cfgWidth) {
height = Convert.ToInt32( (decimal)(cfgWidth * height) / (decimal)width );
width = cfgWidth;
}
block.Set( "x.WidthSx", width );
block.Set( "x.HeightSx", height );
block.Set( "x.Pins", x.Pins );
block.Set( "x.Likes", x.Likes );
String pinsLikes = "";
if (x.Pins > 0) pinsLikes += "收集:" + x.Pins;
if (x.Likes > 0) pinsLikes += " 喜欢:" + x.Likes;
if (x.Replies > 0) pinsLikes += " 评论:" + x.Replies;
block.Set( "x.PinsLikes", pinsLikes );
if (x.PhotoAlbum != null) {
block.Set( "x.AlbumName", x.PhotoAlbum.Name );
block.Set( "x.AlbumLink", PhotoLink.ToAlbumOne( x.PhotoAlbum.OwnerUrl, x.PhotoAlbum.Id ) );
}
else {
block.Set( "x.AlbumName", "" );
block.Set( "x.AlbumLink", "#" );
}
block.Set( "x.CreatorName", x.Creator.Name );
block.Set( "x.CreatorPic", x.Creator.PicSmall );
block.Set( "x.CreatorLink", PhotoLink.ToUser( x.Creator ) );
block.Set( "x.Created", cvt.ToTimeString( x.Created ) );
block.Set( "x.RepinLink", ctx.link.To( new HomeController().Repin, x.Id ) );
block.Set( "x.LikeLink", ctx.link.To( new HomeController().Like, x.Id ) );
block.Set( "x.UnLikeLink", ctx.link.To( new HomeController().UnLike, x.Id ) );
if (likedIds.Contains( x.Id )) {
block.Set( "x.LikedCss", "wfpost-liked disabled" );
block.Set( "x.LikeName", "已喜欢" );
}
else {
block.Set( "x.LikedCss", "wfpost-like" );
block.Set( "x.LikeName", "<i class=\"icon-heart icon-white\"></i> 喜欢" );
}
}
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:58,代码来源:PhotoBinder.cs
示例6: bindComment
private void bindComment( PhotoPost post ) {
String commentUrl = t2( new wojilu.Web.Controller.Open.CommentController().List )
+ "?url=" + PhotoLink.ToPost( post.Id )
+ "&dataType=" + typeof( PhotoPost ).FullName
+ "&dataTitle=" + post.Title
+ "&dataUserId=" + post.Creator.Id
+ "&dataId=" + post.Id
+ "&appId=" + post.AppId;
set( "commentUrl", commentUrl );
}
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:10,代码来源:PostController.cs
示例7: UnLike
public void UnLike( User user, PhotoPost post )
{
PhotoLike p = this.GetOne( user.Id, post.Id );
p.delete();
post.Likes = PhotoLike.count( "PostId=" + post.Id );
post.update();
user.Likes = PhotoLike.count( "UserId=" + user.Id );
user.update( "Likes" );
}
开发者ID:Boshin,项目名称:wojilu,代码行数:12,代码来源:PhotoLikeService.cs
示例8: Like
public void Like( User user, PhotoPost post )
{
PhotoLike x = new PhotoLike();
x.Post = post;
x.User = user;
x.insert();
post.Likes = PhotoLike.count( "PostId=" + post.Id );
post.update();
user.Likes = PhotoLike.count( "UserId=" + user.Id );
user.update( "Likes" );
}
开发者ID:Boshin,项目名称:wojilu,代码行数:14,代码来源:PhotoLikeService.cs
示例9: pickOnePost
private void pickOnePost( PhotoPost post )
{
PhotoPostPicked pickedPost = GetByPost( post );
if (pickedPost == null) {
pickedPost = new PhotoPostPicked();
pickedPost.Post = post;
pickedPost.Status = SystemPickStatus.Picked;
db.insert( pickedPost );
}
else {
pickedPost.Status = SystemPickStatus.Picked;
db.update( pickedPost );
}
}
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:15,代码来源:PickedService.cs
示例10: CanDeleteImg
public Boolean CanDeleteImg( PhotoPost post )
{
// 原始图片
if (post.RootId == 0) {
return noRepins( post ); // 是否有其他人收集
}
// 只是转发: 原始图片存在
else if (isRootExits( post.RootId )) {
return false;
}
// 只是转发
else {
return isLastRepin( post ); //看是否是最后一个转发
}
}
开发者ID:NOTHEN,项目名称:wojilu,代码行数:15,代码来源:PhotoPostService.cs
示例11: CanDeleteImg
public Boolean CanDeleteImg( PhotoPost post )
{
// ԭʼͼƬ
if (post.RootId == 0) {
return noRepins( post ); // �Ƿ����������ռ�
}
// ֻ��ת��: ԭʼͼƬ����
else if (isRootExits( post.RootId )) {
return false;
}
// ֻ��ת��
else {
return isLastRepin( post ); //���Ƿ������һ��ת��
}
}
开发者ID:Boshin,项目名称:wojilu,代码行数:15,代码来源:PhotoPostService.cs
示例12: getPreNextHtml
private static String getPreNextHtml( MvcContext ctx, PhotoPost post, IPhotoPostService postService ) {
PhotoPost prev = postService.GetPre( post );
PhotoPost next = postService.GetNext( post );
String prenext;
if (prev == null && next == null)
prenext = "";
else if (prev == null)
prenext = "<a href=\"" + alink.ToAppData( next ) + "\">" + alang( ctx, "nextPhoto" ) + "</a> ";
else if (next == null)
prenext = "<a href=\"" + alink.ToAppData( prev ) + "\">" + alang( ctx, "prevPhoto" ) + "</a> ";
else
prenext = "<a href=\"" + alink.ToAppData( prev ) + "\">" + alang( ctx, "prevPhoto" ) + "</a> | <a href=\"" + alink.ToAppData( next ) + "\">" + alang( ctx, "nextPhoto" ) + "</a>";
return prenext;
}
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:16,代码来源:Post.cs
示例13: Deserialize
public object Deserialize(JsonValue json, JsonMapper mapper)
{
PhotoPost post = null;
if ( json != null && !json.IsNull )
{
post = new PhotoPost();
post.ID = json.ContainsName("id" ) ? json.GetValue<string>("id" ) : String.Empty;
post.PhotoId = json.ContainsName("object_id" ) ? json.GetValue<string>("object_id") : String.Empty;
post.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue<string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue;
post.UpdatedTime = json.ContainsName("updated_time") ? JsonUtils.ToDateTime(json.GetValue<string>("updated_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue;
post.From = mapper.Deserialize<Reference>(json.GetValue("from"));
post.Tags = mapper.Deserialize<List<Tag>>(json.GetValue("tags"));
}
return post;
}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:16,代码来源:PhotoPostDeserializer.cs
示例14: BindPostSingle
public static void BindPostSingle( MvcContext ctx, IBlock block, PhotoPost x, List<int> likedIds )
{
block.Set( "x.Link", PhotoLink.ToPost( x.Id ) );
block.Set( "x.Title", x.Title );
block.Set( "x.Description", x.Description );
block.Set( "x.Pic", x.ImgThumbUrl );
block.Set( "x.PicM", x.ImgMediumUrl );
block.Set( "x.PicO", x.ImgUrl );
block.Set( "x.Pins", x.Pins );
block.Set( "x.Likes", x.Likes );
String pinsLikes = "";
if (x.Pins > 0) pinsLikes += "收集:" + x.Pins;
if (x.Likes > 0) pinsLikes += " 喜欢:" + x.Likes;
if (x.Replies > 0) pinsLikes += " 评论:" + x.Replies;
block.Set( "x.PinsLikes", pinsLikes );
if (x.PhotoAlbum != null) {
block.Set( "x.AlbumName", x.PhotoAlbum.Name );
block.Set( "x.AlbumLink", PhotoLink.ToAlbumOne( x.PhotoAlbum.OwnerUrl, x.PhotoAlbum.Id ) );
}
else {
block.Set( "x.AlbumName", "" );
block.Set( "x.AlbumLink", "#" );
}
block.Set( "x.CreatorName", x.Creator.Name );
block.Set( "x.CreatorPic", x.Creator.PicSmall );
block.Set( "x.CreatorLink", PhotoLink.ToUser( x.Creator ) );
block.Set( "x.Created", cvt.ToTimeString( x.Created ) );
block.Set( "x.RepinLink", ctx.link.To( new HomeController().Repin, x.Id ) );
block.Set( "x.LikeLink", ctx.link.To( new HomeController().Like, x.Id ) );
block.Set( "x.UnLikeLink", ctx.link.To( new HomeController().UnLike, x.Id ) );
if (likedIds.Contains( x.Id )) {
block.Set( "x.LikedCss", "wfpost-liked disabled" );
block.Set( "x.LikeName", "已喜欢" );
}
else {
block.Set( "x.LikedCss", "wfpost-like" );
block.Set( "x.LikeName", "<i class=\"icon-heart icon-white\"></i> 喜欢" );
}
}
开发者ID:Boshin,项目名称:wojilu,代码行数:46,代码来源:PhotoBinder.cs
示例15: addPhotoPosts
private void addPhotoPosts( MvcContext ctx )
{
User creator = ctx.viewer.obj as User;
for (int i = 0; i < 20; i++) {
PhotoPost x = new PhotoPost();
x.DataUrl = Img.CopyToUploadPath( "/__installer/pic/pic" + i + ".jpg" );
x.Creator = creator;
x.CreatorUrl = creator.Url;
x.OwnerId = creator.Id;
x.OwnerType = creator.GetType().FullName;
x.OwnerUrl = creator.Url;
x.Title = Path.GetFileName( x.DataUrl );
x.insert();
}
}
开发者ID:Boshin,项目名称:wojilu,代码行数:20,代码来源:WaterfallInstaller.cs
示例16: noRepins
private bool noRepins( PhotoPost post ) {
return PhotoPost.find( "RootId=" + post.Id ).first() == null;
}
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:3,代码来源:SysPhotoService.cs
示例17: SystemUnDelete
public virtual void SystemUnDelete( PhotoPost post ) {
if (post == null) return;
post.SaveStatus = (int)SaveStatus.Normal;
db.update( post, "SaveStatus" );
}
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:5,代码来源:SysPhotoService.cs
示例18: log
private void log( String msg, PhotoPost post )
{
String dataInfo = "{Id:" + post.Id + ", Title:'" + post.Title + "'}";
logService.Add( (User)ctx.viewer.obj, msg, dataInfo, typeof( PhotoPost ).FullName, ctx.Ip );
}
开发者ID:ningboliuwei,项目名称:wojilu,代码行数:5,代码来源:PostAdminController.cs
示例19: getStatus
private String getStatus( PhotoPost post )
{
if (pickedService.IsPicked( post )) return "picked";
return "";
}
开发者ID:ningboliuwei,项目名称:wojilu,代码行数:5,代码来源:PostAdminController.cs
示例20: savePicPrivate
private PhotoPost savePicPrivate( HttpFile postedFile, Result result )
{
PhotoPost post = new PhotoPost();
post.OwnerId = ctx.owner.Id;
post.OwnerType = ctx.owner.obj.GetType().FullName;
post.OwnerUrl = ctx.owner.obj.Url;
post.Creator = (User)ctx.viewer.obj;
post.CreatorUrl = ctx.viewer.obj.Url;
post.DataUrl = result.Info.ToString();
post.Title = strUtil.CutString( Path.GetFileNameWithoutExtension( postedFile.FileName ), 20 );
post.Ip = ctx.Ip;
post.PhotoAlbum = new PhotoAlbum();
postService.CreatePostTemp( post );
return post;
}
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:17,代码来源:MbSaveController.cs
注:本文中的PhotoPost类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论