Пример #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            uavo = new VO.UserAccountVO();
            DialogResult dlgResult = MessageBox.Show("Do You Wish To Update an Account You Have Selected?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dlgResult == DialogResult.Yes)
            {
                try
                {
                    uavo.user_id     = Convert.ToInt32(txtBoxUUserID.Text);
                    uavo.user_name   = txtBoxUUserName.Text;
                    uavo.first_name  = txtBoxUFirstName.Text;
                    uavo.middle_name = txtBoxUMiddleName.Text;
                    uavo.last_name   = txtBoxULastName.Text;
                    uavo.UpdateUser();
                    dataGridView1.SelectedRows[0].Cells[0].Value = txtBoxUUserID.Text;
                    dataGridView1.SelectedRows[0].Cells[1].Value = txtBoxUUserName.Text;
                    dataGridView1.SelectedRows[0].Cells[2].Value = txtBoxUFirstName.Text;
                    dataGridView1.SelectedRows[0].Cells[3].Value = txtBoxUMiddleName.Text;
                    dataGridView1.SelectedRows[0].Cells[4].Value = txtBoxULastName.Text;
                    ClearBoxesU();
                    MessageBox.Show("The Account has been Updated", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception)
                {
                    MessageBox.Show("Username already Exist or Check Database Server!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #2
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            Int32 catchID = 0;

            uavo = new VO.UserAccountVO();
            txtBoxUUserID.Text     = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
            grabID                 = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
            txtBoxUUserName.Text   = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
            txtBoxUFirstName.Text  = dataGridView1.SelectedRows[0].Cells[2].Value.ToString();
            txtBoxUMiddleName.Text = dataGridView1.SelectedRows[0].Cells[3].Value.ToString();
            txtBoxULastName.Text   = dataGridView1.SelectedRows[0].Cells[4].Value.ToString();
            getSecurityFlags();
            unlockCheckBox();
            btnSave.Enabled = true;
            uavo.user_name  = username;
            uavo.askCatchUserID();
            catchID      = uavo.askCatchUserID();
            uavo.user_id = catchID;
            if (catchID == Convert.ToInt32(txtBoxUUserID.Text))
            {
                chkSystemAccess.Enabled = false;
                chkUserAccounts.Enabled = false;
            }
            else
            {
                chkSystemAccess.Enabled = true;
                chkUserAccounts.Enabled = true;
            }
        }
Пример #3
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);
                }
            }
        }
Пример #4
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;
 }
Пример #5
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);
            }
        }
Пример #6
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            uavo = new VO.UserAccountVO();
            DialogResult dlgResult = MessageBox.Show("Do You Wish To Reset this Account?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dlgResult == DialogResult.Yes)
            {
                try
                {
                    uavo.user_name = cBoxUserName.Text;
                    uavo.Reset();
                    btnReset.Enabled = false;
                }
                catch (Exception)
                {
                    MessageBox.Show("Please Check your Database Server Connection", "Database Server Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Int32 can_access        = 0;
            Int32 has_sales         = 0;
            Int32 has_customers     = 0;
            Int32 has_inventory     = 0;
            Int32 has_reports       = 0;
            Int32 has_gc            = 0;
            Int32 has_user_accounts = 0;
            Int32 has_conf          = 0;

            uavo = new VO.UserAccountVO();
            try
            {
                if (chkSystemAccess.Checked)
                {
                    can_access = 1;
                }
                else
                {
                    can_access = 0;
                }
                if (chkSales.Checked)
                {
                    has_sales = 1;
                }
                else
                {
                    has_sales = 0;
                }
                if (chkCustomers.Checked)
                {
                    has_customers = 1;
                }
                else
                {
                    has_customers = 0;
                }
                if (chkInventory.Checked)
                {
                    has_inventory = 1;
                }
                else
                {
                    has_inventory = 0;
                }
                if (chkReports.Checked)
                {
                    has_reports = 1;
                }
                else
                {
                    has_reports = 0;
                }
                if (chkGiftCards.Checked)
                {
                    has_gc = 1;
                }
                else
                {
                    has_gc = 0;
                }
                if (chkUserAccounts.Checked)
                {
                    has_user_accounts = 1;
                }
                else
                {
                    has_user_accounts = 0;
                }
                if (chkConfiguration.Checked)
                {
                    has_conf = 1;
                }
                else
                {
                    has_conf = 0;
                }
                uavo.can_access        = can_access;
                uavo.has_sales         = has_sales;
                uavo.has_customers     = has_customers;
                uavo.has_inventory     = has_inventory;
                uavo.has_reports       = has_reports;
                uavo.has_gc            = has_gc;
                uavo.has_user_accounts = has_user_accounts;
                uavo.has_conf          = has_conf;
                uavo.user_id           = Convert.ToInt32(txtBoxUUserID.Text);
                uavo.SaveRestriction();
                btnSave.Enabled = false;
            }
            catch (Exception)
            {
                MessageBox.Show("Please Check your Database Server Connection", "Database Server Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.ExitThread();
            }
        }
Пример #8
0
 private void enterKey()
 {
     avo = new VO.UserAccountVO(txtBoxUsername.Text);
     try
     {
         if (login.isAuth(txtBoxUsername.Text, txtPassword.Text.Trim()))
         {
             currentUser         = avo;
             txtBoxUsername.Text = avo.user_name;
             login.catchUsername(txtBoxUsername.Text);
             if (login.canAccess())
             {
                 avo.user_name = txtBoxUsername.Text;
                 avo.PushLog();
                 this.Hide();
                 frmMenu fm = new frmMenu();
                 fm.Show();
                 if (login.hasSales())
                 {
                     fm.unlockSales();
                 }
                 if (login.hasOrder())
                 {
                     fm.unlockOrder();
                 }
                 if (login.hasCustomers())
                 {
                     fm.unlockCustomers();
                 }
                 if (login.hasInventory())
                 {
                     fm.unlockInventory();
                 }
                 if (login.hasReports())
                 {
                     fm.unlockGeneralReports();
                 }
                 if (login.hasGC())
                 {
                     fm.unlockGiftCards();
                 }
                 if (login.hasUser_Accounts())
                 {
                     fm.unlockUserAccounts();
                 }
                 if (login.hasUserConf())
                 {
                     fm.unlockConfig();
                 }
             }
             else
             {
                 MessageBox.Show("Your Account is Disable!\nContact Account Supervisor to Enable your Account", "Account Security", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                 txtBoxUsername.Text     = "";
                 txtBoxUsername.ReadOnly = false;
                 txtBoxUsername.Focus();
                 txtPassword.Text     = "";
                 txtPassword.ReadOnly = true;
             }
         }
         else
         {
             MessageBox.Show("Username and/or Password is Incorrect or Not Completed", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             txtBoxUsername.Text     = "";
             txtBoxUsername.ReadOnly = false;
             txtBoxUsername.Focus();
             txtPassword.Text     = "";
             txtPassword.ReadOnly = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }