private void AddAdminButton_Click(object sender, EventArgs e)
 {
     if (AdminNameTextBox.Text.Length == 0 || AdminSurnameTextBox.Text.Length == 0 || UserNameTextBox.Text.Length == 0)
     {
         Warning();
     }
     else
     {
         bool isUnique = UsersRepository.CheckUnique(UserNameTextBox.Text);
         if (isUnique != true)
         {
             bool isAdminAdded = AdminRepository.AddAdmin(AdminNameTextBox.Text, AdminSurnameTextBox.Text, UserNameTextBox.Text, AdminNameTextBox.Text);
             if (isAdminAdded == true)
             {
                 AdminNameTextBox.Text    = "";
                 AdminSurnameTextBox.Text = "";
                 UserNameTextBox.Text     = "";
             }
             else
             {
                 AdminNameTextBox.Text    = "";
                 AdminSurnameTextBox.Text = "";
                 UserNameTextBox.Text     = "";
             }
         }
     }
 }
示例#2
0
 private void AddAdminButton_Click(object sender, EventArgs e)
 {
     if (AdminNameTextBox.Text.Length == 0 || AdminSurnameTextBox.Text.Length == 0 || UserNameTextBox.Text.Length == 0)
     {
         warning();
     }
     else
     {
         AdminRepository.AddAdmin(AdminNameTextBox.Text, AdminSurnameTextBox.Text, UserNameTextBox.Text, AdminNameTextBox.Text + AdminSurnameTextBox.Text);
     }
 }
示例#3
0
        public void AddAdminTest()
        {
            Admin admin = new Admin();

            admin.Ime      = "Milos";
            admin.Prezime  = "Seckovic";
            admin.Username = "******";
            admin.Password = "******";

            AdminRepository repo = new AdminRepository();
            int             id   = repo.AddAdmin(admin);

            Assert.IsNotNull(id > 0);
        }
示例#4
0
        private void AddAdmindata_click(object sender, EventArgs e)
        {
            AdminRepository _AdminRepository = new AdminRepository();

            bool AdminAddedOrNot = _AdminRepository.AddAdmin(tboxaid.Text, tboxaname.Text, tboxapassword.Text, tboxaphone.Text, tboxaemail.Text, tboxasal.Text, aPictureBox);

            if (AdminAddedOrNot)
            {
                MessageBox.Show("Admin Added");
            }
            else
            {
                MessageBox.Show("Admin Not Added");
            }
        }
 public void  AddAdmin(Admin admin)
 {
     adminRepository.AddAdmin(admin);
 }