private void Edit_Address(object sender, RoutedEventArgs e)
        {
            var indexx = dataGrid5.Items.IndexOf(dataGrid5.CurrentItem);
            int omg    = indexx;


            string comp       = address_comp.Text;
            string town       = address_town.Text;
            string street     = address_street.Text;
            string phonstring = address_phon.Text;
            int    phon       = int.Parse(phonstring);

            Baza.EditAddress(omg + 1, comp, town, street, phon);

            address_comp.Text   = String.Empty;
            address_town.Text   = String.Empty;
            address_street.Text = String.Empty;
            address_phon.Text   = String.Empty;

            adres_lab.Content = "Adres zmieniony";

            List <Address> adres = new List <Address>();

            adres = Baza.AddressList2();
            dataGrid5.ItemsSource = adres;
        }
Ejemplo n.º 2
0
        public static void editAddressInterface(int id)
        {
            Console.ForegroundColor = ConsoleColor.Green;

            Functions.createFrame(30, 7, 80, 22);

            Console.SetCursorPosition(45, 9);
            Console.Write("Dodaj Nowy Adres");

            Console.SetCursorPosition(32, 11);
            Console.Write("     Podaj Nazwe:");

            Console.SetCursorPosition(32, 13);
            Console.Write("    Podaj Miasto:");

            Console.SetCursorPosition(32, 15);
            Console.Write("     Podaj Ulice:");

            Console.SetCursorPosition(32, 17);
            Console.Write("   Podaj telefon:");

            Console.SetCursorPosition(49, 11);
            string compName = Console.ReadLine();

            Console.SetCursorPosition(49, 13);
            string townName = Console.ReadLine();

            Console.SetCursorPosition(49, 15);
            string stName = Console.ReadLine();

            Console.SetCursorPosition(49, 17);
            string tel      = Console.ReadLine();
            int    compPhon = Int32.Parse(tel);

            Console.SetCursorPosition(35, 20);
            Console.WriteLine("[Enter] - Potwierdź    [Esc] - Odrzuć");
            Console.ResetColor();
            ConsoleKeyInfo key;

            key = Console.ReadKey();

            if (key.Key == ConsoleKey.Enter)
            {
                Baza.EditAddress(id, compName, townName, stName, compPhon);
                Functions.createAddressInterface();
            }

            if (key.Key == ConsoleKey.Escape)
            {
                Functions.createAddressInterface();
            }
        }