Exemple #1
0
 private void lblOdjaviSe_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     FormIzbor frm = new FormIzbor();
     frm.MdiParent = this.ParentForm;
     frm.Show();
     frm.Dock = DockStyle.Fill;
     Close();
 }
Exemple #2
0
        private void GlavnaForma_Load(object sender, EventArgs e)
        {
            Width  = 900;
            Height = 600;
            FormIzbor frm = new FormIzbor();

            frm.MdiParent = this;
            frm.Show();
            frm.Dock = DockStyle.Fill;
        }
        private void lblOdjaviSe_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Globalne.AdminPraviKupca = false;
            Globalne.PraviAdmina     = false;
            FormIzbor frm = new FormIzbor();

            frm.MdiParent = this.ParentForm;
            frm.Show();
            frm.Dock = DockStyle.Fill;
            Close();
        }
 private void btnNazad_Click(object sender, EventArgs e)
 {
     if (Globalne.PraviAdmina || Globalne.AdminPraviKupca)
     {
         Globalne.PraviAdmina     = false;
         Globalne.AdminPraviKupca = false;
         FormAdmin frm = new FormAdmin();
         frm.MdiParent = this.ParentForm;
         frm.Show();
         frm.Dock = DockStyle.Fill;
         Close();
     }
     else
     {
         FormIzbor frm = new FormIzbor();
         frm.MdiParent = this.ParentForm;
         frm.Show();
         frm.Dock = DockStyle.Fill;
         Close();
     }
 }
        private void btnKreiraj_Click(object sender, EventArgs e)
        {
            string pogresanUnos = "";
            int    flag         = 0;

            if (txtIme.Text.Trim() == "")
            {
                pogresanUnos += "Morate uneti ime!" + Environment.NewLine;
                flag          = 1;
            }
            if (txtPrezime.Text.Trim() == "")
            {
                pogresanUnos += "Morate uneti prezime!" + Environment.NewLine;
                flag          = 1;
            }
            if (!txtJmbg.Text.All(char.IsDigit) || txtJmbg.Text.Trim() == "")
            {
                pogresanUnos += "Morate uneti ispravan JMBG!" + Environment.NewLine;
                flag          = 1;
            }
            if (!txtTelefon.Text.All(char.IsDigit) || txtTelefon.Text.Trim() == "")
            {
                pogresanUnos += "Morate uneti ispravan telefon!" + Environment.NewLine;
                flag          = 1;
            }
            if (Globalne.PraviAdmina)
            {
                List <Administrator> administrators = new List <Administrator>();
                administrators = Globalne.procitajAdmine(Globalne.DatAdmin);
                foreach (Administrator a in administrators)
                {
                    if (a.Telefon == txtTelefon.Text)
                    {
                        pogresanUnos += "Uneti telefon vec postoji!" + Environment.NewLine;
                        flag          = 1;
                    }
                }
            }
            else
            {
                List <Kupac> kupci = new List <Kupac>();
                kupci = Globalne.procitajKupce(Globalne.DatKupac);
                foreach (Kupac k in kupci)
                {
                    if (k.Telefon == txtTelefon.Text)
                    {
                        pogresanUnos += "Uneti telefon vec postoji!" + Environment.NewLine;
                        flag          = 1;
                    }
                }
            }
            if (txtLozinka.Text.Trim() == "")
            {
                pogresanUnos += "Morate uneti lozinku!" + Environment.NewLine;
                flag          = 1;
            }
            if (flag == 1)
            {
                MessageBox.Show(pogresanUnos, "Pogresan unos podataka!");
            }
            else
            {
                if (Globalne.PraviAdmina)
                {
                    Administrator noviAdmin = new Administrator(txtIme.Text, txtPrezime.Text, txtJmbg.Text, dateDatumRodjenja.Value, txtTelefon.Text, txtLozinka.Text);
                    noviAdmin.upisiAdmina(Globalne.DatAdmin);
                    MessageBox.Show(txtIme.Text + " " + txtPrezime.Text + " je uspesno dodat kao administrator!", "Uspesno dodat novi administrator");
                    Globalne.PraviAdmina = false;
                    FormAdmin frm = new FormAdmin();
                    frm.MdiParent = this.ParentForm;
                    frm.Show();
                    frm.Dock = DockStyle.Fill;
                    Close();
                }
                else
                {
                    Kupac noviKupac = new Kupac(txtIme.Text, txtPrezime.Text, txtJmbg.Text, dateDatumRodjenja.Value, txtTelefon.Text, txtLozinka.Text);
                    noviKupac.upisiKupca(Globalne.DatKupac);
                    MessageBox.Show("Nalog kupca " + txtIme.Text + " " + txtPrezime.Text + " je uspesno kreiran!", "Uspesno kreiran nalog");
                    if (Globalne.AdminPraviKupca)
                    {
                        Globalne.AdminPraviKupca = false;
                        FormAdmin frm = new FormAdmin();
                        frm.MdiParent = this.ParentForm;
                        frm.Show();
                        frm.Dock = DockStyle.Fill;
                        Close();
                    }
                    else
                    {
                        FormIzbor frm = new FormIzbor();
                        frm.MdiParent = this.ParentForm;
                        frm.Show();
                        frm.Dock = DockStyle.Fill;
                        Close();
                    }
                }
            }
        }