Exemplo n.º 1
0
        private void DelButton_Click(object sender, System.EventArgs e)
        {
            IntercityCallModel model;
            var elements = reqester.GetReqest();

            foreach (IntercityCallModel element in elements)
            {
                if (
                    IntercityDataView.SelectedRows[0].Cells[1].Value.ToString() == element.Surname &&
                    IntercityDataView.SelectedRows[0].Cells[2].Value.ToString() == element.Phone &&
                    int.Parse(IntercityDataView.SelectedRows[0].Cells[5].Value.ToString()) == element.Duration
                    )
                {
                    model = new IntercityCallModel(element.ID);
                    reqester.DeleateReqest(model);
                    Console.WriteLine($"Deleated element in {element.ID} ID");
                }
                else
                {
                    Console.WriteLine($"{element.ID}" +
                                      $"{element.Phone}" +
                                      $"{element.Duration}" +
                                      $"{element.Surname}");
                    Console.WriteLine($"{IntercityDataView.SelectedRows[0].Cells[0].Value}" +
                                      $"{IntercityDataView.SelectedRows[0].Cells[1].Value}" +
                                      $"{IntercityDataView.SelectedRows[0].Cells[4].Value}");
                }
            }
            UpdateAllView();
        }
Exemplo n.º 2
0
 private void Deleate_Click(object sender, EventArgs e)
 {
     if (EventView.SelectedRows.Count == 1)
     {
         deleteDialog deleteDialog = new deleteDialog();
         if (deleteDialog.ShowDialog(this) == DialogResult.OK)
         {
             EventModel model = new EventModel((int)EventView.SelectedRows[0].Cells[0].Value);
             reqester.setDeleateRequest(new DeleateEvent());
             reqester.DeleateReqest(model);
             UpdateTable();
         }
     }
     else
     {
         MessageBox.Show("Выберите только 1 запись и повторите попытку", "Оказия!");
     }
 }