Example #1
0
        private void ButtonAdd_Click(object sender, EventArgs e)
        {
            FormEdit formEdit = new FormEdit();

            if (formEdit.ShowDialog() == DialogResult.OK)
            {
                MemoDAO dao = new MemoDAO(mCon.getConnection());

                mCon.Open();
                dao.insert(formEdit.memo);
                updateDataGrid(mCon);
                mCon.Close();
            }
        }
Example #2
0
        private void ButtonDelete_Click(object sender, EventArgs e)
        {
            int row = dataGridView1.CurrentCell.RowIndex;
            int mid = (int)dataGridView1[0, row].Value;

            if (DialogResult.Yes == MessageBox.Show("本当に削除してもいいですか?",
                                                    "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                MemoDAO dao = new MemoDAO(mCon.getConnection());

                mCon.Open();
                dao.delete(mid);
                updateDataGrid(mCon);
                mCon.Close();
            }
        }
Example #3
0
        private void currentEdit()
        {
            int row = dataGridView1.CurrentCell.RowIndex;
            int mid = (int)dataGridView1[0, row].Value;

            MemoDAO dao = new MemoDAO(mCon.getConnection());

            mCon.Open();
            Memo memo = dao.findById(mid);

            FormEdit formEdit = new FormEdit();

            formEdit.memo = memo;

            if (formEdit.ShowDialog() == DialogResult.OK)
            {
                dao.update(memo);
                updateDataGrid(mCon);
            }
            mCon.Close();
        }