Exemple #1
0
        private void btnSaveRole_Click(object sender, EventArgs e)
        {
            try
            {
                roleProvider.CreateRole(txtRoleName.Text);
                MessageBox.Show("Role created successfully", "Create role", MessageBoxButtons.OK, MessageBoxIcon.Information);

                loadRoles();
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show("Failed to create role, " + ex.Message, "Create role", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            catch (SqlException ex)
            {
                MessageBox.Show("Failed to create role, " + ex.Message, "Create role", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to create role, " + ex.Message, "Create role", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemple #2
0
        public static void CreateRole(string roleName)
        {
            CustomRoleProvider crp = new CustomRoleProvider();

            crp.CreateRole(roleName);
        }