private void EmployeeDetailForm_Load(object sender, EventArgs e) { securedObjectSpace = objectSpaceProvider.CreateObjectSpace(); if (employee == null) { employee = securedObjectSpace.CreateObject <Employee>(); } else { employee = securedObjectSpace.GetObject(employee); deleteBarButtonItem.Enabled = security.CanDelete(employee); } AddControls(); }
protected void EmployeeGrid_CommandButtonInitialize(object sender, ASPxGridViewCommandButtonEventArgs e) { if (e.ButtonType == ColumnCommandButtonType.New) { if (!security.CanCreate <Employee>()) { e.Text = string.Empty; } } if (e.ButtonType == ColumnCommandButtonType.Delete) { Employee employee = ((ASPxGridView)sender).GetRow(e.VisibleIndex) as Employee; e.Visible = security.CanDelete(employee); } }
private void EmployeeDetailForm_Load(object sender, EventArgs e) { security = ((MainForm)MdiParent).Security; objectSpaceProvider = ((MainForm)MdiParent).ObjectSpaceProvider; securedObjectSpace = objectSpaceProvider.CreateObjectSpace(); if (employee == null) { employee = securedObjectSpace.CreateObject <Employee>(); } else { employee = securedObjectSpace.GetObject(employee); deleteBarButtonItem.Enabled = security.CanDelete(employee); } employeeBindingSource.DataSource = employee; AddControls(); }
private void EmployeeGridView_FocusedRowObjectChanged(object sender, FocusedRowObjectChangedEventArgs e) { deleteBarButtonItem.Enabled = security.CanDelete(e.Row); }