private void Save_toDB() { ClassAuthor a = new ClassAuthor(); a.Name = textBox1.Text.Trim(); a.Lname = textBox2.Text.Trim(); a.Country = textBox3.Text.Trim(); a.Data_b = Convert.ToString(dateTimePicker1.Text); if (checkBox1.Checked) { a.Data_d = ""; } else { a.Data_d = Convert.ToString(dateTimePicker2.Text); } ListClassAuthor.Add(a); if (!checkBox1.Checked) { string q = @"INSERT INTO author (name_a, lname, country_a, Date_b, Date_d) VALUES ('" + a.Name + @"','" + a.Lname + @"','" + a.Country + @"','" + a.Data_b + @"','" + a.Data_d + @"');"; db.ExecuteNonQuery("library.db", q, 0); } else { string q = @"INSERT INTO author (name_a, lname, country_a, Date_b) VALUES ('" + a.Name + @"','" + a.Lname + @"','" + a.Country + @"','" + a.Data_b + @"');"; db.ExecuteNonQuery("library.db", q, 0); } dataGridView1.Rows.Clear(); Load_Data(); Show_Data(); add p = new add(); p.ListClassAuthor.Add(a); }
private void button4_Click(object sender, EventArgs e) { ClassPublish a = new ClassPublish(); a.Name = textBox1.Text.Trim(); a.Country = comboBox1.Text; ListClassPublish.Add(a); string q = @"INSERT INTO publisher(name_p,country_p) VALUES ('" + a.Name + @"','" + a.Country + @"');"; db.ExecuteNonQuery("library.db", q, 0); dataGridView1.Rows.Add(a.Name, a.Country); add p = new add(); p.ListclassPublish.Add(a); MessageBox.Show("Издательство добавлено!"); }
private void button4_Click(object sender, EventArgs e) { ClassGenre a = new ClassGenre(); a.Name = textBox1.Text.Trim(); a.Group = comboBox1.Text; ListclassGenre.Add(a); string q = @"INSERT INTO genre (name_g, groupp) VALUES ('" + a.Name + @"','" + a.Group + @"');"; db.ExecuteNonQuery("library.db", q, 0); dataGridView1.Rows.Add(a.Name, a.Group); add p = new add(); p.ListClassGenre.Add(a); MessageBox.Show("Жанр добавлен!"); }
private void button4_Click(object sender, EventArgs e) { ClassTopic p = new ClassTopic(); p.Name = textBox1.Text.Trim(); p.ID = 1; ListclassTopic.Add(p); string q = @"INSERT INTO topic (Name_t) VALUES ('" + p.Name + @"');"; db.ExecuteNonQuery("library.db", q, 0); listBox1.Items.Add(p.Name); add a = new add(); a.ListClassTopic.Add(p); MessageBox.Show("Тематика добавлена!"); }
private void button4_Click(object sender, EventArgs e) { add a = new add(); a.ShowDialog(); }