Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var result = _dbhelp.Login(txtUsername.Text, txtPassword.Text);

            if (result)
            {
                MainScreen frm = new MainScreen();
                this.Hide();
                frm.Show();
            }
            else
            {
                MessageBox.Show("Could not log you in. Check username and password.", "Error");
            }
        }
Exemple #2
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Do you want to delete this information?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         var result = _dbhelp.DeleteDogInfo(_dog.dogId);
         if (result)
         {
             if (MessageBox.Show("Dog information deleted successfully.", "Success", MessageBoxButtons.OK) == DialogResult.OK)
             {
                 MainScreen frm = new MainScreen();
                 this.Hide();
                 frm.Show();
             }
         }
     }
 }
Exemple #3
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure you want to delete this user?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         var result = _dbhelp.DeleteUser(Convert.ToInt32(cmbUsers.SelectedValue));
         if (result)
         {
             if (MessageBox.Show("user deleted successfully.", "Success", MessageBoxButtons.OK) == DialogResult.OK)
             {
                 MainScreen frm = new MainScreen();
                 this.Hide();
                 frm.Show();
             }
         }
     }
 }
Exemple #4
0
 private void btnNew_Click(object sender, EventArgs e)
 {
     if (checkInfo())
     {
         var result = _dbhelp.CreateUser(txtUsername.Text, txtPassword.Text);
         if (result)
         {
             if (MessageBox.Show("New user added successfully.", "Success", MessageBoxButtons.OK) == DialogResult.OK)
             {
                 MainScreen frm = new MainScreen();
                 this.Hide();
                 frm.Show();
             }
         }
     }
 }
Exemple #5
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Do you want to delete this customer?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         var result = _dbhelp.DeleteCustomer(_customer, _address);
         if (result)
         {
             if (MessageBox.Show("Customer deleted successfully.", "Success", MessageBoxButtons.OK) == DialogResult.OK)
             {
                 MainScreen frm = new MainScreen();
                 this.Hide();
                 frm.Show();
             }
         }
     }
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            // _dog.dogName = txtName.Text;
            _dog.dogName = cmbDogs.Text;
            _dog.note    = richTxtNotes.Rtf;
            var result = _dbhelp.UpdateDogInfo(_dog);

            if (result)
            {
                if (MessageBox.Show("Dog information saved successfully.", "Success", MessageBoxButtons.OK) == DialogResult.OK)
                {
                    MainScreen frm = new MainScreen();
                    this.Hide();
                    frm.Show();
                }
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (checkInfo())
            {
                _user.userName = txtUsername.Text;
                _user.Password = txtPassword.Text;

                var result = _dbhelp.UpdateUser(_user);
                if (result)
                {
                    if (MessageBox.Show("User information saved successfully.", "Success", MessageBoxButtons.OK) == DialogResult.OK)
                    {
                        MainScreen frm = new MainScreen();
                        this.Hide();
                        frm.Show();
                    }
                }
            }
        }
Exemple #8
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     //verify still
     if (checkInfo())
     {
         _dog.dogName = txtName.Text;
         _dog.note    = richTxtNotes.Rtf;
         _dog.custId  = Convert.ToInt32(cmbCustomers.SelectedValue);
         var result = _dbhelp.AddNewDog(_dog);
         if (result)
         {
             if (MessageBox.Show("Dog information added successfully.", "Success", MessageBoxButtons.OK) == DialogResult.OK)
             {
                 MainScreen frm = new MainScreen();
                 this.Hide();
                 frm.Show();
             }
         }
     }
 }