コード例 #1
0
ファイル: ViewVideo.aspx.cs プロジェクト: Homory-Temp/LeYi
 protected void rating_OnRate(object sender, EventArgs e)
 {
     if (!IsOnline)
     {
         SignOn();
         return;
     }
     HomoryContext.Value.ST_Resource(CurrentResource.Id, ResourceOperationType.Rate, 1);
     HomoryContext.Value.ST_Resource(CurrentResource.Id, ResourceOperationType.Grade, rating.Value);
     // 1次3.5分
     int low = CurrentResource.Rate;
     decimal lowV = CurrentResource.Grade;
     CurrentResource.Rate += 1;
     CurrentResource.Grade = decimal.Divide(low * lowV + rating.Value,
         low + 1);
     // (3.5*1+4.5)/(1+1)
     var action = new Homory.Model.Action
     {
         Id = HomoryContext.Value.GetId(),
         Id1 = TargetUser.Id,
         Id2 = CurrentResource.Id,
         Id3 = CurrentUser.Id,
         Content1 = rating.Value.ToString(),
         Type = ActionType.用户评分资源,
         State = State.启用,
         Time = DateTime.Now,
     };
     HomoryContext.Value.Action.Add(action);
     HomoryContext.Value.SaveChanges();
     rating.Enabled = false;
     bestPanel.RaisePostBackEvent("Refresh");
     scorePanel.RaisePostBackEvent("Refresh");
 }
コード例 #2
0
ファイル: ViewVideo.aspx.cs プロジェクト: Homory-Temp/LeYi
 protected void replyReply_OnServerClick(object sender, EventArgs e)
 {
     if (!IsOnline)
     {
         SignOn();
         return;
     }
     var x = (sender as HtmlAnchor).Parent.FindControl("replyContent") as HtmlTextArea;
     var id = Guid.Parse(((sender as HtmlAnchor).Parent.FindControl("replyId") as HtmlInputHidden).Value);
     if (string.IsNullOrWhiteSpace(x.Value.Trim()))
     {
         return;
     }
     if (string.IsNullOrWhiteSpace(x.Value.Trim()))
         return;
     var c = new ResourceComment
     {
         Id = HomoryContext.Value.GetId(),
         ParentId = id,
         ResourceId = CurrentResource.Id,
         UserId = CurrentUser.Id,
         Content = x.Value.Trim(),
         Timed = false,
         Level = HomoryContext.Value.ResourceComment.First(o => o.Id == id).Level + 1,
         Time = DateTime.Now,
         State = State.启用
     };
     HomoryContext.Value.ResourceComment.Add(c);
     HomoryContext.Value.ST_Resource(CurrentResource.Id, ResourceOperationType.Comment, 1);
     CurrentResource.Comment += 1;
     var action = new Homory.Model.Action
     {
         Id = HomoryContext.Value.GetId(),
         Id1 = TargetUser.Id,
         Id2 = CurrentResource.Id,
         Id3 = CurrentUser.Id,
         Id4 = id,
         Content1 = x.Value.Trim(),
         Type = ActionType.用户回复评论,
         State = State.启用,
         Time = DateTime.Now,
     };
     HomoryContext.Value.Action.Add(action);
     LogOp(ResourceLogType.回复评论, 1);
     HomoryContext.Value.SaveChanges();
     BindComment();
 }
コード例 #3
0
ファイル: ViewVideo.aspx.cs プロジェクト: Homory-Temp/LeYi
 protected void favourite_OnServerClick(object sender, EventArgs e)
 {
     if (!IsOnline)
     {
         SignOn();
         return;
     }
     if (HomoryContext.Value.Action.Count(o => o.Id2 == CurrentResource.Id && o.Id3 == CurrentUser.Id && o.Type == ActionType.用户收藏资源 && o.State == State.启用) == 0)
     {
         HomoryContext.Value.ST_Resource(CurrentResource.Id, ResourceOperationType.Favourite, 1);
         var action = new Homory.Model.Action
         {
             Id = HomoryContext.Value.GetId(),
             Id1 = TargetUser.Id,
             Id2 = CurrentResource.Id,
             Id3 = CurrentUser.Id,
             Type = ActionType.用户收藏资源,
             State = State.启用,
             Time = DateTime.Now,
         };
         HomoryContext.Value.Action.Add(action);
         CurrentResource.Favourite += 1;
         LogOp(ResourceLogType.收藏资源, 1);
         HomoryContext.Value.SaveChanges();
         xxxxx.BgColor = "#4fc0e8";
     }
     favouriteCount.InnerText = CurrentResource.Favourite.ToString();
 }
コード例 #4
0
ファイル: ViewVideo.aspx.cs プロジェクト: Homory-Temp/LeYi
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    var cat = CurrentAssessTable;
                    if (cat != null)
                        this.accessId_hidden.Text = CurrentResource.Id.ToString();
                }
                catch
                {
                }
                var path = Server.MapPath(CurrentResource.Preview);
                bool yes = false;
                if (File.Exists(path))
                {
                    //FileInfo info = new FileInfo(path);
                    //try
                    //{
                        //var s = info.OpenWrite();
                        //try
                        //{
                            //s.Close();
                        //}
                        //catch
                        //{
                        //}
                        yes = true;
                    //}
                    //catch
                    //{
                    //}
                }
                // var hideRes = CurrentResource.OpenType == OpenType.不公开 || (CurrentResource.OpenType == OpenType.所在学校) && !IsOnline;
                var hideRes = CurrentResource.OpenType == OpenType.不公开 || ((CurrentResource.OpenType == OpenType.全部学校 || CurrentResource.OpenType == OpenType.所在学校) && !IsOnline);
                var showRes = IsOnline && CurrentUser.Id == CurrentResource.UserId;

                if (hideRes && !showRes)
                {
                    ri.Visible = ri2.Visible = ri3.Visible = assessPanel.Visible = ri4.Visible = commentPanel.Visible = ni.Visible = pppp1.Visible = pppp2.Visible = false;
                    notAllowed.Visible = true;
                }
                else
                {
                    notAllowed.Visible = false;
                    if (!yes)
                    {
                        ni.Visible = true;
                        ri.Visible = ri2.Visible = ri3.Visible = assessPanel.Visible = ri4.Visible = commentPanel.Visible = ri5.Visible = pppp1.Visible = pppp2.Visible = false;
                        preview_timer.Enabled = true;
                    }
                    else
                    {
                        ni.Visible = false;
                        ri.Visible = ri2.Visible = ri3.Visible = assessPanel.Visible = ri4.Visible = commentPanel.Visible = ri5.Visible = pppp1.Visible = pppp2.Visible = true;
                        preview_timer.Enabled = false;
                    }
                }
                player.Video = CurrentResource.Preview;
                catalog.Visible = CurrentResource.Type == ResourceType.视频 && CurrentResource.ResourceCatalog.Count(y => y.State < State.审核 && y.Catalog.State < State.审核 && y.Catalog.Type == CatalogType.视频) > 0;
                tag.Visible = CanCombineTags();
                mb.Visible = !string.IsNullOrEmpty(CurrentResource.Preview);
                var p =
                    TargetUser.Resource.Where(
                        o => o.State == State.启用 && o.Type == CurrentResource.Type && o.Time > CurrentResource.Time)
                        .OrderByDescending(o => o.Time).FirstOrDefault();
                if (p != null)
                {
                    previous.Visible = true;
                    previousLink.InnerText = p.Title;
                    previousLink.HRef = string.Format("../Go/ViewVideo?Id={0}", p.Id);
                }
                var n =
                    TargetUser.Resource.Where(
                        o => o.State == State.启用 && o.Type == CurrentResource.Type && o.Time < CurrentResource.Time)
                        .OrderByDescending(o => o.Time)
                        .FirstOrDefault();
                if (n != null)
                {
                    next.Visible = true;
                    nextLink.InnerText = n.Title;
                    nextLink.HRef = string.Format("../Go/ViewVideo?Id={0}", n.Id);
                }
                if (IsOnline)
                {
                    LogOp(ResourceLogType.浏览资源, 1);
                    var rate = HomoryContext.Value.Action.FirstOrDefault(o => o.Id2 == CurrentResource.Id && o.Id3 == CurrentUser.Id && o.Type == ActionType.用户评分资源 && o.State == State.启用);
                    if (rate != null)
                    {
                        rating.Enabled = false;
                        rating.Value = decimal.Parse(rate.Content1);
                    }
                    if (HomoryContext.Value.MediaNote.Count(o => o.ResourceId == CurrentResource.Id && o.UserId == CurrentUser.Id) > 0)
                    {
                        var mn = HomoryContext.Value.MediaNote.First(o => o.ResourceId == CurrentResource.Id && o.UserId == CurrentUser.Id);
                        mn1.InnerText = mn.A;
                        mn2.InnerText = mn.B;
                    }
                }
                HomoryContext.Value.ST_Resource(CurrentResource.Id, ResourceOperationType.View, 1);
                if (IsOnline)
                {
                    var action = HomoryContext.Value.Action.FirstOrDefault(o => o.Id1 == TargetUser.Id && o.Id2 == CurrentResource.Id && o.Id3 == CurrentUser.Id && o.Type == ActionType.用户访问资源);
                    if (action == null)
                    {
                        action = new Homory.Model.Action
                        {
                            Id = HomoryContext.Value.GetId(),
                            Id1 = TargetUser.Id,
                            Id2 = CurrentResource.Id,
                            Id3 = CurrentUser.Id,
                            Type = ActionType.用户访问资源,
                            State = State.启用,
                            Time = DateTime.Now,
                        };
                        HomoryContext.Value.Action.Add(action);
                    }
                    else
                    {
                        action.Time = DateTime.Now;
                    }
                    if (Queryable.Count(HomoryContext.Value.Action, o => o.Id2 == CurrentResource.Id && o.Id3 == CurrentUser.Id && o.Type == ActionType.用户收藏资源 && o.State == State.启用) == 0)
                    {
                        xxxxx.BgColor = "#adadad";
                    }
                    else
                    {
                        xxxxx.BgColor = "#4fc0e8";
                    }
                }
                else
                {
                    xxxxx.BgColor = "#adadad";
                }
                CurrentResource.View += 1;
                HomoryContext.Value.SaveChanges();
                downloadCount.InnerText = CurrentResource.Download.ToString();
                favouriteCount.InnerText = CurrentResource.Favourite.ToString();
                icon.ImageUrl = P(TargetUser.Icon);
                name.Text = UC(TargetUser.Id).Replace("无锡市", "").Replace("无锡", "");
                nameX.Text = TargetUser.DisplayName;
                viewCount.Text = CurrentResource.View.ToString();
                viewList.DataSource = Queryable.Take(HomoryContext.Value.Action.Where(o => o.Id2 == CurrentResource.Id && o.Type == ActionType.用户访问资源).OrderByDescending(q => q.Time), 9)
                        .ToList();
                viewList.DataBind();
                var rt = CurrentResource.Type;
                latest.DataSource =
                    TargetUser.Resource.Where(o => o.State == State.启用 && o.Type == rt)
                        .OrderByDescending(o => o.Time)
                        .Take(9)
                        .ToList();
                latest.DataBind();
                popular.DataSource =
                TargetUser.Resource.Where(o => o.State == State.启用 && o.Type == rt)
                    .OrderByDescending(o => o.View)
                    .Take(9)
                    .ToList();
                popular.DataBind();
                best.DataSource =
            TargetUser.Resource.Where(o => o.State == State.启用 && o.Type == rt)
            .OrderByDescending(o => o.Grade)
            .Take(9)
            .ToList();
                best.DataBind();
                BindComment();
                score.InnerText = CurrentResource.Grade.ToString();

            }
        }
