private void add_note(object sender, RoutedEventArgs e)
        {
            string title = note_sub.Text;
            string body  = note_body.Text;

            Baza.AddNote(title, body);

            note_sub.Text  = String.Empty;
            note_body.Text = String.Empty;

            note.Content = "Dodano notatkę";

            List <Note> note2 = new List <Note>();

            note2 = Baza.NoteList2();
            dataGrid4.ItemsSource = note2;
        }
        private void Edit_Note(object sender, RoutedEventArgs e)
        {
            var indexx = dataGrid4.Items.IndexOf(dataGrid4.CurrentItem);
            int omg    = indexx;

            string title = note_sub.Text;
            string body  = note_body.Text;

            Baza.EditNote(omg + 1, title, body);

            note_sub.Text  = String.Empty;
            note_body.Text = String.Empty;

            note.Content = "Zmieniono notatkę";

            List <Note> note2 = new List <Note>();

            note2 = Baza.NoteList2();
            dataGrid4.ItemsSource = note2;
        }
        public static void editNoteInterface(string tempstring)
        {
            Console.ForegroundColor = ConsoleColor.Green;

            Functions.createFrame(42, 3, 74, 19);


            Console.SetCursorPosition(48, 6);
            Console.Write(" Edytuj Notatke");

            Console.SetCursorPosition(49, 9);
            Console.WriteLine("  Nazwa notatki:");

            Console.SetCursorPosition(51, 10);
            string temat = Console.ReadLine();

            Console.SetCursorPosition(49, 14);
            Console.WriteLine("[Enter] - Potwierdź");

            Console.SetCursorPosition(49, 16);
            Console.WriteLine("  [Esc] - Odrzuć  ");

            Console.ResetColor();

            ConsoleKeyInfo key;

            key = Console.ReadKey();

            if (key.Key == ConsoleKey.Enter)
            {
                Baza.EditNote(editNumber, temat, tempstring);
                Functions.createNoteInterface();
            }

            if (key.Key == ConsoleKey.Escape)
            {
                Functions.createNoteInterface();
            }
        }
        public static void addNoteInterface(string notatka)
        {
            Console.ForegroundColor = ConsoleColor.Magenta;
            Functions.createFrame(42, 3, 74, 19);

            Console.ForegroundColor = ConsoleColor.Magenta;

            Console.SetCursorPosition(48, 6);
            Console.Write(" Dodaj Nową Notatke");

            Console.SetCursorPosition(49, 9);
            Console.WriteLine("  Nazwa notatki:");

            Console.SetCursorPosition(51, 10);
            string temat = Console.ReadLine();

            Console.SetCursorPosition(49, 14);
            Console.WriteLine("[Enter] - Potwierdź");

            Console.SetCursorPosition(49, 16);
            Console.WriteLine("  [Esc] - Odrzuć  ");

            Console.ResetColor();

            ConsoleKeyInfo key;

            key = Console.ReadKey();

            if (key.Key == ConsoleKey.Enter)
            {
                Baza.AddNote(temat, notatka);
                Functions.createNoteInterface();
            }

            if (key.Key == ConsoleKey.Escape)
            {
                Functions.createNoteInterface();
            }
        }
        private void add_address(object sender, RoutedEventArgs e)
        {
            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.AddAddress(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 dodany";

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

            adres = Baza.AddressList2();
            dataGrid5.ItemsSource = adres;
        }
        private void add_contact(object sender, RoutedEventArgs e)
        {
            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.AddContact(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 dodany";

            List <Contact> contact = new List <Contact>();

            contact = Baza.ContactList2();
            dataGrid.ItemsSource = contact;
        }
        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;
        }
        public static void appMovement(int FuncNumb)
        {
            ConsoleKeyInfo keypress;

            Console.SetCursorPosition(6, 6);

            int col = 6, row = 6;

            keypress = Console.ReadKey();

            while (keypress.Key != ConsoleKey.F9)
            {
                if (keypress.Key == ConsoleKey.RightArrow && col == 6)
                {
                    Console.SetCursorPosition(col += 15, row);
                }

                if (keypress.Key == ConsoleKey.RightArrow && col == 21)
                {
                    Console.SetCursorPosition(col, row);
                }


                if (keypress.Key == ConsoleKey.LeftArrow && col == 21)
                {
                    Console.SetCursorPosition(col -= 15, row);
                }

                if (keypress.Key == ConsoleKey.LeftArrow && col == 6)
                {
                    Console.SetCursorPosition(col, row);
                }


                if (keypress.Key == ConsoleKey.UpArrow && row != 6)
                {
                    Console.SetCursorPosition(col, row -= 4);
                }


                if (keypress.Key == ConsoleKey.UpArrow && row == 6)
                {
                    Console.SetCursorPosition(col, row);
                }


                if (keypress.Key == ConsoleKey.DownArrow)
                {
                    Console.SetCursorPosition(col, row += 4);
                }



                //Delete
                if (keypress.Key == ConsoleKey.Enter && col == 21)
                {
                    int todelete;
                    int numer = Console.CursorTop;

                    todelete = (numer - 2) / 4;

                    if (FuncNumb == 2)
                    {
                        Baza.DeleteContact(todelete); Functions.createContactInterface();
                    }
                    if (FuncNumb == 3)
                    {
                        Baza.DeleteMeet(todelete);    Functions.createMeetInterface();
                    }
                    if (FuncNumb == 4)
                    {
                        Baza.DeleteAddress(todelete); Functions.createAddressInterface();
                    }
                    if (FuncNumb == 5)
                    {
                        Baza.DeleteAlarms(todelete); Functions.createAlarmInterface();
                    }
                    if (FuncNumb == 6)
                    {
                        Baza.DeleteNotes(todelete); Functions.createNoteInterface();
                    }
                }


                //Edit
                if (keypress.Key == ConsoleKey.Enter && col == 6)
                {
                    int toedit;
                    int numer = Console.CursorTop;

                    toedit = (numer - 2) / 4;

                    if (FuncNumb == 2)
                    {
                        Functions.editContactInterface(toedit);
                    }
                    if (FuncNumb == 3)
                    {
                        editNumber = toedit;
                        DateTime data = DateTime.Now;
                        new Calendar(data, 4);
                    }
                    if (FuncNumb == 4)
                    {
                        Functions.editAddressInterface(toedit);
                    }
                    if (FuncNumb == 5)
                    {
                        Functions.setUpAlarm(toedit);
                    }
                    if (FuncNumb == 6)
                    {
                        editNumber = toedit; new Notes(DateTime.Now, 2);
                    }
                }



                //Start
                if (keypress.Key == ConsoleKey.F1)
                {
                    Functions.createStartInterface();
                }

                //Kontakty
                if (keypress.Key == ConsoleKey.F2)
                {
                    Functions.createContactInterface();
                }

                //Spotkania
                if (keypress.Key == ConsoleKey.F3)
                {
                    Functions.createMeetInterface();
                }

                //Adresy
                if (keypress.Key == ConsoleKey.F4)
                {
                    Functions.createAddressInterface();
                }

                //Alarmy
                if (keypress.Key == ConsoleKey.F5)
                {
                    Functions.createAlarmInterface();
                }

                //Notatki
                if (keypress.Key == ConsoleKey.F6)
                {
                    Functions.createNoteInterface();
                }


                //Add
                if (keypress.Key == ConsoleKey.F7)
                {
                    if (FuncNumb == 2)
                    {
                        Functions.addContactInterface();
                    }
                    if (FuncNumb == 3)
                    {
                        DateTime data = DateTime.Now;

                        new Calendar(data, 3);
                    }
                    if (FuncNumb == 4)
                    {
                        Functions.addAddressInterface();
                    }
                    if (FuncNumb == 5)
                    {
                        Functions.addAlarmInterface();
                    }
                    if (FuncNumb == 6)
                    {
                        new Notes(DateTime.Now, 1);
                    }
                }



                keypress = Console.ReadKey();
            }

            Environment.Exit(0);
        }
 public static void setUpAlarm(int id)
 {
     Baza.SetAlarm(id);
 }
예제 #10
0
        public static void editMeetInterface(DateTime data)
        {
            Console.ForegroundColor = ConsoleColor.Green;

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

            Console.SetCursorPosition(45, 6);
            Console.Write("Edytuj Spotkanie");

            string datash = data.ToShortDateString();


            Console.SetCursorPosition(32, 9);
            Console.Write("         Data:" + datash);


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

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

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

            Console.SetCursorPosition(32, 17);
            Console.Write("        Z kim:");


            Console.SetCursorPosition(46, 11);
            string godzinas = Console.ReadLine();
            int    godzina  = Int32.Parse(godzinas);

            data = data.AddHours(godzina);

            Console.SetCursorPosition(46, 13);
            string minutas = Console.ReadLine();
            int    minuta  = Int32.Parse(minutas);

            data = data.AddMinutes(minuta);

            Console.SetCursorPosition(46, 15);
            string miejsce = Console.ReadLine();

            Console.SetCursorPosition(46, 17);
            string osoba = 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.EditMeet(editNumber, data, osoba, miejsce);
                Functions.createMeetInterface();
            }

            if (key.Key == ConsoleKey.Escape)
            {
                Functions.createMeetInterface();
            }
        }
