Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!ValidateData())
            {
                MUtility.ShowWarrning("Proverite sva polja");
                return;
            }

            user.ProfilePicture = picProfilePicture.Image;
            user.FirstName      = txtFName.Text;
            user.LastName       = txtLName.Text;
            user.Birthday       = dateTimeBirthday.Value;
            if (user.AccountType == User.UserAccountType.Student)
            {
                user.Faculty = cbxFaculty.SelectedItem as Faculty;
                user.Index   = txtIndex.Text;
            }
            user.PhoneNumber = txtPhone.Text;

            user.Username         = txtUsername.Text;
            user.Email            = txtEmail.Text;
            user.Password         = txtPassword.Text;
            user.ValidUntil       = dateTimeValid.Value;
            user.RegistrationDate = dateTimeRegistration.Value;
            user.AccountType      = (User.UserAccountType)cbxTip.SelectedItem;
            user.ActiveAccount    = cbxStanje.SelectedIndex == 0;
            DialogResult          = DialogResult.OK;
            Close();
        }
Esempio n. 2
0
        private void KORSN_btnDeleteUser_Click(object sender, EventArgs e)
        {
            if (KORSN_dgvUsers.SelectedRows.Count == 0)
            {
                MUtility.ShowWarrning("Odaberite korisnika");
                return;
            }

            User u = KORSN_dgvUsers.SelectedRows[0].DataBoundItem as User;

            DialogResult dr = MessageBox.Show(
                string.Format("Da li ste sigurni da zelite da obrisete korisnika {0}?", u.FullName),
                "Brisanje korisnika",
                MessageBoxButtons.YesNo,
                MessageBoxIcon.Question);

            if (dr != DialogResult.OK)
            {
                return;
            }


            bool ops = MainController.DeleteUser(u);

            if (ops)
            {
                KORSN_RefreshUsersGrid(true);
                MUtility.ShowInformation("Korisnik uspesno obrisan");
            }
        }
Esempio n. 3
0
 private void txtEmail_Validating(object sender, CancelEventArgs e)
 {
     if (txtEmail.Text == string.Empty)
     {
         return;
     }
     if (!MainController.IsValidEmail(txtEmail.Text))
     {
         MUtility.ShowWarrning("Unet je nevalidan email");
         return;
     }
 }
Esempio n. 4
0
        private void NAPLATA_btnReclamation_Click(object sender, EventArgs e)
        {
            User s = MainController.LoadedCardUser;

            if (s == null)
            {
                MUtility.ShowWarrning("Prvo ucitati korisnika");
                return;
            }

            ReclamationForm rf = new ReclamationForm(MainController.LoadedCardUser, ReclamationForm.Mode.PogresnaNaplata);

            rf.ShowDialog();

            OpStatusWorking();
            MainController.LoadUserCard(MainController.LoadedCardUser.UserID);
            NAPLATA_RefreshCardInfo();
            OpStatusIdle();
        }
Esempio n. 5
0
        private void picProfilePicture_Click(object sender, EventArgs e)
        {
            DialogResult dr = openImageFileDialog.ShowDialog();

            if (dr != DialogResult.OK)
            {
                return;
            }

            string filename = openImageFileDialog.FileName;

            long filesize = (new FileInfo(filename)).Length;

            if (filesize >= (1024 * 1024 * 1))
            {
                MUtility.ShowWarrning("Prevelika slika. Slika mora da bude manje od 1MB");
                return;
            }
            picProfilePicture.Image = Image.FromFile(openImageFileDialog.FileName);
        }
Esempio n. 6
0
        private void KORSN_btnChangeUser_Click(object sender, EventArgs e)
        {
            if (KORSN_dgvUsers.SelectedRows.Count == 0)
            {
                MUtility.ShowWarrning("Odaberite korisnika");
                return;
            }

            User     u  = KORSN_dgvUsers.SelectedRows[0].DataBoundItem as User;
            UserForm uf = new UserForm(u);

            if (uf.ShowDialog() == DialogResult.OK)
            {
                bool ops = MainController.UpdateUser(u);
                if (ops)
                {
                    MUtility.ShowInformation("Korisnik uspesno azuriran");
                }
                KORSN_RefreshUsersGrid(true);
            }
        }
Esempio n. 7
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtUsername.Text == string.Empty || txtPassword.Text == string.Empty)
            {
                MUtility.ShowWarrning("Unesite sve podatke");
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            bool status = MainController.LoginUser(txtUsername.Text, txtPassword.Text);

            Cursor.Current = Cursors.Arrow;

            if (status)
            {
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                txtUsername.Focus();
            }
        }
Esempio n. 8
0
        private void UPLATA_btnExecutePay_Click(object sender, EventArgs e)
        {
            if (MainController.LoadedCardUser == null)
            {
                MUtility.ShowWarrning("Prvo ucitati korisnika");
                return;
            }
            OpStatusWorking();
            int  b, l, d;
            bool succ = true;

            succ &= int.TryParse(UPLATA_txtBreakfast.Text, out b);
            succ &= int.TryParse(UPLATA_txtLunch.Text, out l);
            succ &= int.TryParse(UPLATA_txtDinner.Text, out d);
            if (!succ)
            {
                MUtility.ShowError("Nisu svi uneti podaci validni");
                return;
            }
            MainController.AddUserMeals(MainController.LoadedCardUser, b, l, d);
            MainController.LoadUserCard(MainController.LoadedCardUser.UserID);
            UPLATA_RefreshCardInfo(true);
            OpStatusIdle();
        }