コード例 #5
0
ファイル: ViewVideo.aspx.cs プロジェクト: Homory-Temp/LeYi
 protected void download_OnServerClick(object sender, EventArgs e)
 {
     HomoryContext.Value.ST_Resource(CurrentResource.Id, ResourceOperationType.Download, 1);
     if (IsOnline)
     {
         var action = new Homory.Model.Action
         {
             Id = HomoryContext.Value.GetId(),
             Id1 = TargetUser.Id,
             Id2 = CurrentResource.Id,
             Id3 = CurrentUser.Id,
             Type = ActionType.用户下载资源,
             State = State.启用,
             Time = DateTime.Now,
         };
         HomoryContext.Value.Action.Add(action);
     }
     CurrentResource.Download += 1;
     LogOp(ResourceLogType.下载资源, 1);
     HomoryContext.Value.SaveChanges();
     downloadCount.InnerText = CurrentResource.Download.ToString();
     downloadPanel.ResponseScripts.Add(string.Format("window.open('{0}');", CurrentResource.Source));
 }
コード例 #6
0
ファイル: ViewVideo.aspx.cs プロジェクト: Homory-Temp/LeYi
 protected void dotSend_Click(object sender, EventArgs e)
 {
     if (!IsOnline)
     {
         SignOn();
         return;
     }
     if (string.IsNullOrWhiteSpace(dotContent.Text.Trim()))
         return;
     decimal t1, t2;
     decimal? ta, tb;
     decimal.TryParse(startDot.Text.Replace("'", ""), out t1);
     decimal.TryParse(endDot.Text.Replace("'", ""), out t2);
     if (t1 == 0 && t2 == 0)
     {
         ta = tb = (decimal?)null;
     }
     else if (t1 == 0)
     {
         ta = 0;
         tb = t2;
     }
     else if (t2 == 0)
     {
         ta = t1;
         tb = (decimal?)null;
     }
     else
     {
         ta = t1;
         tb = t2;
     }
     var c = new ResourceComment
     {
         Id = HomoryContext.Value.GetId(),
         ParentId = null,
         ResourceId = CurrentResource.Id,
         UserId = CurrentUser.Id,
         Content = dotContent.Text.Trim(),
         Start = ta,
         End = tb,
         Timed = t1 > 0 || t2 > 0,
         Level = 0,
         Time = DateTime.Now,
         State = State.启用
     };
     HomoryContext.Value.ResourceComment.Add(c);
     HomoryContext.Value.ST_Resource(CurrentResource.Id, ResourceOperationType.Comment, 1);
     CurrentResource.Comment += 1;
     var action = new Homory.Model.Action
     {
         Id = HomoryContext.Value.GetId(),
         Id1 = TargetUser.Id,
         Id2 = CurrentResource.Id,
         Id3 = CurrentUser.Id,
         Content1 = dotContent.Text.Trim(),
         Type = ActionType.用户评论资源,
         State = State.启用,
         Time = DateTime.Now,
     };
     HomoryContext.Value.Action.Add(action);
     HomoryContext.Value.SaveChanges();
     dotContent.Text = string.Empty;
     Response.Redirect(Request.Url.PathAndQuery, false);
 }
