private async void btnSnimi_Click(object sender, EventArgs e)
        {
            if (this.ValidateChildren())
            {
                if (txtPassword.Text != txtPasswordConfirmation.Text)
                {
                    MessageBox.Show("Unesene šifre nisu jednake", "Upozorenje", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                bool t = await _service.Check_Username(txtUsername.Text);

                if (t == true)
                {
                    MessageBox.Show("Uneseno korisničko ime već postoji.", "Upozorenje", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (t == false)
                {
                    if (txtPassword.Text == txtPasswordConfirmation.Text)
                    {
                        Models.AdministracijaAdmin novi = new Models.AdministracijaAdmin();
                        novi.Adresa          = txtAdresa.Text;
                        novi.DatumRodjenja   = dateRodjenje.Value;
                        novi.DatumZaposlenja = dateZaposlenje.Value;
                        novi.Ime             = txtIme.Text;
                        novi.Kancelarija     = txtKancelarija.Text;
                        novi.KorisnickoIme   = txtUsername.Text;
                        novi.Mail            = txtMail.Text;
                        novi.LozinkaHash     = txtPassword.Text;
                        novi.LozinkaSalt     = txtPasswordConfirmation.Text;
                        novi.Prezime         = txtPrezime.Text;

                        if (rbtnMusko.Checked = true)
                        {
                            novi.Spol = "M";
                        }
                        else if (rbtnZensko.Checked = true)
                        {
                            novi.Spol = "Ž";
                        }
                        else
                        {
                            novi.Spol = "-";
                        }
                        novi.Staz         = int.Parse(txtStaz.Text);
                        novi.VrstaUgovora = txtUgovor.Text;

                        novi.Slika = imageToByteArray(picSlika.Image);

                        await _service.Insert(novi);

                        MessageBox.Show("Operacija upsješna");
                        this.Close();
                    }
                }
            }
        }
Example #2
0
        private async void btnSacuvaj_Click(object sender, EventArgs e)
        {
            if (this.ValidateChildren())
            {
                if (txtSifra.Text != txtConfirm.Text)
                {
                    MessageBox.Show("Unesene šifre nisu iste", "Provjera šifri", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                bool t = await service.Check_Username(txtUsername.Text);

                if (t == true)
                {
                    MessageBox.Show("Uneseno korisničko ime već postoji.", "Upozorenje", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (t == false)
                {
                    if (txtSifra.Text == txtConfirm.Text)
                    {
                        ProfesorAdmin novi = new ProfesorAdmin()
                        {
                            Adresa          = txtAdresa.Text,
                            DatumRodjenja   = dateRodjenje.Value,
                            DatumZaposlenja = dateZaposlenje.Value,
                            Ime             = txtIme.Text,
                            Kancelarija     = txtKanelarija.Text,
                            KorisnickoIme   = txtUsername.Text,
                            LozinkaHash     = txtSifra.Text,
                            LozinkaSalt     = txtConfirm.Text,
                            Mail            = txtMail.Text,
                            Prezime         = txtPrezime.Text,
                            Staz            = int.Parse(txtStaz.Text),
                            VrstaUgovora    = txtUgovor.Text,
                            Zvanje          = txtZvanje.Text,
                        };

                        if (rbtnM.Checked == true)
                        {
                            novi.Spol = "M";
                        }
                        else if (rbtnZ.Checked == true)
                        {
                            novi.Spol = "Ž";
                        }

                        novi.Slika = imageToByteArray(pictureBox.Image);

                        await service.Insert(novi);

                        MessageBox.Show("Uspješno ste izvršili dodavanje");
                        this.Close();
                    }
                }
            }
        }
        private async void btnSacuvaj_Click(object sender, EventArgs e)
        {
            if (ValidateChildren())
            {
                if (txtSifra.Text != txtConfirm.Text)
                {
                    MessageBox.Show("Unesene šifre nisu iste");
                }

                bool t = await service.Check_Username(txtUsername.Text);

                if (t == true)
                {
                    MessageBox.Show("Uneseno korisničko ime već postoji.", "Upozorenje", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (t == false)
                {
                    if (txtSifra.Text == txtConfirm.Text)
                    {
                        Models.StudentAdmin novi = new Models.StudentAdmin
                        {
                            Adresa          = txtAdresa.Text,
                            DatumRodjenja   = dateRodjenje.Value,
                            DatumUpisa      = dateUpis.Value,
                            Ime             = txtIme.Text,
                            Indeks          = txtIndeks.Text,
                            KorisnickoIme   = txtUsername.Text,
                            LozinkaHash     = txtSifra.Text,
                            LozinkaSalt     = txtConfirm.Text,
                            Mail            = txtMail.Text,
                            OvjerenSemestar = int.Parse(txtOvjerenSemestar.Text),
                            Prezime         = txtPrezime.Text,
                            Slika           = imageToByteArray(pictureBox.Image),
                            Status          = txtStatus.Text,
                            Telefon         = txtTelefon.Text,
                            UpisanSemestar  = int.Parse(txtUpisaniSemestar.Text),
                            ProsjecnaOcjena = 0
                        };

                        if (rbtnM.Checked)
                        {
                            novi.Spol = "M";
                        }
                        if (rbtnZ.Checked)
                        {
                            novi.Spol = "Ž";
                        }

                        if (rbtnIC.Checked)
                        {
                            novi.NacinStudiranja = "IN-CLASS";
                        }
                        if (rbtnDL.Checked)
                        {
                            novi.NacinStudiranja = "DL";
                        }
                        if (rbtnV.Checked)
                        {
                            novi.NacinStudiranja = "Vanredno";
                        }

                        if (cbObnavlja.Checked)
                        {
                            novi.ObnavljaGodinu = "Da";
                        }
                        if (!cbObnavlja.Checked)
                        {
                            novi.ObnavljaGodinu = "Ne";
                        }

                        await service.Insert(novi);

                        MessageBox.Show("Uspješno ste unijeli podatke");
                        this.Close();
                    }
                }
            }
        }