//XERP allows for bulk updates. We only allow save //if all bulk update requirements are met... private bool CommitIsAllowed() {//Check for any repository changes that are not yet committed to the db... Dirty = RepositoryIsDirty(); //recurse and check for any invalid rows... _rowsValid = true;//initialize to true... //recurse tree passing in the root node of the list... CheckForInvalidRows(TreeNestedMenuItemList.FirstOrDefault()); return(_rowsValid); }
//commits repository to the db... private bool Commit() { //reset UI state manage fields... NestedMenuItem root = TreeNestedMenuItemList.FirstOrDefault(q => (q.ParentMenuID == null || q.ParentMenuID.Equals(string.Empty)) && q.CompanyID == ClientSessionSingleton.Instance.CompanyID); _serviceAgent.CommitMenuItemRepository(); //recurse tree clear and set seed autoids ResetTreeTempFields(root); Dirty = false; AllowCommit = false; return(true); }
public void DeleteMenuItemCommand() { //ToDo fix delete logic try { //delete in repository Delete(SelectedMenuItem); //remove it from the tree nested list NestedMenuItem root = TreeNestedMenuItemList.FirstOrDefault(q => (q.ParentMenuID == null || q.ParentMenuID.Equals(string.Empty)) && q.CompanyID == ClientSessionSingleton.Instance.CompanyID); //need to itterate tree and find the item and remove it from the tree list... RemoveNestedItem(root, SelectedMenuItem.AutoID); }//we try catch company delete as it may be used in another table as a key... ////As well we will force a refresh to sqare up the UI after the botched delete... catch { NotifyMessage("MenuItem/s Can Not Be Deleted. Contact XERP Admin For More Details."); // Refresh(); } }