コード例 #1
0
    protected void bookshelf_Click(object sender, ImageClickEventArgs e)
    {
        //加入书架
        int bookId = Convert.ToInt32(Request.QueryString["bookId"]);

        IDAL.INovel iu = BllFactory.BllAccess.CreateINovelBLL();

        if (HttpContext.Current.User.Identity.Name == "")
        {
            ClientScript.RegisterClientScriptBlock(this.GetType(), "ok",
                                                   "<script type='text/javascript'>alert('您还未登陆,请先登陆!');</script>", false
                                                   );
        }
        else
        {
            int userId = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
            int count  = iu.adduserBookShelf(userId, bookId);
            if (count > 0)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "ok",
                                                       "<script type='text/javascript'>alert('已将书本加入您的书架!');</script>", false
                                                       );
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "buok",
                                                       "<script type='text/javascript'>alert('您的书架里已有该书!');</script>", false
                                                       );
            }
        }
    }
コード例 #2
0
 protected void repBooksSelf_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     //删除用户书架书本
     if (e.CommandName == "delbook")
     {
         LinkButton  delbutton = (LinkButton)e.Item.FindControl("delshelfbook");
         int         bookid    = Convert.ToInt32(delbutton.CommandArgument);
         int         userId    = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
         IDAL.INovel novel     = BllFactory.BllAccess.CreateINovelBLL();
         novel.delUserbookShelf(userId, bookid);
         Response.Redirect("UserBookShelf.aspx");
     }
 }
コード例 #3
0
    protected void readingbook_Click(object sender, ImageClickEventArgs e)
    {
        //订阅书
        int bookID = Convert.ToInt32(Request.QueryString["bookId"]);

        IDAL.INovel novel = BllFactory.BllAccess.CreateINovelBLL();
        if (HttpContext.Current.User.Identity.Name == "")
        {
            ClientScript.RegisterClientScriptBlock(this.GetType(), "ok",
                                                   "<script type='text/javascript'>alert('您还未登陆,请先登陆!');</script>", false
                                                   );
        }
        else
        {
            int userId = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
            int count  = novel.userAfterBook(userId, bookID);
            if (count > 0)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "ok",
                                                       "<script type='text/javascript'>alert('成功订阅该书,章节更新时将站内短消息通知您!');</script>", false
                                                       );
            }
            else
            {
                int userid   = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
                int counterr = novel.isReaddingBook(userid, bookID);
                if (counterr == -1)
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "buok",
                                                           "<script type='text/javascript'>alert('您已经订阅过该书。');</script>", false
                                                           );
                }
                else
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "buok", "<script type='text/javascript'>alert('你没有订阅连载卡,请到商城购买再订阅连载!');</script>", false);
                }
            }
        }
    }
コード例 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //判断用户是否有阅读权限
        IDAL.INovel vn = BllFactory.BllAccess.CreateINovelBLL();
        List <Model.SectionsInfo> volumeNumber = vn.sectionsVolumeNumber(Convert.ToInt32(Request.QueryString["SectiuonId"]));

        //处理URL
        string parentURl = Request.UrlReferrer.ToString();
        int    temp      = parentURl.LastIndexOf("/");

        parentURl = parentURl.Substring(0, temp);
        parentURl = parentURl + "/BooksInfo.aspx?bookId=" + Request.QueryString["bookId"];
        if (volumeNumber[0].VolumeId > 1)
        {
            if (User.Identity.Name != "" && Session["NewUser"] != null)
            {
                List <UsersInfo> list = (List <UsersInfo>)Session["NewUser"];
                if (list[0].UserType < 2 || list[0].UserType > 4)
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "noread", "<script type='text/javascript'>alert('对不起,您没有阅读权限,请成为本站VIP!');this.location.href='" + parentURl + "';</script>", false);
                    return;
                }
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "noread", "<script type='text/javascript'>alert('对不起,您没有阅读权限,请成为本站VIP!');this.location.href='" + parentURl + "';</script>", false);
                return;
            }
        }


        if (!IsPostBack)
        {
            //增加点击量
            novel.sectionClickCount(Convert.ToInt32(Request.QueryString["SectiuonId"]));

            if (Request.QueryString["Next"] == null)
            {
                booksInfo = novel.getSectionsInfo(Convert.ToInt32(Request.QueryString["SectiuonId"]));
            }
            else if (Request.QueryString["Next"] == "0")
            {
                booksInfo = novel.getAnteSections(Convert.ToInt32(Request.QueryString["SectiuonId"]), Convert.ToInt32(Request.QueryString["bookId"]));
                if (booksInfo == null)
                {
                    string url = "~/BooksInfo.aspx?bookId=" + Request.QueryString["bookId"];
                    Response.Redirect(url);
                }
            }
            else if (Request.QueryString["Next"] == "1")
            {
                booksInfo = novel.getNextSections(Convert.ToInt32(Request.QueryString["SectiuonId"]), Convert.ToInt32(Request.QueryString["bookId"]));
                if (booksInfo == null)
                {
                    string url = "~/BooksInfo.aspx?bookId=" + Request.QueryString["bookId"];
                    Response.Redirect(url);
                }
            }

            booksInfo.ValumeName = Common.Myweeks.changeNumber(booksInfo.ValumeName);
            lbBookName.Text      = booksInfo.SectionTitle;
            lbUserName.Text      = "小说名称:" + booksInfo.BookName + "    " + "作者:" + booksInfo.UserName;
            AddTime.Text         = "更新时间:" + booksInfo.AddTime.ToShortDateString();

            sectionsinfo.InnerHtml = booksInfo.Contents;

            cataLog.NavigateUrl    = "~/BooksInfo.aspx?bookId=" + booksInfo.BookId;
            hlUpLeaf.NavigateUrl   = "~/BookSectionsInfo.aspx?bookId=" + booksInfo.BookId + "&&SectiuonId=" + booksInfo.SectiuonId + "&&Next=0";
            lbNextLeaf.NavigateUrl = "~/BookSectionsInfo.aspx?bookId=" + booksInfo.BookId + "&&SectiuonId=" + booksInfo.SectiuonId + "&&Next=1";
        }
    }