public int InsertByModel(RootMenuModel Model) { String sql = "INSERT INTO RootMenu(Title,ParentID,Link) VALUES(@Title,@ParentID,@Link)"; return(DataBaseOpen.NoQuery(sql, new SqlParameter[] { new SqlParameter("@Title", Model.Title), new SqlParameter("@ParentID", Model.ParentID), new SqlParameter("@Link", Model.Link), })); }
public int UpdateByModel(RootMenuModel Model) { String sql = "UPDATE RootMenu SET Title=@Title,ParentID=@ParentID,Link=@Link WHERE ID=@ID"; return(DataBaseOpen.NoQuery(sql, new SqlParameter[] { new SqlParameter("@Title", Model.Title), new SqlParameter("@ParentID", Model.ParentID), new SqlParameter("@Link", Model.Link), })); }
/// <summary> /// Returns a context menu containing commands with commandTags</summary> /// <param name="commandTags">Command tags for commands to include on menu</param> /// <returns>ContextMenu</returns> public ContextMenu GetContextMenu(IEnumerable <object> commandTags) { CommandManager.InvalidateRequerySuggested(); var menu = new ContextMenu(); menu.SetResourceReference(ContextMenu.StyleProperty, Resources.ContextMenuStyleKey); // Generate view model var commands = new List <ICommandItem>(); foreach (object tag in commandTags) { var command = m_commandService.GetCommand(tag); if (command != null) { if (!AutoCompact || command.CanExecute(null)) { commands.Add(command); } } else { // Allow direct display of ICommandItems which have not been registered // with the command service var commandItem = tag as ICommandItem; if (commandItem != null && (!AutoCompact || commandItem.CanExecute(null))) { commands.Add(commandItem); } } } commands.Sort(new CommandComparer()); var dummyRootMenu = new RootMenuModel(null, null, null); foreach (ICommandItem command in commands) { dummyRootMenu.AddItem(command); } menu.ItemsSource = dummyRootMenu.Children; return(menu); }
public int UpdateByModel(RootMenuModel Model) { return(DAL.UpdateByModel(Model)); }
public int InsertByModel(RootMenuModel Model) { return(DAL.InsertByModel(Model)); }