public void DelButton_Click(object sender, EventArgs e)
        {
            var t = accountDataGrid.CurrentRow?.DataBoundItem as Type;

            if (t == null)
            {
                return;
            }
            if (MessageBox.Show("Видалити обране поле?", "Видалення", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) ==
                DialogResult.OK)
            {
                try
                {
                    using (var repo = new TypeRepo())
                    {
                        repo.Delete(t);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                UpdateGrid();
            }
        }
Ejemplo n.º 2
0
        public void DeleteType(long typeId)
        {
            var unit_of_work = UnitOfWorkProvider.GetUnitOfWork();

            unit_of_work.BeginTransaction();
            TypeRepo.Delete(typeId);
            unit_of_work.Commit();

            _is_type_cache_valid = false;
        }