Esempio n. 1
0
 void gvwRole_Deleting(object sender, GridViewDeletingEventArgs e)
 {
     if (e.Items != null && e.Items.Count() > 0)
     {
         AspRole role = e.Items.First() as AspRole;
         if (role != null)
         {
             if (role.CanDelete && !SecurityHelper.IsBuildInRole(role.RoleId))
             {
                 MessageBoxResult result = MessageBox.Show(ResourceHelper.GetReourceValue("Common_ConfirmDeleteNoParam"), ResourceHelper.GetReourceValue("Common_ConfirmationRequired"), MessageBoxButton.OKCancel);
                 if (result == MessageBoxResult.Cancel)
                 {
                     e.Cancel = true;
                 }
             }
             else
             {
                 MessageBoxResult result = MessageBox.Show(string.Format(ResourceHelper.GetReourceValue("Common_DeleteFailed"), role.RoleName), ResourceHelper.GetReourceValue("Common_OperationFailed"), MessageBoxButton.OK);
                 e.Cancel = true;
             }
         }
     }
 }