Esempio n. 1
0
        public edycja()
        {
            InitializeComponent();
            line_email.Hide();
            line_haslo.Hide();
            line_login.Hide();
            button2.Hide();
            label2.Hide();
            label3.Hide();
            label4.Hide();
            label5.Hide();
            radioButton1.Hide();
            radioButton2.Hide();
            radioButton3.Hide();
            x        = 0;
            znane    = 0;
            istnieje = false;
            typ      = "default";
            FileStream   lic  = new FileStream(@"uzytkownicy.txt", FileMode.Open, FileAccess.Read);
            StreamReader licz = new StreamReader(lic);

            while (licz.ReadLine() != null)
            {
                x++;
            }
            lic.Close();
            lic.Dispose();
            konto = new konta[x];
            for (int i = 0; i < x; i++)
            {
                konto[i] = new konta();
            }
        }
Esempio n. 2
0
 public office()
 {
     InitializeComponent();
     konto     = new konta();
     istnieje  = false;
     x         = 0;
     konto.typ = "default";
 }
Esempio n. 3
0
        public usuwanie()
        {
            InitializeComponent();
            exist = false;
            FileStream   lic  = new FileStream(@"uzytkownicy.txt", FileMode.Open, FileAccess.Read);
            StreamReader licz = new StreamReader(lic);

            while (licz.ReadLine() != null)
            {
                x++;
            }
            lic.Close();
            lic.Dispose();
            konto = new konta[x];
            for (int i = 0; i < x; i++)
            {
                konto[i] = new konta();
            }
        }
Esempio n. 4
0
        public zarządzanie(string login)
        {
            InitializeComponent();
            Login  = login;
            x      = 0;
            y      = 0;
            nn     = 0;
            zmiana = false;
            log    = false;
            wolny  = true;
            FileStream   lic  = new FileStream(@"uzytkownicy.txt", FileMode.Open, FileAccess.Read);
            StreamReader licz = new StreamReader(lic);

            while (licz.ReadLine() != null)
            {
                x++;
            }
            lic.Close();
            lic.Dispose();
            FileStream   li    = new FileStream(@"rents.txt", FileMode.Open, FileAccess.Read);
            StreamReader licze = new StreamReader(li);

            while (licze.ReadLine() != null)
            {
                y++;
            }
            li.Close();
            li.Dispose();
            konto = new konta[x];
            for (int i = 0; i < x; i++)
            {
                konto[i] = new konta();
            }
            wyp = new wypozyczenie[y];
            for (int i = 0; i < y; i++)
            {
                wyp[i] = new wypozyczenie();
            }
        }
Esempio n. 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            int    x = 0;
            String password, loign;
            string linia;

            string[] slowa;
            slowa    = new string[6];
            password = haslo.Text;
            loign    = login.Text;
            bool         zalogowano = false;
            konta        konto      = new konta();
            FileStream   lic        = new FileStream(Path, FileMode.Open, FileAccess.Read);
            StreamReader licz       = new StreamReader(lic);

            while (licz.ReadLine() != null)
            {
                x++;
            }

            FileStream   pl   = new FileStream(Path, FileMode.Open, FileAccess.Read);
            StreamReader file = new StreamReader(pl);

            for (int i = 0; i < x; i++)
            {
                linia = file.ReadLine();

                slowa = linia.Split(' ');
                if (slowa[0] == loign && slowa[1] == password)
                {
                    zalogowano = true;
                    konto.typ  = slowa[2];
                    if (konto.typ == "admin")
                    {
                        licz.Close();
                        file.Close();
                        pl.Dispose();
                        lic.Dispose();
                        lic.Close();
                        pl.Close();
                        this.Hide();
                        admin panel = new admin();
                        panel.ShowDialog();
                        break;
                    }
                    if (konto.typ == "user")
                    {
                        licz.Close();
                        file.Close();
                        pl.Dispose();
                        lic.Dispose();
                        lic.Close();
                        pl.Close();
                        this.Hide();
                        user menu = new user(loign);
                        menu.ShowDialog();
                        break;
                    }
                    if (konto.typ == "staff")
                    {
                        licz.Close();
                        file.Close();
                        pl.Dispose();
                        lic.Dispose();
                        lic.Close();
                        pl.Close();
                        this.Hide();
                        staff obsluga = new staff();
                        obsluga.ShowDialog();
                        break;
                    }
                    if (konto.typ == "office")
                    {
                        licz.Close();
                        file.Close();
                        pl.Dispose();
                        lic.Dispose();
                        lic.Close();
                        pl.Close();
                        this.Hide();
                        office biuro = new office();
                        biuro.ShowDialog();
                        break;
                    }
                }
                else
                {
                    continue;
                }
            }
            if (zalogowano == false)
            {
                MessageBox.Show("Nie udało się zalogować", "Błąd");
            }
        }