コード例 #7
0
ファイル: ViewVideo.aspx.cs プロジェクト: Homory-Temp/LeYi
 protected void doComment_OnServerClick(object sender, EventArgs e)
 {
     if (!IsOnline)
     {
         SignOn();
         return;
     }
     if (string.IsNullOrWhiteSpace(comment.Value.Trim()))
         return;
     var c = new ResourceComment
     {
         Id = HomoryContext.Value.GetId(),
         ParentId = null,
         ResourceId = CurrentResource.Id,
         UserId = CurrentUser.Id,
         Content = comment.Value.Trim(),
         Timed = false,
         Level = 0,
         Time = DateTime.Now,
         State = State.启用
     };
     HomoryContext.Value.ResourceComment.Add(c);
     HomoryContext.Value.ST_Resource(CurrentResource.Id, ResourceOperationType.Comment, 1);
     CurrentResource.Comment += 1;
     var action = new Homory.Model.Action
     {
         Id = HomoryContext.Value.GetId(),
         Id1 = TargetUser.Id,
         Id2 = CurrentResource.Id,
         Id3 = CurrentUser.Id,
         Content1 = comment.Value.Trim(),
         Type = ActionType.用户评论资源,
         State = State.启用,
         Time = DateTime.Now,
     };
     HomoryContext.Value.Action.Add(action);
     LogOp(ResourceLogType.评论资源, 1);
     HomoryContext.Value.SaveChanges();
     comment.Value = string.Empty;
     BindComment();
 }
コード例 #8
0
ファイル: ViewPlainFix.aspx.cs プロジェクト: Homory-Temp/LeYi
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LogOp(ResourceLogType.浏览资源);
                tag.Visible = CanCombineTags();
                var url = string.Format("../Document/web/PdfViewer.aspx?Id={0}&Random={1}", Request.QueryString["Id"],
                    Guid.NewGuid());
                // publish_preview_pdf.Attributes["src"] = url;
                catalog.Visible = CurrentResource.Type == ResourceType.文章 && CurrentResource.ResourceCatalog.Count(y => y.State < State.审核 && y.Catalog.State< State.审核 && y.Catalog.Type == CatalogType.文章) > 0;
                var p =
                    TargetUser.Resource.Where(
                        o => o.State == State.启用 && o.Type == CurrentResource.Type && o.Time > CurrentResource.Time)
                        .OrderByDescending(o => o.Time).FirstOrDefault();
                if (p != null)
                {
                    previous.Visible = true;
                    previousLink.InnerText = p.Title;
                    previousLink.HRef = string.Format("../Go/ViewPlain?Id={0}", p.Id);
                }
                var n =
                    TargetUser.Resource.Where(
                        o => o.State == State.启用 && o.Type == CurrentResource.Type && o.Time < CurrentResource.Time)
                        .OrderByDescending(o => o.Time)
                        .FirstOrDefault();
                if (n != null)
                {
                    next.Visible = true;
                    nextLink.InnerText = n.Title;
                    nextLink.HRef = string.Format("../Go/ViewPlain?Id={0}", n.Id);
                }
                if (IsOnline)
                {
                    var rate = HomoryContext.Value.Action.FirstOrDefault(o => o.Id2 == CurrentResource.Id && o.Id3 == CurrentUser.Id && o.Type == ActionType.用户评分资源 && o.State == State.启用);
                    if (rate != null)
                    {
                        rating.Enabled = false;
                        rating.Value = decimal.Parse(rate.Content1);
                    }
                }
                HomoryContext.Value.ST_Resource(CurrentResource.Id, ResourceOperationType.View, 1);
                if (IsOnline)
                {
                    var action = HomoryContext.Value.Action.FirstOrDefault(o => o.Id1 == TargetUser.Id && o.Id2 == CurrentResource.Id && o.Id3 == CurrentUser.Id && o.Type == ActionType.用户访问资源);
                    if (action == null)
                    {
                        action = new Homory.Model.Action
                        {
                            Id = HomoryContext.Value.GetId(),
                            Id1 = TargetUser.Id,
                            Id2 = CurrentResource.Id,
                            Id3 = CurrentUser.Id,
                            Type = ActionType.用户访问资源,
                            State = State.启用,
                            Time = DateTime.Now,
                        };
                        HomoryContext.Value.Action.Add(action);
                    }
                    else
                    {
                        action.Time = DateTime.Now;
                    }
                    if (HomoryContext.Value.Action.Count(o => o.Id2 == CurrentResource.Id && o.Id3 == CurrentUser.Id && o.Type == ActionType.用户收藏资源 && o.State == State.启用) == 0)
                    {
                        favourite.Attributes["Class"] = "homory0";
                    }
                    else
                    {
                        favourite.Attributes["Class"] = "homory1";
                    }
                }
                else
                {
                    favourite.Attributes["Class"] = "homory0";
                }
                CurrentResource.View += 1;
                HomoryContext.Value.SaveChanges();
                downloadCount.InnerText = CurrentResource.Download.ToString();
                favouriteCount.InnerText = CurrentResource.Favourite.ToString();
                icon.ImageUrl = P(TargetUser.Icon);
                name.Text = UC(TargetUser.Id).Replace("无锡市", "").Replace("无锡", "");
                nameX.Text = TargetUser.DisplayName;
                viewCount.Text = CurrentResource.View.ToString();
                viewList.DataSource = HomoryContext.Value.Action.Where(o => o.Id2 == CurrentResource.Id && o.Type == ActionType.用户访问资源).OrderByDescending(q => q.Time)
                        .Take(9)
                        .ToList();
                viewList.DataBind();
                var rt = CurrentResource.Type;
                latest.DataSource =
                    TargetUser.Resource.Where(o => o.State == State.启用 && o.Type == rt)
                        .OrderByDescending(o => o.Time)
                        .Take(9)
                        .ToList();
                latest.DataBind();
                popular.DataSource =
                TargetUser.Resource.Where(o => o.State == State.启用 && o.Type == rt)
                    .OrderByDescending(o => o.View)
                    .Take(9)
                    .ToList();
                popular.DataBind();
                best.DataSource =
            TargetUser.Resource.Where(o => o.State == State.启用 && o.Type == rt)
            .OrderByDescending(o => o.Grade)
            .Take(9)
            .ToList();
                best.DataBind();
                BindComment();
                score.InnerText = CurrentResource.Grade.ToString();
            }

            var hideRes = CurrentResource.OpenType == OpenType.不公开 || ((CurrentResource.OpenType == OpenType.全部学校 || CurrentResource.OpenType == OpenType.所在学校) && !IsOnline);
            var showRes = IsOnline && CurrentUser.Id == CurrentResource.UserId;

            if (hideRes && !showRes)
            {
                vp1.Visible = vp2.Visible = vp3.Visible = vp4.Visible = commentPanel.Visible = pppp1.Visible = pppp2.Visible = false;
                notAllowed.Visible = true;
            }
            else
            {
                notAllowed.Visible = false;
                vp1.Visible = vp2.Visible = vp3.Visible = vp4.Visible = commentPanel.Visible = pppp1.Visible = pppp2.Visible = true;
            }
        }
