コード例 #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Delete selected row?", "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (result == DialogResult.OK)
            {
                int             i  = dataGridView1.CurrentCell.RowIndex;
                DataGridViewRow dr = dataGridView1.Rows[i];
                Article         a  = new Article();
                a.ArticleName = dr.Cells[0].Value.ToString();
                ArticleDAO.Delete(a);
                DataView("select * from Articles");
            }
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Article a = new Article();

            a.ArticleName         = textBox1.Text;
            a.ArticleNumber       = textBox2.Text;
            a.Storage             = textBox3.Text;
            a.ShelfNumber         = textBox4.Text;
            a.BrandOfManufacturer = textBox5.Text;
            if (Action.Equals("add"))
            {
                ArticleDAO.Add(a);
                form1.DataView("select * from articles");
            }
            else if (Action.Equals("edit"))
            {
                ArticleDAO.Edit(a);
                form1.DataView("select * from articles");
                this.Close();
            }
        }