예제 #11
0
        public static void addAlarmInterface()
        {
            Console.ForegroundColor = ConsoleColor.Magenta;
            Functions.createFrame(46, 3, 74, 19);

            Console.SetCursorPosition(50, 6);
            Console.Write(" Dodaj Nowy Alarm");

            Console.SetCursorPosition(51, 8);
            Console.WriteLine("  Godzina:");

            Console.SetCursorPosition(51, 10);
            Console.WriteLine("    Minut:");

            Console.SetCursorPosition(51, 12);
            Console.WriteLine("    Nazwa:");

            Console.SetCursorPosition(61, 8);
            string godz = Console.ReadLine();
            int    hour = Int32.Parse(godz);

            Console.SetCursorPosition(61, 10);
            string min     = Console.ReadLine();
            int    minutes = Int32.Parse(min);

            Console.SetCursorPosition(61, 12);
            string temat = Console.ReadLine();

            Console.SetCursorPosition(51, 14);
            Console.WriteLine("[Enter] - Potwierdź");

            Console.SetCursorPosition(51, 16);
            Console.WriteLine("  [Esc] - Odrzuć  ");


            Console.ResetColor();

            ConsoleKeyInfo key;

            key = Console.ReadKey();

            if (key.Key == ConsoleKey.Enter)
            {
                DateTime data = new DateTime();
                data = DateTime.Today;

                data = data.AddHours(hour);
                data = data.AddMinutes(minutes);

                Baza.AddAlarm(data, temat);

                new Alarms(godz, min, "00");

                Functions.createAlarmInterface();
            }

            if (key.Key == ConsoleKey.Escape)
            {
                Functions.createAlarmInterface();
            }
        }
예제 #12
0
 public static void DeleteContact(int id)
 {
     Baza.DeleteContact(id);
 }