private void UserActionCommandHandler(object sender, CommandEventArgs e) { if (CE.GlobalState == GlobalState.Administer && mm.SysDriver.LockOwner(CE.project.Id, LockTypes.AdminLock) != null) { AdminLockAlert(); return; } bool valid = true; UserAction action = (UserAction)Enum.Parse(typeof(UserAction), e.CommandName.Substring(1)); if (CE.GlobalState == GlobalState.Administer) { try { switch (action) { case UserAction.Insert: if (activePanel.type != PanelTypes.Editable) // insert button under NavTable, should be handled differently { break; } if (ServerValidate(activePanel)) { mm.WebDriver.InsertIntoPanel(activePanel); } else { valid = false; } break; case UserAction.Update: if (ServerValidate(activePanel)) { mm.WebDriver.UpdatePanel(activePanel); } else { valid = false; } break; case UserAction.Delete: mm.WebDriver.DeleteFromPanel(activePanel); break; default: throw new NotImplementedException("Unexpected user action type."); } } catch (ConstraintException ce) { // unique column constraint exception from db valid = false; _min.Common.ValidationError.Display(ce.Message, Page); } catch (WebDriverDataModificationException me) { // data changed while edited valid = false; _min.Common.ValidationError.Display(me.Message, Page); } } if (valid) { navigator.ActionCommandHandle(sender, e); } }