/// <summary> /// 展示用户发布的启示数量并显示 /// </summary> protected void DisplayNoticeCount() { try { Int64 userId = GetUserId(); if (userId == -1) // 无用户登录且 URL 不传参数 { Response.Redirect("/layout/SignIn.aspx"); return; } // 获取用户的发布的启示数量 Int32 count = NoticeService.GetNoticeCountOfUser(userId); NoticeCount.Text = count.ToString(); } catch (Exception ex) { PromptInfo.Text = ex.Message; } }