コード例 #1
0
        private static void CreateNewspaperNavigation(NavigationViewModel navigation, Entities.Entity entity, UrlHelper urlHelper)
        {
            NavigationSectionViewModel newspaperSection = new NavigationSectionViewModel()
            {
                Name = "Newspaper"
            };


            newspaperSection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Profile",
                Url  = urlHelper.Action("View", "Newspaper", new { newspaperID = entity.EntityID })
            });

            newspaperSection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Create article",
                Url  = urlHelper.Action("WriteArticle", "Newspaper", new { newspaperID = entity.EntityID })
            });

            newspaperSection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Manage articles",
                Url  = urlHelper.Action("ManageArticles", "Newspaper", new { newspaperID = entity.EntityID })
            });

            newspaperSection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Manage journalists",
                Url  = urlHelper.Action("ManageJournalists", "Newspaper", new { newspaperID = entity.EntityID })
            });

            navigation.MainSections.Add(newspaperSection);
        }
コード例 #2
0
        private static void CreatePartyNavigation(NavigationViewModel navigation, Entities.Entity entity, UrlHelper urlHelper)
        {
            NavigationSectionViewModel partySection = new NavigationSectionViewModel()
            {
                Name = "Party"
            };

            var party = entity.Party;

            partySection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Messages",
                Url  = urlHelper.Action("Index", "Message")
            });

            partySection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Profile",
                Url  = urlHelper.Action("View", "Party", new { partyID = party.ID })
            });

            partySection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Newspapers",
                Url  = urlHelper.Action("Index", "Newspaper")
            });

            navigation.MainSections.Add(partySection);
        }
コード例 #3
0
        private static void addOtherSection(NavigationViewModel vm, UrlHelper urlHelper)
        {
            NavigationSectionViewModel other = new NavigationSectionViewModel()
            {
                Name = "Other"
            };

            other.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Dev issues",
                Url  = urlHelper.Action("Index", "DevIssue")
            });

            other.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Change password",
                Url  = urlHelper.Action("ChangePassword", "Account")
            });


            var calcs = new NavigationSectionViewModel()
            {
                Name = "Calculators"
            };

            calcs.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Fuel cost calculator",
                Url  = urlHelper.Action(nameof(CalculatorController.CalculateFuelCost), "Calculator")
            });

            calcs.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Production points calculator",
                Url  = urlHelper.Action(nameof(CalculatorController.CalculateProductionPoints), "Calculator")
            });

            other.Children.Add(calcs);

            other.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Sociatis Wiki",
                Url  = "http://wikisociatis.zzz.com.ua/wiki/"
            });

            other.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Logout",
                Url  = urlHelper.Action("Logout", "Account")
            });

            vm.MainSections.Add(other);
        }
コード例 #4
0
        private static void CreateCompanyNavigation(NavigationViewModel navigation, Entity entity, UrlHelper urlHelper)
        {
            NavigationSectionViewModel companySection = new NavigationSectionViewModel()
            {
                Name = "Company"
            };

            var company        = entity.Company;
            var companyService = DependencyResolver.Current.GetService <ICompanyService>();

            var rights = companyService.GetCompanyRights(company, entity, SessionHelper.LoggedCitizen);

            companySection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Profile",
                Url  = urlHelper.Action("View", "Company", new { companyID = company.ID })
            });

            if (rights.CanManageEquipment)
            {
                companySection.Children.Add(new NavigationSectionViewModel()
                {
                    Name = "Inventory",
                    Url  = urlHelper.Action("Inventory", "Company", new { companyID = company.ID })
                });
            }

            companySection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Messages",
                Url  = urlHelper.Action("Index", "Message")
            });

            companySection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Newspapers",
                Url  = urlHelper.Action("Index", "Newspaper")
            });

            if (rights.CanSeeWallet)
            {
                companySection.Children.Add(new NavigationSectionViewModel()
                {
                    Name = "Wallet",
                    Url  = urlHelper.Action("Wallet", "Company", new { companyID = company.ID })
                });
            }

            navigation.MainSections.Add(companySection);
        }
コード例 #5
0
        private static void addAdminSection(NavigationViewModel vm, UrlHelper urlHelper)
        {
            NavigationSectionViewModel admin = new NavigationSectionViewModel()
            {
                Name = "Admin"
            };

            admin.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Edit map",
                Url  = urlHelper.Action("Edit", "Map")
            });

            admin.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Edit country colors",
                Url  = urlHelper.Action(nameof(AdminController.EditCountryColors), "Admin")
            });

            var debug = new NavigationSectionViewModel()
            {
                Name = "Debug"
            };

            admin.Children.Add(debug);

            debug.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Assign as Congressman",
                Url  = urlHelper.Action("GiveMeCongressman", "Debug")
            });

            debug.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Assign as President",
                Url  = urlHelper.Action("GrantMePresident", "Debug")
            });

            debug.Children.Add(new NavigationSectionViewModel()
            {
                Name = "End congress voting",
                Url  = urlHelper.Action("FinishCongressVoting", "Debug")
            });

            vm.MainSections.Add(admin);
        }
