protected bool HasPermission(Enum permission) { FormConfigurationUserPermissionUser formConfigurationUserPermissionUser = this.FormConfiguration.FormConfigurationUserPermissions .SelectMany(x => x.FormConfigurationUserPermissionUsers).SingleOrDefault(x => x.FormConfigurationUserPermission.UserPermissionId == Convert.ToInt32(permission) && x.User.UserId == Session.User.UserId); FormConfigurationUserPermission formConfigurationUserPermission = this.FormConfiguration.FormConfigurationUserPermissions .Single(x => x.UserPermissionId == Convert.ToInt32(permission)); bool hasPermission = formConfigurationUserPermissionUser != null; bool hasErrorMessage = formConfigurationUserPermission.PermissionDeniedErrorMessage != null; if (!hasPermission) { if (hasErrorMessage) { MessageBox.Show(formConfigurationUserPermission.PermissionDeniedErrorMessage, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No cuenta con el permiso para realizar esta acción.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information); } } return(hasPermission); }
private void EditFormConfigurationUserPermission(int FormConfigurationUserPermissionId) { this.FormConfigurationUserPermission = this.srvFormConfigurationUserPermission.GetById(FormConfigurationUserPermissionId); this.ClearDetailControls(); this.LoadFormFromEntity(); this.frmFormConfigurationUserPermission.HiddenDetail(false); this.ShowDetail(true); }
private void DeleteEntity(int FormConfigurationUserPermissionId) { if (MessageBox.Show("¿Esta seguro de eliminar el Permiso de Usuario?", "Advertencia", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } this.FormConfigurationUserPermission = this.srvFormConfigurationUserPermission.GetById(FormConfigurationUserPermissionId); this.FormConfigurationUserPermission.Activated = false; this.FormConfigurationUserPermission.Deleted = true; this.srvFormConfigurationUserPermission.SaveOrUpdate(this.FormConfigurationUserPermission); this.Search(); }
public override FormConfigurationUserPermission GetSearchResult() { FormConfigurationUserPermission FormConfigurationUserPermission = null; UltraGridRow activeRow = this.grdSchSearch.ActiveRow; if (activeRow != null) { int FormConfigurationUserPermissionId = Convert.ToInt32(activeRow.Cells[0].Value); FormConfigurationUserPermission = this.srvFormConfigurationUserPermission.GetById(FormConfigurationUserPermissionId); } return(FormConfigurationUserPermission); }
private void btnSchCreate_Click(object sender, EventArgs e) { this.FormConfigurationUserPermission = new FormConfigurationUserPermission(); this.ClearDetailControls(); this.ShowDetail(true); }