当前位置: 首页>>代码示例>>C#>>正文


C# Profile.IssueBook方法代码示例

本文整理汇总了C#中Profile.IssueBook方法的典型用法代码示例。如果您正苦于以下问题:C# Profile.IssueBook方法的具体用法?C# Profile.IssueBook怎么用?C# Profile.IssueBook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Profile的用法示例。


在下文中一共展示了Profile.IssueBook方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnIssue_Click

    protected void btnIssue_Click(object sender, EventArgs e)
    {
        lblEMsg.Visible = false;
        string[] iBook;
        try
        {
            SqlDataReader sdr;
            Profile pro = new Profile();

            int aQty = Convert.ToInt32(txtQuantity.Text.ToString());
            if (aQty == 0)
            {
                lblEMsg.Visible = true;
                lblEMsg.Text = "This book is Out of stock, please select a different book.";
                return;
            }

            string sql = "SELECT Count(1) FROM Book_Transaction WHERE Book_ID = '" + LstBook.SelectedItem.Text + "' And Member_ID = '" + DropDownList1.SelectedItem.Text  + "' And Actual_Return_Date Is Null";
            sdr = pro.ReturnMDetails(sql);
            sdr.Read();
            int iB = (int)sdr[0];
            if (iB > 0)
            {
                lblEMsg.Visible = true;
                lblEMsg.Text = "This book is already issued, please select a different book.";
                return;
            }
            sdr.Close();

            //Insert the data.
            iBook = new string[4];

            iBook[0] = LstBook.SelectedItem.Text;
            iBook[1] = DropDownList1.SelectedItem.Text;
            iBook[2] = txtIDate.Text;
            iBook[3] = txtRDate.Text;

            bool status;
            status = pro.IssueBook(iBook);

            if (status == false)
            {
                lblEMsg.Visible = true;
                lblEMsg.Text = "Book Issuing Failed";
            }
            lblEMsg.Visible = true;
            lblEMsg.Text = "Book Issued.";
            DropDownList1.Text = "";
            LstBook.Text = "";
            txtBTitle.Text = "";
            txtAuthor.Text = "";
            txtPub.Text = "";
            txtCat.Text = "";
            txtSup.Text = "";
            txtQuantity.Text = "";
            txtPrice.Text = "";
            txtRDate.Text = "";
            Label9.Text = "";
            return;
        }
        catch (Exception ex)
        {
            lblEMsg.Visible = true;
            lblEMsg.Text = ex.Message;
        }
    }
开发者ID:rwells,项目名称:LMS,代码行数:66,代码来源:IssueBook.aspx.cs


注:本文中的Profile.IssueBook方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。