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


C# Profile.Books方法代码示例

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


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

示例1: btnUpdate_Click

    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        lblEMsg.Visible = false;
        string[] Book;
        Profile pro = new Profile();
        string Author_ID, Publisher_ID, Category_ID, Supplier_ID;
        try
        {
            if (lstbook.SelectedItem.Text == "")
            {
                lblEMsg.Text = "Please select Book ID";
                lblEMsg.Visible = true;
            }
            else
            {
                string sql;

                //Retrieve Author ID.
                sql = "SELECT Author_ID FROM Author WHERE Author_Name = '" + LstAuthor.SelectedItem.Text + "'";
                Author_ID = ReturnData(sql);

                //Retrieve Publisher ID.
                sql = "SELECT Publisher_ID FROM Publisher WHERE Publisher_Name = '" + LstPublisher.SelectedItem.Text + "'";
                Publisher_ID = ReturnData(sql);

                //Retrieve Category ID.
                sql = "SELECT Category_ID FROM Category WHERE Category_Name = '" + LstCategory.SelectedItem.Text + "'";
                Category_ID= ReturnData(sql);

                //Retrieve Supplier ID.
                sql = "SELECT Supplier_ID FROM Supplier WHERE Supplier_Name = '" + LstSupplier.SelectedItem.Text + "'";
                Supplier_ID= ReturnData(sql);

                Book = new string[15];

                Book[0] = lstbook.SelectedItem.Text;
                Book[1] = txtBTitle.Text;
                Book[2] = Author_ID;
                Book[3] = Publisher_ID;
                Book[4] = Category_ID;
                Book[5] = Supplier_ID;
                Book[6] = txtKey.Text;
                Book[7] = txtIsbn.Text;
                Book[8] = txtQuantity.Text;
                Book[9] = txtPrice.Text;
                if (chkStatus.Checked == true)
                {
                    Book[10] = "A";
                }
                else
                {
                    Book[10] = "D";
                }

                bool status;
                status = pro.Books(Book,"UpdateBook");

                if (status == false)
                {
                    lblEMsg.Visible = true;
                    lblEMsg.Text = "Book updation Failed";
                }
                lblEMsg.Visible = true;
                lblEMsg.Text = "Book updated.";

                ReadBook();
                lstbook.Text = "";
                txtBTitle.Text = "";
                LstAuthor.Text = "";
                LstCategory.Text = "";
                LstPublisher.Text = "";
                LstSupplier.Text = "";
                txtKey.Text = "";
                txtIsbn.Text = "";
                txtQuantity.Text = "";
                txtPrice.Text = "";
                chkStatus.Checked = false;
                lblEMsg.Visible = false;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
开发者ID:rwells,项目名称:LMS,代码行数:85,代码来源:EditBook.aspx.cs

示例2: btnAdd_Click

    protected void btnAdd_Click(object sender, EventArgs e)
    {
        lblEMsg.Visible = false;
        string[] Book;
        string Author_ID, Publisher_ID, Category_ID, Supplier_ID;
        try
        {
            string sql;
            SqlDataReader sdr;
            Profile pro = new Profile();

            //Retrieve Author ID.
            sql = "SELECT Author_ID FROM Author WHERE Author_Name = '" + LstAuthor.SelectedItem.Text + "'";
            sdr = pro.ReturnMDetails(sql);
            if (sdr.Read() == true)
            {
                Author_ID = sdr["Author_ID"].ToString().Trim();
            }
            else
            {
                Author_ID = "";
            }
            sdr.Close();

            //Retrieve Publisher ID.
            sql = "SELECT Publisher_ID FROM Publisher WHERE Publisher_Name = '" + LstPublisher.SelectedItem.Text + "'";
            sdr = pro.ReturnMDetails(sql);
            if (sdr.Read() == true)
            {
                Publisher_ID = sdr["Publisher_ID"].ToString().Trim();
            }
            else
            {
                Publisher_ID = "";
            }
            sdr.Close();

            //Retrieve Category ID.
            sql = "SELECT Category_ID FROM Category WHERE Category_Name = '" + LstCategory.SelectedItem.Text + "'";
            sdr = pro.ReturnMDetails(sql);
            if (sdr.Read() == true)
            {
                Category_ID = sdr["Category_ID"].ToString().Trim();
            }
            else
            {
                Category_ID = "";
            }
            sdr.Close();

            //Retrieve Supplier ID.
            sql = "SELECT Supplier_ID FROM Supplier WHERE Supplier_Name = '" + LstSupplier.SelectedItem.Text + "'";
            sdr = pro.ReturnMDetails(sql);
            if (sdr.Read() == true)
            {
                Supplier_ID = sdr["Supplier_ID"].ToString().Trim();
            }
            else
            {
                Supplier_ID= "";
            }
            sdr.Close();

            sql = "SELECT COUNT(*) FROM Book_Master WHERE Book_Title = '" + txtBTitle.Text + "' And Author_ID ='" + Author_ID + "' And Publisher_ID = '" + Publisher_ID + "' And Status = 'A'";
            sdr = pro.ReturnMDetails(sql);

            sdr.Read();
            int RegNo = (int)sdr[0];
            if (RegNo > 0)
            {
                lblEMsg.Text = "Book Name already exists.";
                lblEMsg.Visible = true;
                sdr.Close();
                return;
            }
            else
            {
                Book = new string[15];

                Book[0] = txtBook.Text;
                Book[1] = txtBTitle.Text;
                Book[2] = Author_ID;
                Book[3] = Publisher_ID;
                Book[4] = Category_ID;
                Book[5] = Supplier_ID;
                Book[6] = txtKey.Text;
                Book[7] = txtIsbn.Text;
                Book[8] = txtQuantity.Text;
                Book[9] = txtPrice.Text;
                if (chkStatus.Checked == true)
                {
                    Book[10] = "A";
                }
                else
                {
                    Book[10] = "I";
                }

                bool status;
                status = pro.Books(Book,"AddBook");
//.........这里部分代码省略.........
开发者ID:rwells,项目名称:LMS,代码行数:101,代码来源:AddBook.aspx.cs


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