コード例 #6
0
        private static void createBusinessSection(NavigationViewModel navigation, UrlHelper urlHelper, bool createCompanies, bool createOrganisations, bool createNewspapers)
        {
            var buss = new NavigationSectionViewModel()
            {
                Name = "Business"
            };

            if (createCompanies)
            {
                buss.Children.Add(new NavigationSectionViewModel()
                {
                    Name = "Businesses",
                    Url  = urlHelper.Action("Index", "Business")
                });
            }

            /*   if (createOrganisations)
             *     buss.Children.Add(new NavigationSectionViewModel()
             *     {
             *         Name = "Organisations",
             *         Url = urlHelper.Action("Index", "Organisation")
             *     });*/

            if (createNewspapers)
            {
                buss.Children.Add(new NavigationSectionViewModel()
                {
                    Name = "Newspapers",
                    Url  = urlHelper.Action("Index", "Newspaper")
                });
            }

            buss.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Monetary Market",
                Url  = urlHelper.Action("Index", "MonetaryMarket")
            });

            navigation.MainSections.Add(buss);
        }
コード例 #7
0
        private static void CreateOrganisationNavigation(NavigationViewModel navigation, Entity entity, UrlHelper urlHelper)
        {
            NavigationSectionViewModel organisationSection = new NavigationSectionViewModel()
            {
                Name = "Organisation"
            };

            organisationSection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Profile",
                Url  = urlHelper.Action("View", "Organisation", new { newspaperID = entity.EntityID })
            });

            organisationSection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Wallet",
                Url  = urlHelper.Action("Wallet", "Organisation", new { newspaperID = entity.EntityID })
            });

            navigation.MainSections.Add(organisationSection);

            createBusinessSection(navigation, urlHelper, createCompanies: true, createOrganisations: false, createNewspapers: true);
        }
コード例 #8
0
        private static void CreateCitizenNavigation(NavigationViewModel navigation, Entities.Entity entity, UrlHelper urlHelper)
        {
            NavigationSectionViewModel citizenSection = new NavigationSectionViewModel()
            {
                Name = "Citizen"
            };

            var citizen = entity.Citizen;

            var hotel = citizen.HotelRooms.Where(r => r.Hotel.RegionID == citizen.RegionID).Select(r => r.Hotel).FirstOrDefault();


            citizenSection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Profile",
                Url  = urlHelper.Action("View", "Citizen", new { citizenID = citizen.ID })
            });

            var house = citizen.GetCurrentlyLivingHouse();

            if (house != null)
            {
                citizenSection.Children.Add(new NavigationSectionViewModel()
                {
                    Name = "Current house",
                    Url  = urlHelper.Action("View", "House", new { houseID = house.ID })
                });
            }

            if (house != null || citizen.Houses.Any())
            {
                citizenSection.Children.Add(new NavigationSectionViewModel()
                {
                    Name = "Your houses",
                    Url  = urlHelper.Action("Index", "House")
                });
            }

            citizenSection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Messages",
                Url  = urlHelper.Action("Index", "Message")
            });

            citizenSection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Inventory",
                Url  = urlHelper.Action("Inventory", "Citizen", new { ID = citizen.ID })
            });

            citizenSection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Training",
                Url  = urlHelper.Action("Index", "Training")
            });

            citizenSection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Travel",
                Url  = urlHelper.Action("Travel", "Citizen")
            });



            if (citizen.CompanyEmployee != null)
            {
                var companyID = citizen.CompanyEmployee.CompanyID;

                citizenSection.Children.Add(new NavigationSectionViewModel()
                {
                    Name = "Job",
                    Url  = urlHelper.Action("View", "Company", new { companyID = companyID })
                });
            }

            if (citizen.PartyMember != null)
            {
                var partyID = citizen.PartyMember.PartyID;

                citizenSection.Children.Add(new NavigationSectionViewModel()
                {
                    Name = "Party",
                    Url  = urlHelper.Action("View", "Party", new { PartyID = partyID })
                });
            }
            else
            {
                int?countryID = citizen.Region.CountryID;
                if (countryID.HasValue)
                {
                    citizenSection.Children.Add(new NavigationSectionViewModel()
                    {
                        Name = "Parties",
                        Url  = urlHelper.Action("Parties", "Party", new { countryID = countryID })
                    });
                }
            }

            citizenSection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Wallet",
                Url  = urlHelper.Action("Wallet", "Citizen")
            });

            if (hotel != null)
            {
                citizenSection.Children.Add(new NavigationSectionViewModel()
                {
                    Name = $"Staying at {hotel.Entity.Name}",
                    Url  = urlHelper.Action("View", "Hotel", new { hotelID = hotel.ID })
                });
            }



            navigation.MainSections.Add(citizenSection);

            createBusinessSection(navigation, urlHelper, createCompanies: true, createOrganisations: true, createNewspapers: true);
        }