Beispiel #1
0
        private void btnDeleteClient_Click(object sender, EventArgs e)
        {
            if (int.TryParse(textBoxDeleteSubNum.Text, out int SubNumber) != false)
            {
                var ClientDeleted = clientlogic.Delete(SubNumber);
                if (ClientDeleted != null)
                {
                    var ClientGetDataBase = clientlogic.GetAll();
                    _gridClient(ClientGetDataBase);
                    CallBackForm callbackMessage = new CallBackForm();
                    callbackMessage.ErrorMessage = $"Клиент удален: {ClientDeleted.Id}|" +
                                                   $"{ClientDeleted.LastName}|" +
                                                   $"{ClientDeleted.FirstName}|" +
                                                   $"{ClientDeleted.SubscriptionNumber}|" +
                                                   $"{ClientDeleted.IDCoach}";

                    callbackMessage.Show();
                }
                else
                {
                    CallBackForm callbackMessage = new CallBackForm();
                    callbackMessage.ErrorMessage = "Такого клиента нет";
                    callbackMessage.Show();
                }
            }
        }
Beispiel #2
0
        private void buttonDel_Click(object sender, EventArgs e)
        {
            if (dataGridView.SelectedRows.Count == 1)
            {
                if (MessageBox.Show("Удалить запись", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

                {
                    int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
                    try
                    {
                        logic.Delete(new ClientBindingModel {
                            Id = id
                        });
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    LoadData();
                }
            }
        }
Beispiel #3
0
 public ActionResult Delete(int SubscriptionNumber)
 {
     _clientlogic.Delete(SubscriptionNumber);
     return(RedirectToAction("Index"));
 }