예제 #1
0
        protected void issuebook(object sender, EventArgs e)
        {
            string username = Session["User"].ToString();
            int    bkid     = Int16.Parse(TextBox1.Text.ToString());

            if (bl.issueabook(username, bkid) == 1)
            {
                Response.Redirect("showissuesuccess.aspx");
            }
            else if (bl.issueabook(username, bkid) == 0)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "hwe", "showerror('You cannot issue more than 3 Books at the same time');", true);
            }
            else if (bl.issueabook(username, bkid) == -1)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "hwe", "showerror('You had already issued this Book');", true);
            }
            else if (bl.issueabook(username, bkid) == -2)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "hwe", "showerror('Bookid does not exist');", true);
            }
            else if (bl.issueabook(username, bkid) == -3)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "hwe", "showerror('Sorry,This Book is out of Stock');", true);
            }
        }
예제 #2
0
        protected void returnbook(object sender, EventArgs e)
        {
            string username = Session["User"].ToString();
            int    bkid     = Int16.Parse(TextBox1.Text.ToString());

            if (bl.ReturnBook(username, bkid) == 1)
            {
                Response.Redirect("showreturnsuccess.aspx");
            }
            else if (bl.ReturnBook(username, bkid) == 0)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "hwe", "showerror('You have not issued this book');", true);
            }
            else if (bl.issueabook(username, bkid) == -2)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "hwe", "showerror('Bookid does not exist');", true);
            }
        }