コード例 #9
0
ファイル: Personal.aspx.cs プロジェクト: Homory-Temp/LeYi
        protected void InitializeHomoryPage()
        {
            var user = TargetUser;
            icon.ImageUrl = P(user.Icon);
            name.Text = string.Format("{0}&nbsp;{1}", UC(user.Id), user.DisplayName);
            count1.Text = HomoryContext.Value.UserFavourite.Count(o => o.UserId == user.Id && o.State == State.启用).ToString();
            count2.Text = HomoryContext.Value.UserFavourite.Count(o => o.FavouriteUserId == user.Id && o.State == State.启用).ToString();
            count3.Text = HomoryContext.Value.Action.Count(o => o.Id3 == user.Id && o.Type == ActionType.用户收藏资源 && o.State == State.启用).ToString();

            var query = HomoryContext.Value.ResourceLog.Where(o => o.Id == user.Id);
            Label1.Text = query.Count() == 0 ? "0" : query.Sum(o => o.Media).ToString();
            Label2.Text = query.Count() == 0 ? "0" : query.Sum(o => o.Article).ToString();
            Label3.Text = query.Count() == 0 ? "0" : query.Sum(o => o.Courseware).ToString();
            Label4.Text = query.Count() == 0 ? "0" : query.Sum(o => o.Paper).ToString();

            saying.InnerText = sayings[new Random().Next(0, sayings.Length - 1)];

            var favouritesSource = TargetUser.MeFavourite.Where(o => o.State == State.启用).ToList();
            var favouritesSourceId = favouritesSource.Select(o => o.FavouriteUserId).ToList();
            //favourites.DataSource = favouritesSource.Select(o => o.FavouriteUser).ToList();
            //favourites.DataBind();
            //relatives.DataSource =
            //    HomoryContext.Value.User.Where(o => o.State < State.审核).ToList().Where(o => !favouritesSourceId.Contains(o.Id)).ToList();
            //relatives.DataBind();

            latest.DataSource =
            TargetUser.Resource.Where(o => o.State == State.启用)
            .OrderByDescending(o => o.Time)
            .Take(9)
            .ToList();
            latest.DataBind();
            popular.DataSource =
            TargetUser.Resource.Where(o => o.State == State.启用)
                .OrderByDescending(o => o.View)
                .Take(9)
                .ToList();
            popular.DataBind();
            best.DataSource =
            TargetUser.Resource.Where(o => o.State == State.启用)
            .OrderByDescending(o => o.Grade)
            .Take(9)
            .ToList();
            best.DataBind();

            if (!IsOnline || HomoryContext.Value.UserFavourite.Count(o => o.UserId == CurrentUser.Id && o.FavouriteUserId == TargetUser.Id && o.State == State.启用) == 0)
            {
                h_fav.Text = "+ 关注";
            }
            else
            {
                h_fav.Text = "- 取消关注";
            }

            if (IsOnline)
            {
                var action = HomoryContext.Value.Action.FirstOrDefault(o => o.Id1 == TargetUser.Id && o.Id2 == CurrentUser.Id && o.Type == ActionType.用户访问用户);
                if (action == null)
                {
                    action = new Homory.Model.Action
                    {
                        Id = HomoryContext.Value.GetId(),
                        Id1 = TargetUser.Id,
                        Id2 = CurrentUser.Id,
                        Type = ActionType.用户访问用户,
                        State = State.启用,
                        Time = DateTime.Now,
                    };
                    HomoryContext.Value.Action.Add(action);
                }
                else
                {
                    action.Time = DateTime.Now;
                }
            }
            var vcq = HomoryContext.Value.ResourceLog.Where(o => o.Id == TargetUser.Id);
            viewCount.Text = vcq.Count() == 0 ? "0" : vcq.Sum(o => o.View).ToString();
            viewList.DataSource = HomoryContext.Value.Action.Where(o => o.Id1 == TargetUser.Id && o.Type == ActionType.用户访问用户).OrderByDescending(q => q.Time)
                    .Take(9)
                    .ToList();
            viewList.DataBind();

            HomoryContext.Value.SaveChanges();

            if (IsOnline && CurrentUser.Id == TargetUser.Id)
            {
                h_fav.Visible = false;
            }
        }