예제 #1
0
        private void ShowAllBook(string searchBook)
        {
            BookManager bookManager = new BookManager();

            BookGridView.DataSource = bookManager.GetAllBook(searchBook);
            BookGridView.DataBind();
        }
예제 #2
0
        private void returnbookbtn_Click(object sender, EventArgs e)
        {
            //Initiating SQL Connection:
            SqlConnection con1 = new SqlConnection();


            //ConnectionString:
            con1.ConnectionString = "data source = DESKTOP-QPUU33H;" +
                                    "database = Library;" +
                                    "integrated security = true";

            //Generating SQL Query
            string sql1 = "UPDATE Book SET BookQuantity = " + " '" + (int.Parse(showAvailable.Text) + 1) + "'" + "where BookId=" + int.Parse(showBookId.Text);

            using (SqlCommand cmd = new SqlCommand(sql1, con1))
            {
                //Opening the connection:
                con1.Open();

                cmd.Parameters.Add("BookId", SqlDbType.Int).Value = int.Parse(showBookId.Text);

                cmd.CommandType = CommandType.Text;
                cmd.ExecuteNonQuery();

                //Disconnect
                con1.Close();


                BookGridView.Rows.Clear();
                BookGridView.Refresh();
            }
        }
예제 #3
0
        private void Borrow_Click_1(object sender, EventArgs e)
        {
            //Initiating SQL Connection:
            SqlConnection con = new SqlConnection();

            //ConnectionString:
            con.ConnectionString = "data source = DESKTOP-QPUU33H;" +
                                   "database = Library;" +
                                   "integrated security = true";

            //Generating SQL Query
            string sql = "INSERT INTO TransactionReport(UserId,BookId) VALUES(@param1,@param2)";

            using (SqlCommand cmd = new SqlCommand(sql, con))
            {
                //Opening the connection:
                con.Open();

                cmd.Parameters.Add("@param1", SqlDbType.VarChar, 50).Value = viewId.Text.ToString();
                cmd.Parameters.Add("@param2", SqlDbType.Int).Value         = int.Parse(showBookId.Text);


                cmd.CommandType = CommandType.Text;
                cmd.ExecuteNonQuery();
                con.Close();
            }


            if ((int.Parse(showAvailable.Text)) != 0)
            {
                //Initiating SQL Connection:
                SqlConnection con1 = new SqlConnection();


                //ConnectionString:
                con1.ConnectionString = "data source = DESKTOP-QPUU33H;" +
                                        "database = Library;" +
                                        "integrated security = true";

                //Generating SQL Query
                string sql1 = "UPDATE Book SET BookQuantity = " + " '" + (int.Parse(showAvailable.Text) - 1) + "'" + "where BookId=" + int.Parse(showBookId.Text);
                using (SqlCommand cmd = new SqlCommand(sql1, con1))
                {
                    //Opening the connection:
                    con1.Open();

                    cmd.Parameters.Add("BookId", SqlDbType.Int).Value = int.Parse(showBookId.Text);

                    cmd.CommandType = CommandType.Text;
                    cmd.ExecuteNonQuery();

                    //Disconnect
                    con1.Close();


                    BookGridView.Rows.Clear();
                    BookGridView.Refresh();
                }
            }
        }
        public void FillData()
        {
            Web webObj = new Web();

            BookGridView.DataSource = webObj.DisplayBooks();
            BookGridView.DataBind();
        }
예제 #5
0
        /// <summary>
        /// Initialise the grid using the json data file
        /// </summary>
        private void InitialiseBookGridView()
        {
            IDataProvider dataProvider = new DataProvider();
            var           books        = dataProvider.GetBooks();

            Session[BooksSession]   = books;
            BookGridView.DataSource = books;
            BookGridView.DataBind();
        }
예제 #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         updateBtn.Enabled  = false;
         SaveButton.Enabled = true;
         List <BookModel> abookModels = GetAllStudent();
         BookGridView.DataSource = abookModels;
         BookGridView.DataBind();
     }
 }
예제 #7
0
        private void RefreshList()
        {
            int startPeriod = int.TryParse(filterStartPeriod.Text, out startPeriod)
                ? startPeriod
                : int.MinValue;

            int endPeriod = int.TryParse(filterEndPeriod.Text, out endPeriod)
                ? endPeriod
                : int.MaxValue;

            string author = String.IsNullOrWhiteSpace(filterAuthor.Text) ? string.Empty : filterAuthor.Text;

            bookDataSource.DataSource = DataServiceProvider.DataService.Query <Book>(b => b.Year <= endPeriod && b.Year >= startPeriod && b.Author.Contains(author)).Cast <Book>().ToList();
            BookGridView.Refresh();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         BookGridView.DataSource = new List <Book>
         {
             new Book {
                 Id = 1, Author = "One", Title = "One Hundred"
             },
             new Book {
                 Id = 2, Author = "Two", Title = "Two Hundreds"
             },
             new Book {
                 Id = 3, Author = "Three", Title = "Three Hundreds"
             },
         };
         BookGridView.DataBind();
     }
 }
예제 #9
0
 /// <summary>
 /// Bind the book grid to the session
 /// </summary>
 private void BindBookGridView()
 {
     BookGridView.DataSource = Session[BooksSession];
     BookGridView.DataBind();
 }
예제 #10
0
 private void BookGridView_Loaded(object sender, RoutedEventArgs e)
 {
     _bookScrollViewer              = BookGridView.GetScrollViewer();
     _bookScrollViewer.ViewChanged += BookScrollViewer_ViewChanged;
 }