Esempio n. 1
0
        private void RRConfirm_Click(object sender, EventArgs e)
        {
            string userID;
            string perm;
            char   permis;

            if (RRPermission1.Text != "" && RRConfirm1.Checked == true)
            {
                userID = RRUserID1.Text;
                perm   = RRPermission1.Text;
                permis = getPermission(perm);
                if (con.writeUserAsActive(userID, permis))
                {
                    DatabaseInfo.Text    = "User was added to the database as " + perm;
                    DatabaseInfo.Visible = true;
                }
            }
            else if (RRRefuse1.Checked == true)
            {
                con.deleteUserFromDatabase(RRUserID1.Text);
                DatabaseInfo.Text    = "User was removed from database";
                DatabaseInfo.Visible = true;
            }
            if (RRUserID2.Visible == true && RRPermission2.Text != "" && RRConfirm2.Checked == true)
            {
                userID = RRUserID2.Text;
                perm   = RRPermission2.Text;
                permis = getPermission(perm);
                con.writeUserAsActive(userID, permis);
            }
            else if (RRUserID2.Visible == true && RRRefuse2.Checked == true)
            {
                con.deleteUserFromDatabase(RRUserID2.Text);
            }
            if (RRUserID3.Visible == true && RRPermission3.Text != "" && RRConfirm3.Checked == true)
            {
                userID = RRUserID3.Text;
                perm   = RRPermission3.Text;
                permis = getPermission(perm);
                con.writeUserAsActive(userID, permis);
            }
            else if (RRUserID3.Visible == true && RRRefuse3.Checked == true)
            {
                con.deleteUserFromDatabase(RRUserID3.Text);
            }
            if (RRUserID4.Visible == true && RRPermission4.Text != "" && RRConfirm4.Checked == true)
            {
                userID = RRUserID4.Text;
                perm   = RRPermission4.Text;
                permis = getPermission(perm);
                con.writeUserAsActive(userID, permis);
            }
            else if (RRUserID4.Visible == true && RRRefuse4.Checked == true)
            {
                con.deleteUserFromDatabase(RRUserID4.Text);
            }
            if (RRUserID5.Visible == true && RRPermission5.Text != "" && RRConfirm5.Checked == true)
            {
                userID = RRUserID5.Text;
                perm   = RRPermission5.Text;
                permis = getPermission(perm);
                con.writeUserAsActive(userID, permis);
            }
            else if (RRUserID5.Visible == true && RRRefuse5.Checked == true)
            {
                con.deleteUserFromDatabase(RRUserID5.Text);
            }

            registrationReguestToolStripMenuItem_Click(RRConfirm, null);
        }