Пример #1
0
        private void RRConfirm_Click(object sender, EventArgs e)
        {
            string userID;
            string permission;
            string active;

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

            registrationReguestToolStripMenuItem_Click(RRConfirm, null);
        }