internal void Login(TextBox txtUsername, TextBox txtPassword, FrmLogin frmLogin)
 {
     if (!UserControlHelpers.EmptyFieldValidation(txtUsername)
         | !UserControlHelpers.EmptyFieldValidation(txtPassword))
     {
         return;
     }
     try
     {
         Zaposleni z = new Zaposleni
         {
             KorisnickoIme = txtUsername.Text, Sifra = txtPassword.Text
         };
         z = Communication.Communication.Instance.Login(z);
         if (z != null)
         {
             MainCoordinator.Instance.Zaposleni = z;
             MessageBox.Show($"Korisnik {z.ImePrezime} se uspesno prijavio!");
             MainCoordinator.Instance.OpenMainForm();
             frmLogin.Dispose();
         }
         else
         {
             MessageBox.Show("Ne postoji ovakav korisnik");
         }
     }
     catch (SystemOperationsException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            FrmLogin frm = new FrmLogin();

            //MessageBox.Show(frm.DialogResult.ToString()+"    aaaa"); none
            if (frm.ShowDialog() == DialogResult.Yes)
            {
                frm.Dispose();
                Application.Run(new FrmMain());
            }
        }
 internal void Login(TextBox txtKorisnickoIme, TextBox txtLozinka, FrmLogin frmLogin)
 {
     if (!UserControlHelpers.EmptyFieldValidation(txtKorisnickoIme) | !UserControlHelpers.EmptyFieldValidation(txtLozinka))
     {
         return;
     }
     try
     {
         Zaposleni z = Communication.Communication.Instance.Login(txtKorisnickoIme.Text, txtLozinka.Text);
         MainCoordinator.Instance.Zaposleni = z;
         MessageBox.Show($"Zaposleni: {z.Ime} {z.Prezime} se ulogovao");
         MainCoordinator.Instance.OpenMainForm();
         frmLogin.Dispose();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 4
0
 internal void Login(TextBox txtUsername, TextBox txtPassword, FrmLogin frmLogin)
 {
     if (!UserControlHelpers.
         EmptyFieldValidation(txtUsername)
         | !UserControlHelpers.EmptyFieldValidation(txtPassword))
     {
         MessageBox.Show("Oba polja su obavezna!");
         return;
     }
     try
     {
         User k = Communication.Communication.Instance.Login(txtUsername.Text, txtPassword.Text);
         MainCoordinator.Instance.User = k;
         MessageBox.Show($"Korisnik {k.FirstName} {k.LastName} se uspesno prijavio!");
         MainCoordinator.Instance.OpenMainForm();
         frmLogin.Dispose();
     }
     catch (SystemOperationException)
     {
         MessageBox.Show("Sistem ne može da prepozna radnika!");
     }
 }