Esempio n. 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmfrmCustomerCRUD frm = new frmfrmCustomerCRUD();

            frm.ShowDialog();
            GetData();
        }
Esempio n. 2
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex > -1 && e.RowIndex > -1)
            {
                DataGridViewRow  row  = dataGridView1.Rows[e.RowIndex];
                long             ID   = Convert.ToInt32(row.Cells["ID"].Value);
                DataGridViewCell cell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];

                if (cell.Value.Equals("刪除"))
                {
                    DialogResult result = MessageBox.Show("確認是否 刪除", "視窗", MessageBoxButtons.YesNo);

                    if (result == System.Windows.Forms.DialogResult.Yes)
                    {
                        service.Delete(ID);

                        GetData();
                    }
                }
                else if (cell.Value.Equals("編輯"))
                {
                    frmfrmCustomerCRUD frm = new frmfrmCustomerCRUD(ID);
                    frm.ShowDialog();

                    GetData();
                }
            }
        }