private void add_button_Click(object sender, EventArgs e)
 {
     if (valid())
     {
         if (Library_Methods.check_book(int.Parse(bookid_textbox.Text)))
         {
             Library_Entity le = new Library_Entity()
             {
                 bookid     = int.Parse(bookid_textbox.Text),
                 booknm     = booknm_TextBox.Text,
                 categoryid = int.Parse(select_category_comboBox.SelectedValue.ToString()),
                 authornm   = authornm_TextBox.Text,
                 publisernm = publisernm_TextBox.Text,
                 price      = int.Parse(price_numericUpDown.Value.ToString())
             };
             int flag = Library_Methods.Add_book(le);
             if (flag > 0)
             {
                 AlertBox.ShowDialog("Add Book Sucessfully", AlertBox.AlertType.success, true);
                 loadDatagridview();
             }
         }
         else
         {
             AlertBox.ShowDialog("Already Available BookID", AlertBox.AlertType.warning, true);
             bookid_textbox.Focus();
         }
     }
 }
示例#2
0
 public static void Add_category(Library_Entity le)
 {
     using (SqlConnection conn = new SqlConnection(Connection.getConnectionString()))
     {
         using (SqlCommand cmd = new SqlCommand())
         {
             conn.Open();
             cmd.CommandText = "Insert into BookCategory(Category_Name) values('" + le.category_name + "')";
             cmd.Connection  = conn;
             cmd.ExecuteNonQuery();
         }
     }
 }
示例#3
0
 public static int return_book(Library_Entity le)
 {
     using (SqlConnection con = new SqlConnection(Connection.getConnectionString()))
     {
         using (SqlCommand cmd = new SqlCommand("return_book", con))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@bookid", le.bookid);
             cmd.Parameters.AddWithValue("return_date", le.date);
             con.Open();
             return(cmd.ExecuteNonQuery());
         }
     }
 }
 private void add_button_Click(object sender, EventArgs e)
 {
     if (valid())
     {
         Library_Entity le = new Library_Entity()
         {
             grno   = int.Parse(grno_TextBox.Text),
             bookid = int.Parse(bookid_textbox.Text),
             date   = dateTimePicker2.Value
         };
         Library_Methods.borrow_book(le);
         AlertBox.ShowDialog("Added successfull.", AlertBox.AlertType.success, true);
         clear();
     }
 }
示例#5
0
 private void add_button_Click(object sender, EventArgs e)
 {
     if (category_TextBox.Text != "")
     {
         Library_Entity le = new Library_Entity()
         {
             category_name = category_TextBox.Text
         };
         Library_Methods.Add_category(le);
         AlertBox.ShowDialog("Category Add Successfully...", AlertBox.AlertType.success, true);
         Category_dataGridView.Columns.RemoveAt(Category_dataGridView.Columns.Count - 1);
         loadCategory();
     }
     else
     {
         AlertBox.ShowDialog("Please Enter Category...", AlertBox.AlertType.warning, true);
         category_TextBox.BackColor = Color.Pink;
     }
 }
示例#6
0
        public static int Add_book(Library_Entity le)
        {
            using (SqlConnection conn = new SqlConnection(Connection.getConnectionString()))
            {
                using (SqlCommand cmd = new SqlCommand("add_book", conn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.AddWithValue("@BookID", le.bookid);
                    cmd.Parameters.AddWithValue("@BookName", le.booknm);
                    cmd.Parameters.AddWithValue("@CategoryID", le.categoryid);
                    cmd.Parameters.AddWithValue("@AuthorName", le.authornm);
                    cmd.Parameters.AddWithValue("@PubliserName", le.publisernm);
                    cmd.Parameters.AddWithValue("@Price", le.price);

                    conn.Open();
                    return(cmd.ExecuteNonQuery());
                }
            }
        }
示例#7
0
 private void add_button_Click(object sender, EventArgs e)
 {
     if (valid())
     {
         Library_Entity le = new Library_Entity()
         {
             bookid = int.Parse(bookid_textbox.Text),
             date   = returnbook_datetimepicker.Value
         };
         int flag = Library_Methods.return_book(le);
         if (flag != null)
         {
             AlertBox.ShowDialog("Return Successfully...", AlertBox.AlertType.success, true);
             clear();
         }
         else
         {
             AlertBox.ShowDialog("Return Canceled...", AlertBox.AlertType.error, true);
         }
     }
 }