private void btn_delete_documentary_Click(object sender, EventArgs e) { sql = $"delete from \"Documentary\" where digital_id = {FunctionsClass.GetColumnStr(dgv_documentary, "digital_id")}"; using var cmd = new NpgsqlCommand(sql, connection); cmd.ExecuteNonQuery(); FunctionsClass.SelectData(selectDoc, dgv_documentary, connection); }
private void btn_delete_access_Click(object sender, EventArgs e) { sql = sql = $"delete from \"Exclusive_Access\" where access_id = {FunctionsClass.GetColumnStr(dgv_access, "access_id")}"; using var cmd = new NpgsqlCommand(sql, connection); cmd.ExecuteNonQuery(); FunctionsClass.SelectData(selectStr, dgv_access, connection); }
private void btn_add_course_Click(object sender, EventArgs e) { string[] values = new string[6]; string[] prmNames = new string[] { "section_id", "title", "URL", "tutor", "video_count", "field" }; var prmNamesC = String.Join(",", prmNames); for (int i = 0; i < 6; i++) { values[i] = FunctionsClass.GetColumnStr(dgv_course, prmNames[i]); } //sql = $"insert into \"Digital_Material\" ({prmNames[0]}, {prmNames[1]}, \"{prmNames[2]}\") values ('{values[0]}','{values[1]}','{values[2]}'; insert into \"Documentary\" (digital_id, {prmNames[3]}, {prmNames[4]}, {prmNames[5]})" + // $"values ({values[3]},'{values[4]}','{values[5]}')"; sql = $"select* from course_add({values[0]},'{values[1]}','{values[2]}','{values[3]}','{values[4]}','{values[5]}')"; try { using var cmd = new NpgsqlCommand(sql, connection); cmd.ExecuteNonQuery(); FunctionsClass.SelectData(selectCourse, dgv_course, connection); } catch (Exception exc) { MessageBox.Show(exc.Message); } FunctionsClass.SelectData(selectCourse, dgv_course, connection); }
private void btn_add_documentary_Click(object sender, EventArgs e) { //string title = FunctionsClass.GetColumnStr(dgv_books, "title"); //string edition = FunctionsClass.GetColumnStr(dgv_books, "edition"); //string category = FunctionsClass.GetColumnStr(dgv_books, "category"); string[] values = new string[6]; string[] prmNames = new string[] { "section_id", "title", "URL", "director", "duration", "subject" }; var prmNamesC = String.Join(",", prmNames); for (int i = 0; i < 6; i++) { values[i] = FunctionsClass.GetColumnStr(dgv_documentary, prmNames[i]); } //sql = $"insert into \"Digital_Material\" ({prmNames[0]}, {prmNames[1]}, \"{prmNames[2]}\") values ('{values[0]}','{values[1]}','{values[2]}'; insert into \"Documentary\" (digital_id, {prmNames[3]}, {prmNames[4]}, {prmNames[5]})" + // $"values ({values[3]},'{values[4]}','{values[5]}')"; sql = $"select* from documentary_add({values[0]},'{values[1]}','{values[2]}','{values[3]}','{values[4]}','{values[5]}')"; try { using var cmd = new NpgsqlCommand(sql, connection); cmd.ExecuteNonQuery(); FunctionsClass.SelectData(selectDoc, dgv_documentary, connection); } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void button1_Click(object sender, EventArgs e) { var values = new string[] { FunctionsClass.GetColumnStr(dgv_staff, "contact_id"), FunctionsClass.GetColumnStr(dgv_staff, "section_id"), FunctionsClass.GetColumnStr(dgv_staff, "login_id"), FunctionsClass.GetColumnStr(dgv_staff, "first_name"), FunctionsClass.GetColumnStr(dgv_staff, "last_name"), FunctionsClass.GetColumnStr(dgv_staff, "job_description"), FunctionsClass.GetColumnStr(dgv_staff, "salary") }; //insert into "Staff"(contact_id, section_id, login_id, first_name, last_name, job_description, salary) values(3, 46, 3, 'ali', 'veli', 'ogretim', 3000) sql = $"insert into \"Staff\"(contact_id, section_id, login_id, first_name, last_name, job_description, salary) values({values[0]}, {values[1]}, {values[2]}, '{values[3]}', '{values[4]}', '{values[5]}', {values[6]})"; using var cmd = new NpgsqlCommand(sql, connection); try { cmd.ExecuteNonQuery(); FunctionsClass.SelectData(select, dgv_staff, connection); } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void button2_Click(object sender, EventArgs e) { sql = $"insert into \"Book_Copy\" (book_id) values ({textbox_bookid.Text})"; using var cmd = new NpgsqlCommand(sql, connection); cmd.ExecuteNonQuery(); FunctionsClass.SelectData(selectC, dgv_copies, connection); }
private void btn_delete_auth_Click(object sender, EventArgs e) { sql = $"delete from \"Authentication_Info\" where login_id = {FunctionsClass.GetColumnStr(dgv_auth, "login_id")}"; using var cmd = new NpgsqlCommand(sql, connection); cmd.ExecuteNonQuery(); FunctionsClass.SelectData(selectStr, dgv_auth, connection); }
private void btn_add_book_Click(object sender, EventArgs e) { int author_id = Convert.ToInt32(FunctionsClass.GetColumnStr(dgv_books, "author_id")); int section_id = Convert.ToInt32(FunctionsClass.GetColumnStr(dgv_books, "section_id")); int publisher_id = Convert.ToInt32(FunctionsClass.GetColumnStr(dgv_books, "publisher_id")); int page_count = Convert.ToInt32(FunctionsClass.GetColumnStr(dgv_books, "page_count")); int price = Convert.ToInt32(FunctionsClass.GetColumnStr(dgv_books, "price")); string title = FunctionsClass.GetColumnStr(dgv_books, "title"); string edition = FunctionsClass.GetColumnStr(dgv_books, "edition"); string category = FunctionsClass.GetColumnStr(dgv_books, "category"); sql = $"insert into \"Book\" (author_id,section_id,publisher_id,page_count,price,title,edition,category)" + $" values({author_id}, {section_id}, {publisher_id}, {page_count}, {price}, '{title}', '{edition}', '{category}' ); "; using var cmd = new NpgsqlCommand(sql, connection); try { cmd.ExecuteNonQuery(); } catch (Exception exc) { MessageBox.Show(exc.Message); } FunctionsClass.SelectData(select_book, dgv_books, connection); }
private void button1_Click(object sender, EventArgs e) { sql = $"insert into \"Borrow_Info\" (member_id, copy_id) values ({textBox2.Text}, {textBox1.Text})"; using var cmd = new NpgsqlCommand(sql, connection); cmd.ExecuteNonQuery(); FunctionsClass.SelectData(selectBorrow, dgv_borrow, connection); }
private void btn_delete_contact_Click(object sender, EventArgs e) { sql = @"select * from contact_delete(:_id)"; using var cmd = new NpgsqlCommand(sql, connection); cmd.Parameters.AddWithValue("_id", Convert.ToInt32(FunctionsClass.GetColumnStr(dgv_contacts, "contact_id"))); cmd.ExecuteNonQuery(); FunctionsClass.SelectData(sql, dgv_contacts, connection); }
private void Form_Book_Load(object sender, EventArgs e) { connection.Open(); // show books authors and publishers FunctionsClass.SelectData(select_book, dgv_books, connection); FunctionsClass.SelectData(select_author, dgv_authors, connection); FunctionsClass.SelectData(select_publisher, dgv_publishers, connection); }
private void Form_Borrow_Load(object sender, EventArgs e) { connection.Open(); FunctionsClass.SelectData(selectB, dgv_book, connection); FunctionsClass.SelectData(selectM, dgv_memb, connection); FunctionsClass.SelectData(selectC, dgv_copies, connection); FunctionsClass.SelectData(selectBorrow, dgv_borrow, connection); }
private void btn_delete_author_Click(object sender, EventArgs e) { sql = @"select * from author_delete(:_id)"; using var cmd = new NpgsqlCommand(sql, connection); //var rowIndex = dgv_authors.CurrentCell.RowIndex; cmd.Parameters.AddWithValue("_id", Convert.ToInt32(FunctionsClass.GetColumnStr(dgv_authors, "author_id"))); cmd.ExecuteNonQuery(); FunctionsClass.SelectData(select_author, dgv_authors, connection); }
private void button2_Click(object sender, EventArgs e) { sql = $"delete from \"Staff\" where staff_id = {FunctionsClass.GetColumnStr(dgv_staff, "staff_id")}"; using var cmd = new NpgsqlCommand(sql, connection); //var rowIndex = dgv_authors.CurrentCell.RowIndex; //cmd.Parameters.AddWithValue("_id", Convert.ToInt32()); cmd.ExecuteNonQuery(); FunctionsClass.SelectData(select, dgv_staff, connection); }
private void btn_add_publisher_Click(object sender, EventArgs e) { sql = @"select * from publisher_insert(:_contact_id, :_name)"; using var cmd = new NpgsqlCommand(sql, connection); cmd.Parameters.AddWithValue("_contact_id", Convert.ToInt32(FunctionsClass.GetColumnStr(dgv_publishers, "contact_id"))); cmd.Parameters.AddWithValue("_name", FunctionsClass.GetColumnStr(dgv_publishers, "name")); cmd.ExecuteNonQuery(); FunctionsClass.SelectData(select_publisher, dgv_publishers, connection); }
private void btn_add_access_Click(object sender, EventArgs e) { var login_id = FunctionsClass.GetColumnStr(dgv_access, "login_id"); var book_id = FunctionsClass.GetColumnStr(dgv_access, "book_id"); sql = $"insert into \"Exclusive_Access\" (login_id, book_id) values ({login_id}, {book_id})"; using var cmd = new NpgsqlCommand(sql, connection); cmd.ExecuteNonQuery(); FunctionsClass.SelectData(selectStr, dgv_access, connection); }
private void btn_add_author_Click(object sender, EventArgs e) { sql = @"select * from author_insert(:_name, :_surname);"; using var cmd = new NpgsqlCommand(sql, connection); //var rowIndex = dgv_authors.CurrentCell.RowIndex; cmd.Parameters.AddWithValue("_name", FunctionsClass.GetColumnStr(dgv_authors, "first_name")); cmd.Parameters.AddWithValue("_surname", FunctionsClass.GetColumnStr(dgv_authors, "last_name")); cmd.ExecuteNonQuery(); FunctionsClass.SelectData(select_author, dgv_authors, connection); }
private void btn_add_section_Click(object sender, EventArgs e) { try { sql = @"select * from section_insert(:_name)"; using var cmd = new NpgsqlCommand(sql, connection); cmd.Parameters.AddWithValue("_name", dgv_sections.CurrentCell.Value.ToString()); cmd.ExecuteNonQuery(); FunctionsClass.SelectData(selectStr, dgv_sections, connection); } catch (Exception ex) { MessageBox.Show("Hata: " + ex); } }
private void btn_add_auth_Click(object sender, EventArgs e) { var passwd = FunctionsClass.GetColumnStr(dgv_auth, "password"); sql = $"insert into \"Authentication_Info\"(password) values('{passwd}')"; using var cmd = new NpgsqlCommand(sql, connection); try { cmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.Message); } FunctionsClass.SelectData(selectStr, dgv_auth, connection); }
//string selectmem = @"select * from ""Member"""; //string selectmem = @"select * from ""Member"""; private void RefreshTables() { FunctionsClass.SelectData(selectMem, dgv_members, connection); FunctionsClass.SelectData(selectAc, dgv_academicians, connection); FunctionsClass.SelectData(selectGov, dgv_gov, connection); }
private void Form_Contacts_Load(object sender, EventArgs e) { // select only contacts that belong to the owner. connection.Open(); FunctionsClass.SelectData(selectStr, dgv_contacts, connection); }
private void Form_Digital_Load(object sender, EventArgs e) { connection.Open(); FunctionsClass.SelectData(selectDoc, dgv_documentary, connection); FunctionsClass.SelectData(selectCourse, dgv_course, connection); }
private void Form_Staff_Load(object sender, EventArgs e) { connection.Open(); FunctionsClass.SelectData(select, dgv_staff, connection); }
private void Form_Access_Load(object sender, EventArgs e) { connection.Open(); FunctionsClass.SelectData(selectStr, dgv_access, connection); }