public BoolWithPrimaryKeyView Tread(string publishID)
    {
        TreadInfo tempThreadInfo = ((TreadInfoDao)ItreadInfo).GetUserTreadInfo(new MyCommunityBehaviorView()
        {
            PublishID = publishID
        });
        bool   operResult = false;
        string operID     = string.Empty;

        if (tempThreadInfo == null)
        {
            TreadInfo treadInfo = new TreadInfo()
            {
                ID          = Guid.NewGuid().ToString(),
                PublishID   = publishID,
                TreaderID   = this.UserID,
                TreaderName = this.UserName,
                TreadTime   = DateTime.Now
            };
            operID     = treadInfo.ID;
            operResult = ItreadInfo.Insert(treadInfo);
        }
        else
        {
            operResult = ItreadInfo.Delete(tempThreadInfo.ID);
        }

        BoolWithPrimaryKeyView result = new BoolWithPrimaryKeyView()
        {
            PrimaryID = operID,
            result    = operResult
        };

        return(result);
    }
    public BoolWithPrimaryKeyView Praise(string publishID)
    {
        PraiseInfo tempPraiseInfo = ((PraiseInfoDao)IpraiseInfo).GetUserPraiseInfo(new MyCommunityBehaviorView()
        {
            PublishID = publishID
        });
        bool   operResult = false;
        string operID     = string.Empty;

        if (tempPraiseInfo == null)
        {//点赞操作
            PraiseInfo praiseInfo = new PraiseInfo()
            {
                ID          = Guid.NewGuid().ToString(),
                PublishID   = publishID,
                PraiserID   = this.UserID,
                PraiserName = this.UserName,
                PraiseTime  = DateTime.Now,
            };
            operID     = praiseInfo.ID;
            operResult = IpraiseInfo.Insert(praiseInfo);
        }
        else
        {//取消赞操作
            operResult = IpraiseInfo.Delete(tempPraiseInfo.ID);
        }

        BoolWithPrimaryKeyView result = new BoolWithPrimaryKeyView()
        {
            PrimaryID = operID,//取消赞时为空,点赞时为新增记录ID
            result    = operResult
        };

        return(result);
    }
    public BoolWithPrimaryKeyView Comment(BroadcastCommentView commentView)
    {
        CommentInfo comment = new CommentInfo()
        {
            ID                = Guid.NewGuid().ToString(),
            Content           = commentView.Content,
            PublishID         = commentView.PublishID,
            CommentTime       = DateTime.Now,
            FromCommenterID   = this.UserID,
            FromCommenterName = this.UserName,
        };
        bool temp = IcommentInfo.Insert(comment);


        BoolWithPrimaryKeyView result = new BoolWithPrimaryKeyView()
        {
            PrimaryID = temp == true ? comment.ID : string.Empty,
            result    = temp
        };

        return(result);
    }
Пример #4
0
    public BoolWithPrimaryKeyView SubmitMessage(ToCommentView commentView)
    {
        Miic.Friends.Community.MessageInfo messageInfo = new Miic.Friends.Community.MessageInfo()
        {
            ID                = Guid.NewGuid().ToString(),
            Content           = commentView.Content,
            TopicID           = commentView.PublishID,
            CommentTime       = DateTime.Now,
            FromCommenterID   = this.UserID,
            FromCommenterName = this.UserName,
            ToCommenterID     = commentView.ToCommenterID,
            ToCommenterName   = commentView.ToCommenterName
        };
        bool temp = ImessageInfo.Insert(messageInfo);
        BoolWithPrimaryKeyView result = new BoolWithPrimaryKeyView()
        {
            PrimaryID = temp == true ? messageInfo.ID : string.Empty,
            result    = temp
        };

        return(result);
    }
    public BoolWithPrimaryKeyView AddBrowse(string publishID)
    {
        string BrowserID;
        string BrowserName;

        //将当前用户的浏览记录计入数据库
        if (!string.IsNullOrEmpty(UserID))
        {
            BrowserID   = UserID;
            BrowserName = UserName;
        }
        else
        {
            //如果当前没有人登录,则按照匿名用户浏览
            BrowserID   = anonymousUserConfigSection.UserID;
            BrowserName = anonymousUserConfigSection.UserName;
        }
        //获得浏览存储的信息
        //线上活动ID、浏览人的ID与名称、浏览时间、是否失效
        BrowseInfo browseInfo = new BrowseInfo()
        {
            ID          = Guid.NewGuid().ToString(),
            PublishID   = publishID,
            BrowserID   = BrowserID,
            BrowserName = BrowserName,
            BrowseTime  = DateTime.Now,
            BrowserIP   = HttpContext.Current.Request.UserHostAddress,
            IsHinted    = ((int)MiicYesNoSetting.Yes).ToString()
        };
        bool browseResult             = IbrowseInfo.Insert(browseInfo);
        BoolWithPrimaryKeyView result = new BoolWithPrimaryKeyView()
        {
            PrimaryID = browseResult == true ? browseInfo.ID : string.Empty,
            result    = browseResult
        };

        return(result);
    }
    public BoolWithPrimaryKeyView Collect(string publishID)
    {
        CollectInfo tempCollectInfo = ((CollectInfoDao)IcollectInfo).GetUserCollectInfo(new MyCommunityBehaviorView()
        {
            PublishID = publishID
        });
        bool   operResult = false;
        string operID     = string.Empty;

        if (tempCollectInfo == null)
        {
            CollectInfo collectInfo = new CollectInfo()
            {
                ID            = Guid.NewGuid().ToString(),
                CollectorID   = this.UserID,
                CollectorName = this.UserName,
                CollectTime   = DateTime.Now,
                PublishID     = publishID,
                CollectValid  = ((int)MiicValidTypeSetting.Valid).ToString()
            };
            operID     = collectInfo.ID;
            operResult = IcollectInfo.Insert(collectInfo);
        }
        else
        {
            operResult = IcollectInfo.Delete(tempCollectInfo.ID);
        }

        BoolWithPrimaryKeyView result = new BoolWithPrimaryKeyView()
        {
            PrimaryID = operID,
            result    = operResult
        };

        return(result);
    }
Пример #7
0
    public BoolWithPrimaryKeyView Report(string publishID)
    {
        ReportInfo tempReportInfo = ((ReportInfoDao)IreportInfo).GetUserReportInfo(new MyBehaviorView()
        {
            PublishID = publishID
        });
        bool   operResult = false;
        string operID     = string.Empty;

        if (tempReportInfo == null)
        {
            ReportInfo reportInfo = new ReportInfo()
            {
                ID           = Guid.NewGuid().ToString(),
                PublishID    = publishID,
                ReporterID   = this.UserID,
                ReporterName = this.UserName,
                ReportTime   = DateTime.Now
            };

            operID     = reportInfo.ID;
            operResult = IreportInfo.Insert(reportInfo);
        }
        else
        {
            operResult = IreportInfo.Delete(tempReportInfo.ID);
        }

        BoolWithPrimaryKeyView result = new BoolWithPrimaryKeyView()
        {
            PrimaryID = operID,
            result    = operResult
        };

        return(result);
    }