private async void dgvPlace_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (listPlace.Count() != 0)
            {
                if (dgvPlace.Columns[e.ColumnIndex].HeaderText == "Edit")
                {
                    placeID   = int.Parse(dgvPlace.CurrentRow.Cells[2].Value.ToString());
                    EditPlace = true;

                    frmAddPlace fap = new frmAddPlace();
                    fap.ShowDialog();
                }

                if (dgvPlace.Columns[e.ColumnIndex].HeaderText == "Delete")
                {
                    placeID = int.Parse(dgvPlace.CurrentRow.Cells[2].Value.ToString());
                    Place place = await repository.GetPlaceByIdAsync(placeID);

                    DialogResult dr = MessageBox.Show("Are you sure to delete " + place.PlaceOfOrigin + " from list?", "Warning!", MessageBoxButtons.YesNo);
                    if (dr == DialogResult.Yes)
                    {
                        await repository.DeletePlaceAsync(placeID);

                        MessageBox.Show("Delete Successfull!", "Success!");
                        await LoadPlace();
                    }
                }
            }
        }
        private void btnPlace_Click(object sender, EventArgs e)
        {
            addFrom = "Setting";
            frmAddPlace fap = new frmAddPlace();

            fap.ShowDialog();
        }
Exemple #3
0
        private void btnAddPlace_Click(object sender, EventArgs e)
        {
            frmSettings.addFrom = "Checklist";
            frmAddPlace fap = new frmAddPlace();

            fap.ShowDialog();
        }