예제 #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dgvUnit.SelectedRows.Count <= 0)
            {
                return;
            }

            DialogResult dr = MessageBox.Show("Are you sure ?", "Confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (dr != DialogResult.Yes)
            {
                return;
            }

            DAL.Unit unit = new DAL.Unit();
            unit.Id = Convert.ToInt32(dgvUnit.SelectedRows[0].Cells["colId"].Value);
            if (unit.delete())
            {
                MessageBox.Show("Data has been Deleted");
                btnSearch.PerformClick();
            }
            else
            {
                MessageBox.Show(unit.Error);
            }
        }
예제 #2
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     DAL.Unit un = new DAL.Unit();
     un.Search          = txtSearch.Text;
     dgvUnit.DataSource = un.select().Tables[0];
 }