示例#1
0
        private void btnAdminLogout_Click(object sender, EventArgs e)
        {
            AdminLog.AdminLogs(AdminLog.Admin, btnAdminLogout.Text);
            var Logout = new AdminLogOut();

            this.Visible = false;
            Logout.ShowDialog();
        }
示例#2
0
 private void btnDeleteActivities_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure you want to Delete ?", "Cash Desk", MessageBoxButtons.YesNo,
                         MessageBoxIcon.Information) == DialogResult.Yes)
     {
         AdminLogEvents.DeleleAdminLogs();
         AdminLogEvents.AdminLogs(dataGridActivity);
         MessageBox.Show("Records Deleted Successfully", "Cash Desk", MessageBoxButtons.OK,
                         MessageBoxIcon.Information);
         this.Close();
         var logout = new AdminLogOut();
         logout.ShowDialog();
     }
 }
示例#3
0
        private void btnSet_Click(object sender, EventArgs e)
        {
            //change username button
            try
            {
                if (string.IsNullOrEmpty(txtUsername.Text))
                {
                    throw new Exception("Enter current username");
                }
                if (txtUsername.Text != AdminLog.Admin)
                {
                    throw new Exception("Current username is not same as the current user");
                }

                if (string.IsNullOrEmpty(txtNewUser.Text))
                {
                    throw new Exception("Enter New username");
                }
                if (string.IsNullOrEmpty(txtCurrentPass.Text))
                {
                    throw new Exception("Enter admin password");
                }

                if (PasswordEncryptor.Encrypt(txtCurrentPass.Text) != AdminLog.AdminPass)
                {
                    throw new Exception("Current user password is incorrect");
                }

                AdminLog.UpdateAdminUsername(txtUsername.Text, txtNewUser.Text);
                MessageBox.Show("Update Successful", "Cash Desk", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtCurrentPass.Text = "";
                txtUsername.Text    = "";
                txtNewUser.Text     = "";
                var newLogin = new AdminLogOut();
                newLogin.ShowDialog();
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Cash Desk", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }