public static void editContactInterface(int id) { Console.ForegroundColor = ConsoleColor.Green; Functions.createFrame(30, 7, 80, 22); Console.SetCursorPosition(45, 9); Console.Write("Dodaj Nowy Kontakt"); Console.SetCursorPosition(32, 11); Console.Write(" Nazwisko:"); Console.SetCursorPosition(32, 13); Console.Write(" Imie:"); Console.SetCursorPosition(32, 15); Console.Write(" Nr Tel.:"); Console.SetCursorPosition(32, 17); Console.Write(" Mail:"); Console.SetCursorPosition(47, 11); string nazwisko = Console.ReadLine(); Console.SetCursorPosition(47, 13); string imie = Console.ReadLine(); Console.SetCursorPosition(47, 15); string tel = Console.ReadLine(); int telefon = Int32.Parse(tel); Console.SetCursorPosition(47, 17); string mail = Console.ReadLine(); Console.SetCursorPosition(35, 20); Console.WriteLine("[Enter] - Potwierdź [Esc] - Odrzuć"); Console.ResetColor(); ConsoleKeyInfo key; key = Console.ReadKey(); if (key.Key == ConsoleKey.Enter) { Baza.EditContact(id, imie, nazwisko, telefon, mail); Functions.createContactInterface(); } if (key.Key == ConsoleKey.Escape) { Functions.createContactInterface(); } }
private void Edit_Contact(object sender, RoutedEventArgs e) { var indexx = dataGrid.Items.IndexOf(dataGrid.CurrentItem); int omg = indexx; string fname = contact_fName.Text; string lname = contact_lName.Text; string phonstring = contact_phon.Text; int phon = int.Parse(phonstring); string mail = contact_mail.Text; Baza.EditContact(omg + 1, fname, lname, phon, mail); contact_fName.Text = String.Empty; contact_lName.Text = String.Empty; contact_mail.Text = String.Empty; contact_phon.Text = String.Empty; label.Content = "Kontakt zmieniony"; List <Contact> contact = new List <Contact>(); contact = Baza.ContactList2(); dataGrid.ItemsSource = contact; }