Beispiel #1
0
        private void btnSaveAccount_Click(object sender, EventArgs e)
        {
            if (!CheckEmptyFields())
            {
                InventoryUtils.LtuUsers.AddLast(new User(tbFirstName.Text, tbLastName.Text, cbGender.SelectedItem.ToString(), tbUsername.Text,
                                                         tbNumber.Text, tbDefaultPassword.Text, cbPosition.SelectedItem.ToString().ToUpper()));

                //invoke inventory add account method
                _classifier = account.AddAccount();

                switch (_classifier)
                {
                case 0:
                    MessageBox.Show(@"Account successfully added", @"Added", MessageBoxButtons.OK
                                    , MessageBoxIcon.Information);
                    break;

                case 1:
                    MessageBox.Show(@"Could not save account", @"DB Error", MessageBoxButtons.OK
                                    , MessageBoxIcon.Error);
                    break;
                }

                CleanForm(this); //clear all text-fields
            }
            else
            {
                MessageBox.Show(@"Fill out all fields", @"Empty fields", MessageBoxButtons.OK
                                , MessageBoxIcon.Information);
            }
        }