Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Model;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Forme
- {
- public partial class Form1 : Form
- {
- int brojPokusaja = 3;
- public Form1()
- {
- InitializeComponent();
- txtPW.PasswordChar = '*';
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void btnUlogujSe_Click(object sender, EventArgs e)
- {
- string korIme = txtUsername.Text;
- string korPw = txtPW.Text;
- if (string.IsNullOrEmpty(korIme) || string.IsNullOrEmpty(korPw))
- {
- MessageBox.Show("Sine moras da popunis sva polja, de si poso'");
- return;
- }
- Korisnik korisnik = null;
- foreach (Korisnik k in Repozitorijum.VratiInstancu().Korisnici)
- {
- if (k.Username == korIme && k.Password == korPw)
- {
- korisnik = k;
- break;
- }
- else
- {
- }
- }
- if (korisnik != null)
- {
- Forma f = new Forma(korisnik);
- this.Hide();
- f.ShowDialog();
- }
- else
- {
- brojPokusaja--;
- MessageBox.Show("Ostalo je vam je jos " + brojPokusaja);
- txtUsername.Clear();
- txtPW.Clear();
- if(brojPokusaja <= 0)
- {
- txtPW.Enabled = false;
- txtUsername.Enabled = false;
- btnUlogujSe.Enabled = false;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement