/// <summary> /// 展示用户发布的所有的启示 /// </summary> protected void DisplayNoticeList() { try { Int64 userId = GetUserId(); if (userId == -1) // 无用户登录且 URL 不传参数 { Response.Redirect("/layout/SignIn.aspx"); return; } DataTable data = NoticeService.SelectNoticeByUserId(userId); // 展示全部 if (data != null) { ListNotice.DataSource = data; ListNotice.DataBind(); } } catch (Exception ex) { PromptInfo.Text = ex.Message; } }
/// <summary> /// 显示失物招领启示 /// </summary> protected void DisplayNotice() { try { DataTable data = NoticeService.SelectNotice(10); // 前 10 条 if (data != null) { ListNotice.DataSource = data; ListNotice.DataBind(); } } catch (Exception ex) { PromptInfo.Text = ex.Message; } }
/// <summary> /// 展示对应种类的启示 /// </summary> protected void DisplayNoticeOfSpecies() { try { DataTable data = GetDataOfNotice(); if (data != null) { ListNotice.DataSource = data; ListNotice.DataBind(); } } catch (Exception ex) { PromptInfo.Text = ex.Message; Response.Redirect(URL_HOME); // 跳转首页 } }