public void InsertOrUpdate(MenuItem menuitem) { if (menuitem.MenuItemId == default(int)) { // New entity context.MenuItems.Add(menuitem); } else { // Existing entity context.Entry(menuitem).State = EntityState.Modified; } }
public void InsertOrUpdate(MenuItem MenuItem) { if (MenuItem.MenuId == default(int)) // New entity { //context.MenuItems.Add(MenuItem); _context.Entry(MenuItem).State = EntityState.Added; } else // Existing entity { _context.Entry(MenuItem).State = EntityState.Modified; } }
//private void CreateMenuManagers_Home(SJiraContext context) //{ // var Menus = new List<MenuManager>(); // //var MenuManagerTypeSideBar = context.MenuManagerTypes.Where(c => c.Name == "SideBar").FirstOrDefault(); // //var MenuManagerTypeToolBar = context.MenuManagerTypes.Where(c => c.Name == "ToolBar").FirstOrDefault(); // var MenuManagerTypeMain = context.MenuManagerTypes.Where(c => c.Name == "Main").FirstOrDefault(); // var MenuManagerTypeSecondary = context.MenuManagerTypes.Where(c => c.Name == "Secondary").FirstOrDefault(); // MenuManager entity = new MenuManager(); // //entity.MenuItemId = null; // entity.Title = "Home Main"; // entity.MenuManagerTypeId = MenuManagerTypeMain.MenuManagerTypeId; // Menus.Add(entity); // entity = new MenuManager(); // //entity.MenuItemId = null; // entity.Title = "Home SideBar"; // entity.MenuManagerTypeId = MenuManagerTypeSecondary.MenuManagerTypeId; // Menus.Add(entity); // context.MenuManagers.AddOrUpdate(c => new { c.Title, c.MenuManagerTypeId }, Menus.ToArray()); context.SaveChanges(); //} private void CreateMenuItems_Home_Main(SJiraContext context) { try { var MenuitemTypeButton = context.MenuItemTypes.Where(c => c.Name == "Button").FirstOrDefault(); var MenuitemTypeLink = context.MenuItemTypes.Where(c => c.Name == "Link").FirstOrDefault(); var MenuitemTypeDropdown = context.MenuItemTypes.Where(c => c.Name == "Dropdown").FirstOrDefault(); var MenuitemTypeInput = context.MenuItemTypes.Where(c => c.Name == "Input").FirstOrDefault(); //var MenuManager1 = context.MenuManagers.Where(c => c.Title == "Home Main" && c.MenuManagerType.Name == "Main").FirstOrDefault(); var Menus = new List<MenuItem>(); MenuItem entity = new MenuItem(); entity.Title = "Main"; entity.DisplayOrder = 10; entity.MenuAction = "#"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "SideBar"; entity.DisplayOrder = 10; entity.MenuAction = "#"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "ToolBar"; entity.DisplayOrder = 10; entity.MenuAction = "#"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); //context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuManagerId }, Menus.ToArray()); context.SaveChanges(); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); // Submenu for MenuItemId=2 var MenuMain = context.MenuItems.Where(m => m.Title == "Main").FirstOrDefault(); //entity.ParentId = MenuMain.MenuItemId; //entity.Title = "Home"; //entity.DisplayOrder = 10; //entity.MenuAction = "/Dashboards/SystemDashboard"; ////entity.MenuManagerId = MenuManager1.MenuManagerId; //entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuMain.MenuItemId; entity.Title = "Dashboards"; entity.MenuAction = "/Dashboard/Dashboard"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 20; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuMain.MenuItemId; entity.Title = "Projects"; entity.MenuAction = "/Project/Projects"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 30; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuMain.MenuItemId; entity.Title = "Issues"; entity.MenuAction = "/Issue/Issues"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 30; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuMain.MenuItemId; entity.Title = "Agile"; entity.MenuAction = "/Agile/Agile"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 40; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); //context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuManagerId }, Menus.ToArray()); context.SaveChanges(); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); // Submenu for MenuItemId=2 //-------------------------------------------------------------------------- Menus = new List<MenuItem>(); // Submenu for MenuItemId=2 var Parent = context.MenuItems.Where(m => m.Title == "Dashboards").FirstOrDefault(); //-------------------------------------------------------------------------- //entity = new MenuItem(); //entity.ParentId = Parent.MenuItemId; //entity.Title = "Separated link"; //entity.DisplayOrder = 90; ////entity.MenuManagerId = MenuManager1.MenuManagerId; //entity.MenuAction = "/Manage/Favorites"; //entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); //entity = new MenuItem(); entity.ParentId = Parent.MenuItemId; entity.Title = "Manage Dashboards"; entity.DisplayOrder = 100; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Manage/Favorites"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); var MenuItemManageDashboards = context.MenuItems.Where(m => m.Title == "Manage Dashboards").FirstOrDefault(); entity = new MenuItem(); entity.ParentId = MenuItemManageDashboards.MenuItemId; entity.Title = "Favorites"; entity.DisplayOrder = 10; entity.MenuAction = "/Manage/Favorites"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItemManageDashboards.MenuItemId; entity.Title = "My"; entity.DisplayOrder = 20; entity.MenuAction = "/Manage/My"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItemManageDashboards.MenuItemId; entity.Title = "Popular"; entity.DisplayOrder = 30; entity.MenuAction = "/Manage/Popular"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItemManageDashboards.MenuItemId; entity.Title = "Search"; entity.DisplayOrder = 40; entity.MenuAction = "/Dashboard/Search"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); // Submenus for MenuItemId=3 var MenuItem3 = context.MenuItems.Where(m => m.Title == "Projects").FirstOrDefault(); //Current Project entity = new MenuItem(); entity.ParentId = MenuItem3.MenuItemId; entity.Title = "Current Project"; entity.DisplayOrder = 1; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "#"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem3.MenuItemId; entity.Title = "My Scrum Project (MSP)"; entity.DisplayOrder = 10; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Project/My_Scrum_Project_(MSP)"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem3.MenuItemId; entity.Title = "Separated link"; entity.DisplayOrder = 11; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Project/My_Scrum_Project_(MSP)"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); //-------------------------------------------------------------------------- //Recent Projects entity = new MenuItem(); entity.ParentId = MenuItem3.MenuItemId; entity.Title = "Recent Projects"; entity.DisplayOrder = 12; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "#"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem3.MenuItemId; entity.Title = "IRKD (IRKD)"; entity.DisplayOrder = 20; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Project/IRKD_(IRKD)"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem3.MenuItemId; entity.Title = "Pomodoro Web Client (PWC)"; entity.DisplayOrder = 20; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Project/Pomodoro_Web_Client_(PWC)"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem3.MenuItemId; entity.Title = "Separated link"; entity.DisplayOrder = 21; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Project/Pomodoro_Web_Client_(PWC)"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); //-------------------------------------------------------------------------- entity = new MenuItem(); entity.ParentId = MenuItem3.MenuItemId; entity.Title = "View All Projects"; entity.DisplayOrder = 30; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Project/Index"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); //-------------------------------------------------------------------------- entity = new MenuItem(); entity.ParentId = MenuItem3.MenuItemId; entity.Title = "Separated link"; entity.DisplayOrder = 31; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Project/Index"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem3.MenuItemId; entity.Title = "Import External Project"; entity.DisplayOrder = 40; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Project/Import_External_Project"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem3.MenuItemId; entity.Title = "Create Project"; entity.DisplayOrder = 50; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Project/Create"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); // Submenus for MenuItemId=4 var MenuItem4 = context.MenuItems.Where(m => m.Title == "Issues").FirstOrDefault(); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Current Filter"; entity.DisplayOrder = 1; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "#"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "IRKD Planning (30 Issues)"; entity.DisplayOrder = 10; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/IRKD_Planning_(30 Issues)"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); //---------------------------------------------------------------------------------- entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Separated link"; entity.DisplayOrder = 11; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/IRKD_Planning_(30 Issues)"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Search for Issues"; entity.DisplayOrder = 20; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/Search_for_Issues"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Create Issue"; entity.DisplayOrder = 30; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/Create"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); //-------------------------------------------------------------------------- Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Separated link"; entity.DisplayOrder = 31; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/Create"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); //Recent Issues entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Recent Issues "; entity.DisplayOrder = 32; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "#"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "IRKD-5 As a user, I would like"; entity.DisplayOrder = 40; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/IRKD-5_As_a_user_I_would_like"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Separated link"; entity.DisplayOrder = 41; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/IRKD-5_As_a_user_I_would_like"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); //-------------------------------------------------------------------------- //Filters entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Filters"; entity.DisplayOrder = 42; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "#"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "My Open Issues"; entity.DisplayOrder = 50; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/My_Open_Issues"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Reported by Me"; entity.DisplayOrder = 60; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/Reported_by_Me"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "2.0 Tirage"; entity.DisplayOrder = 70; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/2.0_Tirage"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "High priority work"; entity.DisplayOrder = 80; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/High_priority_work"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "IRKD Planning"; entity.DisplayOrder = 90; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/IRKD_Planning"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Recent Created Bug"; entity.DisplayOrder = 100; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/Recent_Created_Bugss"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); //---------------------------------------------------------------------- entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Separated link"; entity.DisplayOrder = 101; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/Recent_Created_Bugss"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Manger Filters"; entity.DisplayOrder = 110; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/Manger_Filters"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); // Submenus for MenuItemId=5 var MenuItem5 = context.MenuItems.Where(m => m.Title == "Agile").FirstOrDefault(); //Recent Boards entity = new MenuItem(); entity.ParentId = MenuItem5.MenuItemId; entity.Title = "Recent Boards"; entity.DisplayOrder = 1; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "#"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem5.MenuItemId; entity.Title = "My Scrum Project"; entity.DisplayOrder = 10; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Agile/My_Scrum_Project"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem5.MenuItemId; entity.Title = "IRKD"; entity.DisplayOrder = 20; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Agile/IRKD"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem5.MenuItemId; entity.Title = "IRKD Planning"; entity.DisplayOrder = 30; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Agile/IRKD_Planning"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem5.MenuItemId; entity.Title = "2.0 Triage"; entity.DisplayOrder = 40; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Agile/2.0_Triage"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); entity = new MenuItem(); entity.ParentId = MenuItem5.MenuItemId; entity.Title = "more..."; entity.DisplayOrder = 50; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Agile/more"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem5.MenuItemId; entity.Title = "Separated link"; entity.DisplayOrder = 51; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Agile/more"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); //-------------------------------------------------------------------------- entity = new MenuItem(); entity.ParentId = MenuItem5.MenuItemId; entity.Title = "Mange Boards"; entity.DisplayOrder = 60; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Agile/Mange_Boards"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem5.MenuItemId; entity.Title = "Getting Started"; entity.DisplayOrder = 70; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Agile/Getting_Started"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem5.MenuItemId; entity.Title = "Separated link"; entity.DisplayOrder = 80; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Agile/Getting_Started"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); //-------------------------------------------------------------------------- entity = new MenuItem(); entity.ParentId = MenuItem5.MenuItemId; entity.Title = "Classic..."; entity.DisplayOrder = 90; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Agile/Classic"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); } catch (Exception eCreateMenuItem) { throw eCreateMenuItem; } }
private void CreateChild(SJiraContext context) { //var MenuManager1 = context.MenuManagers.Where(c => c.Title == "Principal").FirstOrDefault(); MenuItem entity = new MenuItem(); var Menus = new List<MenuItem>(); entity.Title = "Home"; entity.DisplayOrder = 10; entity.MenuAction = "/Home/Home"; //entity.MenuManagerId = MenuManager1.MenuManagerId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Maintenance"; entity.MenuAction = "/Maintenance/Maintenance"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 20; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Reports"; entity.MenuAction = "/Reports/Reports"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 30; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Lookup"; entity.MenuAction = "/Lookup/Lookup"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 30; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); // Submenu for MenuItemId=2 var Parent = context.MenuItems.Where(m => m.Title == "Maintenance").FirstOrDefault(); entity = new MenuItem(); entity.ParentId = Parent.MenuItemId; entity.Title = "Users"; entity.DisplayOrder = 10; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Maintenance/Users"; Menus.Add(entity); //Menus.Find(m => m.Title == "Maintenance").Menus.Add(entity); entity = new MenuItem(); entity.ParentId = Parent.MenuItemId; entity.Title = "Roles"; entity.DisplayOrder = 20; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Maintenance/Roles"; //Menus.Find(m => m.Title == "Maintenance").Menus.Add(entity); Menus.Add(entity); // Submenus for MenuItemId=3 var MenuItem3 = context.MenuItems.Where(m => m.Title == "Reports").FirstOrDefault(); entity = new MenuItem(); entity.ParentId = MenuItem3.MenuItemId; entity.Title = "Report 1"; entity.DisplayOrder = 10; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Reports/Report1"; //Menus.Find(m => m.Title == "Reports").Menus.Add(entity); Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem3.MenuItemId; entity.Title = "Report 2"; entity.DisplayOrder = 20; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Reports/Report2"; //Menus.Find(m => m.Title == "Reports").Menus.Add(entity); Menus.Add(entity); // Submenus for MenuItemId=4 var MenuItem4 = context.MenuItems.Where(m => m.Title == "Lookup").FirstOrDefault(); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Logs"; entity.DisplayOrder = 10; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Lookup/Logs"; //Menus.Find(m => m.Title == "Lookup").Menus.Add(entity); Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Resources"; entity.DisplayOrder = 20; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Lookup/Resources"; //Menus.Find(m => m.Title == "Lookup").Menus.Add(entity); Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Lookup Tables"; entity.DisplayOrder = 30; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Lookup/LookupTables"; //Menus.Find(m => m.Title == "Lookup").Menus.Add(entity); Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title }, Menus.ToArray()); context.SaveChanges(); }
//private void CreateMenuManagers_Configure(SJiraContext context) //{ // var MenuItemConfigure = context.MenuItems.Where(c => c.Title == "Configure").FirstOrDefault(); // var MenuManagerTypeTabs = context.MenuManagerTypes.Where(c => c.Name == "Tabs").FirstOrDefault(); // var Menus = new List<MenuManager>(); // MenuManager entity = new MenuManager(); // entity.MenuItemId = MenuItemConfigure.MenuItemId; // entity.Title = "Configure"; // entity.MenuManagerTypeId = MenuManagerTypeTabs.MenuManagerTypeId; // Menus.Add(entity); // context.MenuManagers.AddOrUpdate(c => new { c.Title, c.MenuManagerTypeId }, Menus.ToArray()); context.SaveChanges(); //} private void CreateMenuItems_Configure_Tabs(SJiraContext context) { //var MenuManager1 = context.MenuManagers.Where(c => c.Title == "Configure" && c.MenuManagerType.Name == "Tabs").FirstOrDefault(); var MenuitemTypeButton = context.MenuItemTypes.Where(c => c.Name == "Button").FirstOrDefault(); var MenuitemTypeLink = context.MenuItemTypes.Where(c => c.Name == "Link").FirstOrDefault(); var MenuitemTypeDropdown = context.MenuItemTypes.Where(c => c.Name == "Dropdown").FirstOrDefault(); var MenuitemTypeInput = context.MenuItemTypes.Where(c => c.Name == "Input").FirstOrDefault(); MenuItem entity = new MenuItem(); var Menus = new List<MenuItem>(); entity.Title = "Filter"; entity.MenuAction = "/Configure/Filter"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 10; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Columns"; entity.MenuAction = "/Configure/Columns"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 20; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Swimlanes"; entity.DisplayOrder = 21; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Configure/Swimlanes"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Quick Filters"; entity.MenuAction = "/Configure/Quick_Filters"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 30; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Card Colours"; entity.MenuAction = "/Configure/Card_Colours"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 40; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Estimation"; entity.MenuAction = "/Configure/Estimation"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 50; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Working Days"; entity.MenuAction = "/Configure/Working_Days"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 60; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Issue Detail View"; entity.MenuAction = "/Configure/Issue_Detail_View"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 70; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); //context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuManagerId }, Menus.ToArray()); context.SaveChanges(); }
private void CreateDashboardMenuItems(SJiraContext context) { var MenuitemTypeButton = context.MenuItemTypes.Where(c => c.Name == "Button").FirstOrDefault(); var MenuitemTypeLink = context.MenuItemTypes.Where(c => c.Name == "Link").FirstOrDefault(); var MenuitemTypeDropdown = context.MenuItemTypes.Where(c => c.Name == "Dropdown").FirstOrDefault(); var MenuitemTypeInput = context.MenuItemTypes.Where(c => c.Name == "Input").FirstOrDefault(); var Menus = new List<MenuItem>(); MenuItem entity = new MenuItem(); entity.Title = "Add Gadget"; entity.MenuAction = "/Dashboard/Search"; entity.DisplayOrder = 10; entity.MenuIcon = @"<i class=""fa fa-plus""></i>"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Edit Layout"; entity.MenuAction = "/Dashboard/Search"; entity.DisplayOrder = 10; entity.MenuIcon = @"<i class=""fa fa-pencil""></i>"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Tools"; entity.MenuAction = "/Dashboard/Search"; entity.DisplayOrder = 10; entity.MenuIcon = @"<i class=""fa a-gear fa-cog""></i>"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); //80 NULL Add Gadget 10 /Dashboard/Search <i class="fa fa-plus"></i> NULL //81 NULL Edit Layout 20 /Dashboard/Search <i class="fa fa-pencil"></i> NULL //82 NULL Tools 30 /Dashboard/Search <i class="fa a-gear fa-cog"></i> NULL context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); var MenuitemTools = context.MenuItems.Where(c => c.Title == "Tools" && c.MenuAction == "/Dashboard/Search").FirstOrDefault(); var MenuitemEditLayout = context.MenuItems.Where(c => c.Title == "Edit Layout" && c.MenuAction == "/Dashboard/Search").FirstOrDefault(); var MenuitemAddGadget = context.MenuItems.Where(c => c.Title == "Add Gadget" && c.MenuAction == "/Dashboard/Search").FirstOrDefault(); //var DashboardSystemDashboard = context.Dashboards.Where(c => c.Name == "System Dashboard").FirstOrDefault(); //var DashboardJIRAJuniorDasboard = context.Dashboards.Where(c => c.Name == "JIRA Junior Dasboard").FirstOrDefault(); //var DashboardTheQuirkyIRKDDashboard = context.Dashboards.Where(c => c.Name == "The Quirky IRKD Dashboard").FirstOrDefault(); var Menus1 = new List<DashboardMenuItem>(); foreach (Dashboard dashboard in context.Dashboards) { if (dashboard.DashboardType.Name != "One") { DashboardMenuItem entity1 = new DashboardMenuItem(); entity1.MenuItemId = MenuitemAddGadget.MenuItemId; entity1.DashboardId = dashboard.DashboardId; entity1.DisplayOrder = 10; Menus1.Add(entity1); entity1 = new DashboardMenuItem(); entity1.MenuItemId = MenuitemEditLayout.MenuItemId; entity1.DashboardId = dashboard.DashboardId; entity1.DisplayOrder = 20; Menus1.Add(entity1); entity1 = new DashboardMenuItem(); entity1.MenuItemId = MenuitemTools.MenuItemId; entity1.DashboardId = dashboard.DashboardId; entity1.DisplayOrder = 30; Menus1.Add(entity1); } else if (dashboard.DashboardType.Name == "One") { DashboardMenuItem entity1 = new DashboardMenuItem(); entity1.MenuItemId = MenuitemTools.MenuItemId; entity1.DashboardId = dashboard.DashboardId; entity1.DisplayOrder = 10; Menus1.Add(entity1); } } context.DashboardMenuItems.AddOrUpdate(c => new { c.MenuItemId, c.DashboardId }, Menus1.ToArray()); context.SaveChanges(); //DashboardMenuItem entity1 = new DashboardMenuItem(); //entity1.MenuItemId = MenuitemTools.MenuItemId; //entity1.DashboardId = DashboardSystemDashboard.DashboardId; //entity1.DisplayOrder = 10; //Menus1.Add(entity1); //entity1 = new DashboardMenuItem(); //entity1.MenuItemId = MenuitemEditLayout.MenuItemId; //entity1.DashboardId = DashboardJIRAJuniorDasboard.DashboardId; //entity1.DisplayOrder = 10; //Menus1.Add(entity1); //entity1 = new DashboardMenuItem(); //entity1.MenuItemId = MenuitemAddGadget.MenuItemId; //entity1.DashboardId = DashboardJIRAJuniorDasboard.DashboardId; //entity1.DisplayOrder = 20; //Menus1.Add(entity1); //entity1 = new DashboardMenuItem(); //entity1.MenuItemId = MenuitemTools.MenuItemId; //entity1.DashboardId = DashboardJIRAJuniorDasboard.DashboardId; //entity1.DisplayOrder = 30; //Menus1.Add(entity1); //context.DashboardMenuItems.AddOrUpdate(c => new { c.MenuItemId, c.DashboardId }, Menus1.ToArray()); context.SaveChanges(); }
private void CreateMenuItems_My_Open_Issues_ToolBar(SJiraContext context) { var MenuitemTypeButton = context.MenuItemTypes.Where(c => c.Name == "Button").FirstOrDefault(); var MenuitemTypeLink = context.MenuItemTypes.Where(c => c.Name == "Link").FirstOrDefault(); var MenuitemTypeDropdown = context.MenuItemTypes.Where(c => c.Name == "Dropdown").FirstOrDefault(); var MenuitemTypeInput = context.MenuItemTypes.Where(c => c.Name == "Input").FirstOrDefault(); //var MenuManager1 = context.MenuManagers.Where(c => c.Title == "My Open Issues" && c.MenuManagerType.Name == "ToolBar").FirstOrDefault(); MenuItem entity = new MenuItem(); var Menus = new List<MenuItem>(); entity.Title = "New Filter"; entity.MenuAction = "/Issue/New_Filter"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 10; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Type"; entity.MenuAction = "/Issue/Type"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 20; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); //------------------------------------------------------------------ entity = new MenuItem(); entity.Title = "Status"; entity.MenuAction = "/Issue/Status"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 30; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Assignee"; entity.MenuAction = "/Issue/Assigneee"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 40; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Contains Text"; entity.MenuAction = "/Issue/Contains_Text"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 50; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "More"; entity.MenuAction = "/Issue/More"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 60; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); //--------------------------------------------------------------------------- entity = new MenuItem(); entity.Title = "Advanced"; entity.MenuAction = "/Issue/Advanced"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 70; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "List_Detail"; entity.MenuAction = "/Issue/List_Detail"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 80; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); //context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuManagerId }, Menus.ToArray()); context.SaveChanges(); }
//private void CreateMenuManagers_My_Open_Issues(SJiraContext context) //{ // var MenuItemMyOpenIssues= context.MenuItems.Where(c => c.Title == "My Open Issues").FirstOrDefault(); // var MenuManagerTypeSideBar = context.MenuManagerTypes.Where(c => c.Name == "SideBar").FirstOrDefault(); // var MenuManagerTypeToolBar = context.MenuManagerTypes.Where(c => c.Name == "ToolBar").FirstOrDefault(); // var Menus = new List<MenuManager>(); // MenuManager entity = new MenuManager(); // entity.MenuItemId = MenuItemMyOpenIssues.MenuItemId; // entity.Title = "My Open Issues"; // entity.MenuManagerTypeId = MenuManagerTypeSideBar.MenuManagerTypeId; // Menus.Add(entity); // entity = new MenuManager(); // entity.MenuItemId = MenuItemMyOpenIssues.MenuItemId; // entity.Title = "My Open Issues"; // entity.MenuManagerTypeId = MenuManagerTypeToolBar.MenuManagerTypeId; // Menus.Add(entity); // context.MenuManagers.AddOrUpdate(c => new { c.Title, c.MenuManagerTypeId }, Menus.ToArray()); context.SaveChanges(); //} private void CreateMenuItems_My_Open_Issues_SideBar(SJiraContext context) { //var MenuManager1 = context.MenuManagers.Where(c => c.Title == "My Open Issues" && c.MenuManagerType.Name == "SideBar").FirstOrDefault(); var MenuitemTypeButton = context.MenuItemTypes.Where(c => c.Name == "Button").FirstOrDefault(); var MenuitemTypeLink = context.MenuItemTypes.Where(c => c.Name == "Link").FirstOrDefault(); var MenuitemTypeDropdown = context.MenuItemTypes.Where(c => c.Name == "Dropdown").FirstOrDefault(); var MenuitemTypeInput = context.MenuItemTypes.Where(c => c.Name == "Input").FirstOrDefault(); MenuItem entity = new MenuItem(); var Menus = new List<MenuItem>(); entity.Title = "New Filter"; entity.MenuAction = "/Issue/New_Filter"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 10; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Find filters"; entity.MenuAction = "/Issue/Find_filters"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 20; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); //------------------------------------------------------------------ //-------------------------------------------------------------------------- entity = new MenuItem(); entity.Title = "Separated link"; entity.DisplayOrder = 21; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/Find_filters"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "My Open Issues"; entity.MenuAction = "/Issue/My_Open_Issues"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 30; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Reported by Me"; entity.MenuAction = "/Issue/Reported_by_Me"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 40; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Recently Viewed"; entity.MenuAction = "/Issue/Recently_Viewed"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 50; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "All Issues"; entity.MenuAction = "/Issue/All_Issues"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 60; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); //--------------------------------------------------------------------------- entity = new MenuItem(); entity.Title = "Separated link"; entity.DisplayOrder = 61; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Issue/All_Issues"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "FAVORITE FILTERS"; entity.DisplayOrder = 62; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "#"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "2.0 Triage"; entity.MenuAction = "/Issue/2.0_Triage"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 70; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "High priority work"; entity.MenuAction = "/Issue/High_priority_work"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 80; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "IRDK Planning"; entity.MenuAction = "/Issue/IRDK_Planning"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 90; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Recently Created Bugs"; entity.MenuAction = "/Issue/Recently_Created_Bugs"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 100; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); //context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuManagerId }, Menus.ToArray()); context.SaveChanges(); }
private void CreateMenuItems_Home_Secondary(SJiraContext context) { try { var MenuitemTypeButton = context.MenuItemTypes.Where(c => c.Name == "Button").FirstOrDefault(); var MenuitemTypeLink = context.MenuItemTypes.Where(c => c.Name == "Link").FirstOrDefault(); var MenuitemTypeDropdown = context.MenuItemTypes.Where(c => c.Name == "Dropdown").FirstOrDefault(); var MenuitemTypeInput = context.MenuItemTypes.Where(c => c.Name == "Input").FirstOrDefault(); //var MenuManager1 = context.MenuManagers.Where(c => c.Title == "Home SideBar" && c.MenuManagerType.Name == "Secondary").FirstOrDefault(); MenuItem entity = new MenuItem(); var Menus = new List<MenuItem>(); entity.Title = "Paln"; entity.DisplayOrder = 10; entity.MenuAction = "/Plan/Index"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Work"; entity.MenuAction = "/Work/Work"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 20; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Report"; entity.MenuAction = "/Report/Report"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 30; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.Title = "Tools"; entity.MenuAction = "/Tools/Tools"; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.DisplayOrder = 30; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); //context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuManagerId }, Menus.ToArray()); context.SaveChanges(); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); Menus = new List<MenuItem>(); // Submenu for MenuItemId=2 var MenuItem4 = context.MenuItems.Where(m => m.Title == "Tools").FirstOrDefault(); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Configure"; entity.DisplayOrder = 10; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Tools/Configure"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Copy"; entity.DisplayOrder = 30; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Tools/Copy"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Delete"; entity.DisplayOrder = 10; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Tools/Delete"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Create Board"; entity.DisplayOrder = 20; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Tools/Create_Board"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); entity = new MenuItem(); entity.ParentId = MenuItem4.MenuItemId; entity.Title = "Show Epic Panel"; entity.DisplayOrder = 20; //entity.MenuManagerId = MenuManager1.MenuManagerId; entity.MenuAction = "/Tools/Show_Epic_Panel"; entity.MenuItemTypeId = MenuitemTypeLink.MenuItemTypeId; Menus.Add(entity); context.MenuItems.AddOrUpdate(c => new { c.Title, c.MenuAction }, Menus.ToArray()); context.SaveChanges(); } catch (Exception eCreateMenuItem) { throw eCreateMenuItem; } }