コード例 #1
0
    protected void hlTicket_Click(object sender, EventArgs e)
    {
        //送书票
        int bookId = Convert.ToInt32(Request.QueryString["bookId"]);

        IDAL.IUsers IU = BllFactory.BllAccess.CreateIUsersBLL();

        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.userBookTickedCard(userId, bookId);
            if (count > 0)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "ok", "<script type='text/javascript'>alert('我们代表作者对您的支持表示感谢!');</script>", false);
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "ok", "<script type='text/javascript'>alert('对不起,您道具中没有书票,请去商城购买!');</script>", false);
            }
        }
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        IDAL.IUsers iu = BllFactory.BllAccess.CreateIUsersBLL();

        if (!IsPostBack)
        {
            int    pageIndex   = 1;
            int    recordCount = 0;
            int    userId      = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
            string url         = Request.Url.AbsolutePath + "?page=";

            if (Request.QueryString["page"] != null)
            {
                pageIndex = Convert.ToInt32(Request.QueryString["page"]);
            }
            repHaveProp.DataSource = iu.getUserHaveProp(userId, pageIndex, 6, out recordCount);
            repHaveProp.DataBind();


            List <Model.UsersInfo> list = iu.getBookMoney(userId);

            int pageNumber = (int)Math.Ceiling((double)recordCount / 6);

            if (recordCount == 0)
            {
                lblUserProp.Text  = "&nbsp&nbsp&nbsp&nbsp您目前没有任何道具!" + "书币剩余:" + Convert.ToInt32(list[0].BookMoney) + "&nbsp;&nbsp;&nbsp;&nbsp;";
                LastPage.Visible  = false;
                NewxtPage.Visible = false;
            }
            else
            {
                lblUserProp.Text = "&nbsp&nbsp&nbsp&nbsp您共有" + recordCount + "种道具,书币剩余:" + Convert.ToInt32(list[0].BookMoney) + "&nbsp;&nbsp;&nbsp;&nbsp;当前第 " + pageIndex + "/" + pageNumber + " 页";
            }

            FirstPage.NavigateUrl = url + 1;
            NewxtPage.NavigateUrl = url + (pageIndex + 1);
            PrvPage.NavigateUrl   = url + (pageIndex - 1);
            LastPage.NavigateUrl  = url + pageNumber;

            if (pageIndex == 1)
            {
                FirstPage.Visible = false;
                PrvPage.Visible   = false;
            }

            if (pageIndex == pageNumber)
            {
                NewxtPage.Visible = false;
                LastPage.Visible  = false;
            }
        }
    }
コード例 #3
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        IDAL.IUsers iu = BllFactory.BllAccess.CreateIUsersBLL();

        int userId = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
        int money  = Convert.ToInt32(txMoney.Text);

        int count = iu.UserPayMoney(userId, money);

        if (count > 0)
        {
            ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "ok", "<script type='text/javascript'>alert('冲值成功!');</script>", false);
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "no", "<script type='text/javascript'>alert('冲值失败!');</script>", false);
        }
    }
コード例 #4
0
    protected void Unnamed1_Click(object sender, ImageClickEventArgs e)
    {
        int    userid = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
        string newpwd = newpwd2.Text;

        IDAL.IUsers iu    = BllFactory.BllAccess.CreateIUsersBLL();
        int         count = iu.changeUserPassword(userid, newpwd);

        if (count == 1)
        {
            Session["NewUser"] = null;
            Session["cartId_shopping_" + HttpContext.Current.User.Identity.Name] = null;
            FormsAuthentication.SignOut();
            ClientScript.RegisterClientScriptBlock(this.GetType(), "close",
                                                   "<script type='text/javascript'>var dialog = Dialog.getInstance('Diag');dialog.close();alert('修改成功,请重新登陆!');dialog.TopWindow.location.href=dialog.TopWindow.location.href;</script>", false);
        }
        else
        {
        }
    }
コード例 #5
0
 public LoginUsers()
 {
     iu = Factory.DataAccess.Users();
 }
コード例 #6
0
    protected void repHaveProp_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        //获取用户类型
        List <Model.UsersInfo> userList = (List <Model.UsersInfo>)Session["NewUser"];

        if (e.CommandName == "useProp")
        {
            int         propId    = Convert.ToInt32(e.CommandArgument);
            IDAL.IUsers iu        = BllFactory.BllAccess.CreateIUsersBLL();
            IDAL.INovel novel     = BllFactory.BllAccess.CreateINovelBLL();
            int         userID    = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
            int         isAuCheck = iu.IsCheckAuthor(userID);
            switch (propId)
            {
            //VIP卡使用
            case 1:
                if (userList[0].UserType >= 2 && userList[0].UserType < 5)
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "isvip", "<script type='text/javascript'>alert('您已经具备VIP资格了,不需要使用该道具!');window.location.href=window.location.href;</script>", false);
                }
                else
                {
                    int count = novel.userVIPCard(userID);
                    if (count > 0)
                    {
                        Common.UserPanel us = new Common.UserPanel();
                        us.userExit();
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "isvip", "<script type='text/javascript'>var dialog = Dialog.getInstance('Diag');dialog.close();dialog.TopWindow.location.href=dialog.TopWindow.location.href;alert('恭喜您成为本站VIP,重新登陆后生效!');</script>", false);
                    }
                    else
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "isvip", "<script type='text/javascript'>alert('道具使用出错,请联系管理员。');window.location.href=window.location.href;</script>", false);
                    }
                }
                break;

            case 2:
                ClientScript.RegisterClientScriptBlock(this.GetType(), "isvip", "<script type='text/javascript'>alert('该道具不能直接使用,请在书本封面页点击<订阅连载>!');window.location.href=window.location.href;</script>", false);
                break;

            case 3:
                ClientScript.RegisterClientScriptBlock(this.GetType(), "isvip", "<script type='text/javascript'>alert('该道具不能直接使用,请在书本封面页点击<投书票>!');window.location.href=window.location.href;</script>", false);
                break;

            case 4:
                ClientScript.RegisterClientScriptBlock(this.GetType(), "isvip", "<script type='text/javascript'>alert('该道具不能直接使用,请在书本封面页点击<送鲜花>!');window.location.href=window.location.href;</script>", false);
                break;

            case 5:
                if (userList[0].UserType == 3 && userList[0].UserType != 5)
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "isvip", "<script type='text/javascript'>alert('您已经是本站作者了,不需要使用该道具!');window.location.href=window.location.href;</script>", false);
                }
                else if (isAuCheck > 0)
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "isvip", "<script type='text/javascript'>alert('已经提交过,不需要重复使用道具!');window.location.href=window.location.href;</script>", false);
                }
                else
                {
                    int count = iu.AuthorCard(userID);
                    if (count > 0)
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "isvip", "<script type='text/javascript'>alert('道具使用成功,请等待管理员审核!');window.location.href=window.location.href;</script>", false);
                    }
                    else
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "isvip", "<script type='text/javascript'>alert('道具使用失败,请联系管理员!');window.location.href=window.location.href;</script>", false);
                    }
                }
                break;

            default:
                ClientScript.RegisterClientScriptBlock(this.GetType(), "isvip", "<script type='text/javascript'>alert('该道具正在开发中!');window.location.href=window.location.href;</script>", false);
                break;
            }
        }
    }