Example #1
0
        public MainMenu()
        {
            InitializeComponent();

            System.IO.StreamReader file = new System.IO.StreamReader("../../data/ksiazki.txt");
            string line;

            string[] tmp;
            while ((line = file.ReadLine()) != null)
            {
                tmp = line.Split('_');
                books.Add(new Ksiazka(Convert.ToInt32(tmp[0]), tmp[1], tmp[2], Convert.ToInt32(tmp[3])));
            }
            file.Close();

            file = new System.IO.StreamReader("../../data/klienci.txt");
            while ((line = file.ReadLine()) != null)
            {
                tmp = line.Split('_');
                clients.Add(new Uzytkownik(Convert.ToInt32(tmp[0]), tmp[1], tmp[2], Convert.ToInt32(tmp[3])));
            }
            file.Close();

            Uzytkownik x = new Uzytkownik();
            Ksiazka    y = new Ksiazka();

            file = new System.IO.StreamReader("../../data/wypozyczenia.txt");
            while ((line = file.ReadLine()) != null)
            {
                tmp = line.Split('_');
                for (int i = 0; i < clients.Count; i++)
                {
                    if (clients[i].indeks == Convert.ToInt32(tmp[1]))
                    {
                        x = clients[i];
                    }
                }
                for (int i = 0; i < books.Count; i++)
                {
                    if (books[i].indeks == Convert.ToInt32(tmp[2]))
                    {
                        y = books[i];
                    }
                }

                borrows.Add(new Wypozyczenie(Convert.ToInt32(tmp[0]), x, y));
            }
            file.Close();

            /*Wypozyczenie z=new Wypozyczenie();
             * file = new System.IO.StreamReader("../../data/kary.txt");
             * while ((line = file.ReadLine()) != null)
             * {
             *  tmp = line.Split('_');
             *  for (int i = 0; i < borrows.Count; i++)
             *      if (borrows[i].indeks == Convert.ToInt32(tmp[0])) z = borrows[i];
             *
             *   fines.Add(new Kara(z, Convert.ToDateTime(tmp[1]), Convert.ToDateTime(tmp[2]), Convert.ToDouble(tmp[3])));
             * }
             * file.Close();*/

            WindowStartupLocation   = System.Windows.WindowStartupLocation.CenterScreen;
            this.contentBox.Content = new MainMenuView();
        }
Example #2
0
 private void listView_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     Trace.WriteLine("Select");
     user  = (Uzytkownik)listView.SelectedItem;
     index = (int)listView.SelectedIndex;
 }
Example #3
0
 public Wypozyczenie(int id, Uzytkownik id_u, Ksiazka id_k)
 {
     indeks             = id;
     indeks_uzytkownika = id_u;
     indeks_ksiazki     = id_k;
 }