예제 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            uavo = new VO.UserAccountVO();
            DialogResult dlgResult = MessageBox.Show("Do You Wish To Add Account?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dlgResult == DialogResult.Yes)
            {
                try
                {
                    uavo.user_id       = Convert.ToInt32(txtBoxUserID.Text);
                    uavo.user_name     = txtBoxUserName.Text;
                    uavo.user_password = txtBoxPassword.Text;
                    uavo.first_name    = txtBoxFirstName.Text;
                    uavo.middle_name   = txtBoxMiddleName.Text;
                    uavo.last_name     = txtBoxLastName.Text;
                    uavo.AddUser();
                    String created = DateTime.Now.ToLongDateString() + " at " + DateTime.Now.ToLongTimeString();
                    dataGridView1.Rows.Add(txtBoxUserID.Text, txtBoxUserName.Text, txtBoxFirstName.Text, txtBoxMiddleName.Text, txtBoxLastName.Text, null, created);
                    ClearBoxes();
                    txtBoxUserID.Text = uavo.askUserID().ToString();
                    MessageBox.Show("The Account has been Created", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception)
                {
                    MessageBox.Show("Account already Exist or Check Database Server!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #2
0
 private void mdiUserAcc_Load(object sender, EventArgs e)
 {
     uavo = new VO.UserAccountVO();
     getDataTable();
     txtBoxUserID.Text = uavo.askUserID().ToString();
     txtBoxFirstName.Focus();
     username = frmLogin.User.user_name;
 }
예제 #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            uavo = new VO.UserAccountVO();
            DialogResult dlgResult = MessageBox.Show("Do You Want to Delete This Account?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (dlgResult == DialogResult.Yes)
            {
                uavo.user_id   = Convert.ToInt32(txtBoxUUserID.Text);
                uavo.user_name = txtBoxUUserName.Text;
                uavo.DeleteUser();
                txtBoxUserID.Text = uavo.askUserID().ToString();
                dataGridView1.Rows.RemoveAt(dataGridView1.SelectedRows[0].Index);
                txtBoxUUserID.Clear();
                ClearBoxesU();
                MessageBox.Show("The Record that you've Selected has already Deleted!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }