Ejemplo n.º 1
0
        protected void gvRoles_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            var roleName = Utils.ConvertToTrimmedString(e.Values["rolename"]);

            roleName = roleName.ToLower();

            RoleManagement.RoleDelete(roleName);
        }
Ejemplo n.º 2
0
        protected void gvRoles_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            var newRoleName    = Utils.ConvertToTrimmedString(e.NewValues["rolename"]);
            var newDescription = Utils.ConvertToTrimmedString(e.NewValues["description"]);

            if (newRoleName == null ||
                newDescription == null)
            {
                throw new Exception("Complete all fields!");
            }

            newRoleName = newRoleName.ToLower();

            RoleManagement.RoleRegister(newRoleName, newDescription);
        }
Ejemplo n.º 3
0
        protected void gvRoles_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            var oldRoleName    = Utils.ConvertToTrimmedString(e.OldValues["rolename"]);
            var newRoleName    = Utils.ConvertToTrimmedString(e.NewValues["rolename"]);
            var newDescription = Utils.ConvertToTrimmedString(e.NewValues["description"]);

            if (newRoleName == null ||
                newDescription == null)
            {
                throw new Exception("Complete all fields!");
            }

            if (newRoleName != oldRoleName)
            {
                throw new Exception("Role name cannot be changed!");
            }

            newRoleName = newRoleName.ToLower();

            RoleManagement.RoleUpdate(newRoleName, newDescription);
        }