Beispiel #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            var frm = new FormEdit();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                var con = new HanbaiConnection();
                var dao = new ShouhinDAO(con);

                con.Open();
                dao.Insert(frm.shouhin);
                dao.Fill(dtShouhin);
                con.Close();
            }
        }
Beispiel #2
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            var con = new HanbaiConnection();
            var dao = new ShouhinDAO(con);

            con.Open();
            dao.Fill(dtShouhin);
            con.Close();

            dataGridView1.DataSource = dtShouhin;

            dataGridView1.Columns[0].Visible    = false;
            dataGridView1.Columns[1].HeaderText = "商品名";
            dataGridView1.Columns[2].HeaderText = "単価";
        }
Beispiel #3
0
        private void buttonDel_Click(object sender, EventArgs e)
        {
            Shouhin shouhin = GetCurrentShouhin();

            if (MessageBox.Show(shouhin.Sname + "を削除しますか?", "削除",
                                MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                var con = new HanbaiConnection();
                var dao = new ShouhinDAO(con);

                con.Open();
                dao.Delete(shouhin.Sid);
                dao.Fill(dtShouhin);
                con.Close();
            }
        }