public void GetSecondInstanceTest() { LocationsManager myLocations = LocationsManager.GetInstance(); Assert.IsNotNull(myLocations, "locations Manager Object is set to a null reference"); Assert.AreEqual(myLocations, LocationsManager.GetInstance(), "the objects be identical"); }
public void TestDeleteCity() { LocationsManager _locationManager = (LocationsManager)container["LocationsManager"]; Province province = new Province("France"); province.Id = _locationManager.AddProvince(province.Name); Assert.AreNotEqual(0, province.Id); District district = new District("Ile de France", province); district.Id = _locationManager.AddDistrict(district); Assert.AreNotEqual(0, district.Id); City city = new City { Name = "Paris", DistrictId = district.Id }; city.Id = _locationManager.AddCity(city); Assert.IsTrue(city.Id > 0); List <City> cities = _locationManager.GetCities(); Assert.AreEqual(1, cities.Count); _locationManager.DeleteCityById(city.Id); cities = _locationManager.GetCities(); Assert.AreEqual(0, cities.Count); }
public void TestUpdateCity() { LocationsManager _locationManager = (LocationsManager)container["LocationsManager"]; Province province = new Province("France"); province.Id = _locationManager.AddProvince(province.Name); Assert.AreNotEqual(0, province.Id); District district = new District("Ile de France", province); district.Id = _locationManager.AddDistrict(district); Assert.AreNotEqual(0, district.Id); City city = new City { Name = "Paris", DistrictId = district.Id }; city.Id = _locationManager.AddCity(city); city.Name = "qsd"; _locationManager.UpdateCity(city); List <City> cities = _locationManager.GetCities(); Assert.AreEqual("qsd", cities[0].Name); }
public void TestUpdateDistrict() { LocationsManager _locationManager = (LocationsManager)container["LocationsManager"]; Province province = new Province("France"); province.Id = _locationManager.AddProvince(province.Name); Assert.AreNotEqual(0, province.Id); List <District> districts = _locationManager.GetDistricts(); Assert.AreEqual(2, districts.Count); Assert.AreEqual("NANCY", districts[0].Name); Assert.AreEqual(2, districts[0].Id); Assert.AreEqual("PARIS", districts[1].Name); Assert.AreEqual(1, districts[1].Id); districts[0].Name = "china"; _locationManager.UpdateDistrict(districts[0]); districts = _locationManager.GetDistricts(); districts.Sort(new DistrictComparer()); Assert.AreEqual(2, districts.Count); Assert.AreEqual("china", districts[0].Name); Assert.AreEqual(2, districts[0].Id); Assert.AreEqual("PARIS", districts[1].Name); Assert.AreEqual(1, districts[1].Id); }
public void Awake() { Assert.IsNotNull(camp, "Missing camp"); Assert.IsNotNull(frozenThrone, "Missing frozenThrone"); Assert.IsNotNull(catacombs, "Missing catacombs"); Assert.IsNotNull(hell, "Missing hell"); Assert.IsNotNull(camera, "Missing camera"); instance = this; }
public void AddProvince() { LocationsManager _locationManager = (LocationsManager)container["LocationsManager"]; Province province = new Province("France"); province.Id = _locationManager.AddProvince(province.Name); Assert.AreNotEqual(0, province.Id); }
public ActionResult FullForm(FullFormVM model) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; if (!ModelState.IsValid) { model.States = LocationsManager.GetStates(); return(View(model)); } int ncid = GetNcId(); int visitId = GetVisitId(); CustomerDT customer = new CustomerDT(); customer.SiteId = model.SiteId; customer.NcId = ncid; customer.Email = model.Email; customer.FirstName = model.FirstName; customer.LastName = model.LastName; customer.Address = model.Address; customer.City = model.City; customer.StateId = model.StateId; customer.ZipCode = model.ZipCode; CreditCardDT cc = new CreditCardDT(); cc.CardNumber = model.CardNumber; cc.CVV = model.CVV; cc.ExpDate = CreditCardHelper.GetExpDate(model.ExpMonth, model.ExpYear); CCType cardType = CCType.VISA; Enum.TryParse(model.CardType.ToString(), out cardType); cc.Type = cardType; var referrer = ReferrersManagers.GetReferrer(model.Referrer); try { customer = CustomersManager.NewCustomer(((SiteDT)ViewBag.Site), customer, cc, visitId, referrer.Id, false); } catch (Exception ex) { SendExceptionEmail(ex.ToString()); CastleClub.BusinessLogic.Utils.EventViewer.Writte("CastleClub", "CastleClubFrontend", ex.Message + "\n" + ex.ToString(), System.Diagnostics.EventLogEntryType.Error); } if (customer != null) { ViewBag.Customer = customer; } else { return(View("Error")); } return(View("Welcome")); }
public ClientManager(string pTestDb) : base(pTestDb) { _doam = new EconomicActivityManager(pTestDb); _locations = new LocationsManager(pTestDb); _projectManager = new ProjectManager(pTestDb); _savingManager = new SavingManager(pTestDb); _userManager = new UserManager(pTestDb); }
public ClientManager(User pUser, bool pInitializeProject, bool pInitializeSavings) : base(pUser) { _doam = new EconomicActivityManager(pUser); _locations = new LocationsManager(pUser); if (pInitializeProject) _projectManager = new ProjectManager(pUser, true); if (pInitializeSavings) _savingManager = new SavingManager(pUser); _userManager = new UserManager(pUser); }
public void TestGetDistrictsWithoutResult() { DynamicMock dynamicMock = new DynamicMock(typeof(LocationsManager)); dynamicMock.SetReturnValue("GetDistricts", new List <District>()); LocationsManager locationsManager = (LocationsManager)dynamicMock.MockInstance; LocationServices locationServices = new LocationServices(locationsManager); Assert.AreEqual(0, locationServices.GetDistricts().Count); }
public void InitManager() { TechnicalSettings.CheckSettings(); LoanProductManager loanProductManager = new LoanProductManager(DataUtil.TESTDB); AccountingTransactionManager accountingTransactionManager = new AccountingTransactionManager(DataUtil.TESTDB); EventManager eventManager = new EventManager(DataUtil.TESTDB); ExchangeRateManager exchangeRateManager = new ExchangeRateManager(DataUtil.TESTDB); ProvisioningRuleManager provisioningRuleManager = new ProvisioningRuleManager(DataUtil.TESTDB); AccountManager accountManager = new AccountManager(DataUtil.TESTDB); InstallmentTypeManager installmentTypeManager = new InstallmentTypeManager(DataUtil.TESTDB); UserManager userManager = new UserManager(DataUtil.TESTDB); EconomicActivityManager economicActivityManager = new EconomicActivityManager(DataUtil.TESTDB); InstallmentManager installmentManager = new InstallmentManager(DataUtil.TESTDB); FundingLineManager fundingLineManager = new FundingLineManager(DataUtil.TESTDB); ClientManager clientManager = new ClientManager(DataUtil.TESTDB); LocationsManager locationsManager = new LocationsManager(DataUtil.TESTDB); LoanManager loanManager = new LoanManager(DataUtil.TESTDB); ProjectManager projectManager = new ProjectManager(DataUtil.TESTDB); MFIManager mfiManager = new MFIManager(DataUtil.TESTDB); SavingManager savingManager = new SavingManager(DataUtil.TESTDB); SavingProductManager savingProductManager = new SavingProductManager(DataUtil.TESTDB); SavingEventManager savingEventManager = new SavingEventManager(DataUtil.TESTDB); CurrencyManager currencyManager = new CurrencyManager(DataUtil.TESTDB); AccountingRuleManager accountingRuleManager = new AccountingRuleManager(DataUtil.TESTDB); FundingLineServices fundingLineServices = new FundingLineServices(DataUtil.TESTDB); container = new Hashtable { { "LoanProductManager", loanProductManager }, { "AccountingTransactionManager", accountingTransactionManager }, { "EventManager", eventManager }, { "ExchangeRateManager", exchangeRateManager }, { "ProvisioningRuleManager", provisioningRuleManager }, { "AccountManager", accountManager }, { "InstallmentTypeManager", installmentTypeManager }, { "UserManager", userManager }, { "FundingLineManager", fundingLineManager }, { "LoanManager", loanManager }, { "ClientManager", clientManager }, { "LocationsManager", locationsManager }, { "ProjectManager", projectManager }, { "EconomicActivityManager", economicActivityManager }, { "InstallmentManager", installmentManager }, { "MFIManager", mfiManager }, { "SavingManager", savingManager }, { "SavingProductManager", savingProductManager }, { "SavingEventManager", savingEventManager }, { "CurrencyManager", currencyManager }, { "FundingLineServices", fundingLineServices }, { "AccountingRuleManager", accountingRuleManager } }; }
public ActionResult FullForm() { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var model = new FullFormVM(); model.SiteId = ((SiteDT)ViewBag.Site).Id; model.States = LocationsManager.GetStates(); var referrerDT = ReferrersManagers.GetReferrer(Request.QueryString["s"] != null ? Request.QueryString["s"] : "LF113B3N").GetDT(); Hashtable ht = new Hashtable(); try { ht = EncryptionHelper.Unpack(EncryptionHelper.Decrypt(Request.QueryString["t"].ToString(), referrerDT.SiteKey)); } catch (Exception ex) { SendExceptionEmail(ex.ToString()); } string customerId = String.Empty; string cctype = string.Empty; if (ht.ContainsKey("CustomerID")) { customerId = ht["CustomerID"].ToString(); string data = string.Empty; data = CustomersManager.RequestToPartsGeek(referrerDT, customerId); if (!(string.IsNullOrEmpty(data) || (data.ToLower() == "not found"))) { var customerHash = EncryptionHelper.Unpack(EncryptionHelper.Decrypt(data, referrerDT.SiteKey)); if (customerHash != null) { model.SiteId = ((SiteDT)ViewBag.Site).Id; model.Email = customerHash["Email"] != null ? customerHash["Email"].ToString() : ""; model.FirstName = customerHash["FirstName"] != null ? customerHash["FirstName"].ToString():""; model.LastName = customerHash["LastName"] != null ? customerHash["LastName"].ToString():""; //model. .Phone = this.customerHash["Phone"].ToString(); model.Address = customerHash["Address1"] != null ? customerHash["Address1"].ToString():""; model.City = customerHash["City"] != null ? customerHash["City"].ToString():""; model.StateId = customerHash["State"] != null ? customerHash["State"].ToString():""; model.ZipCode = customerHash["Zip"] != null ? customerHash["Zip"].ToString() : ""; cctype = customerHash["CCType"] != null ? customerHash["CCType"].ToString() : ""; model.SelCCType = cctype; } } } AddVisit(((SiteDT)ViewBag.Site).Id, Request.QueryString.ToString(), cctype); model.Referrer = string.IsNullOrEmpty(Request.QueryString["s"]) ? "LF113B3N" : Request.QueryString["s"]; return(View(model)); }
public void TestUpdateProvince() { LocationsManager _locationManager = (LocationsManager)container["LocationsManager"]; List <Province> provinces = _locationManager.GetProvinces(); Assert.AreEqual(1, provinces.Count); Assert.AreEqual("FRANCE", provinces[0].Name); provinces[0].Name = "china"; _locationManager.UpdateProvince(provinces[0]); provinces = _locationManager.GetProvinces(); Assert.AreEqual("china", provinces[0].Name); }
public void NoCordinatesTest() { string[] notACity = { "a", "blah", "sjsj blah" }; LocationsManager myLocations = LocationsManager.GetInstance(); foreach (string text in notACity) { string latitude = ""; string longitude = ""; latitude = myLocations.SearchCordinates(text, out longitude); Assert.AreEqual("", latitude, "Search should have found a latidude cordinate on {0}", text); Assert.AreEqual("", longitude, "Search should have found a longitude cordinate"); } }
public void HasCordinatesTest() { string[] validCities = { "everett", "freeday seattle", "in homes in miami", "lost in MiAmI" }; LocationsManager myLocations = LocationsManager.GetInstance(); foreach (string city in validCities) { string latitude = ""; string longitude = ""; latitude = myLocations.SearchCordinates(city, out longitude); Assert.AreNotEqual("", latitude, "Search should have found a latidude cordinate"); Assert.AreNotEqual("", longitude, "Search should have found a longitude cordinate"); } }
private void Awake() { // Dont destroy this object when a new scene is loaded, unless... DontDestroyOnLoad(this); // There can be only ONE! if (_instance == null) { _instance = this; } else if (_instance != this) { Destroy(this.gameObject); } }
public void AddDistrict() { LocationsManager _locationManager = (LocationsManager)container["LocationsManager"]; Province province = new Province("France"); province.Id = _locationManager.AddProvince(province.Name); Assert.AreNotEqual(0, province.Id); District district = new District("Ile de France", province); district.Id = _locationManager.AddDistrict(district); Assert.AreNotEqual(0, district.Id); }
public void TestDeleteDistrictWithCityIn() { List <City> cities = _GetCities(); DynamicMock dynamicMock = new DynamicMock(typeof(LocationsManager)); dynamicMock.SetReturnValue("GetCities", cities); dynamicMock.Expect("DeleteDistrictById", 2); LocationsManager mocklocationManager = (LocationsManager)dynamicMock.MockInstance; LocationServices locationService = new LocationServices(mocklocationManager); Assert.AreEqual(false, locationService.DeleteDistrict(2)); }
public void TestDeleteProvince() { LocationsManager _locationManager = (LocationsManager)container["LocationsManager"]; Province province = new Province("France"); province.Id = _locationManager.AddProvince(province.Name); Assert.AreNotEqual(0, province.Id); List <Province> provinces = _locationManager.GetProvinces(); Assert.AreEqual(2, provinces.Count); _locationManager.DeleteProvinceById(province.Id); provinces = _locationManager.GetProvinces(); Assert.AreEqual(1, provinces.Count); }
public void TestGetDistrictsWhithResults() { List <District> districts = new List <District> { new District(), new District(), new District() }; DynamicMock dynamicMock = new DynamicMock(typeof(LocationsManager)); dynamicMock.SetReturnValue("GetDistricts", districts); LocationsManager locationsManager = (LocationsManager)dynamicMock.MockInstance; LocationServices locationServices = new LocationServices(locationsManager); Assert.AreEqual(3, locationServices.GetDistricts().Count); }
public void TestGetCitiesWhithResults() { List <City> cities = new List <City> { new City(), new City(), new City() }; DynamicMock dynamicMock = new DynamicMock(typeof(LocationsManager)); dynamicMock.SetReturnValue("GetCities", cities); LocationsManager locationsManager = (LocationsManager)dynamicMock.MockInstance; LocationServices locationServices = new LocationServices(locationsManager); Assert.AreEqual(3, locationServices.GetCities().Count); }
public void GetProvincesWhithResults() { List <Province> provinces = new List <Province> { new Province(), new Province(), new Province(), new Province() }; DynamicMock dynamicMock = new DynamicMock(typeof(LocationsManager)); dynamicMock.SetReturnValue("GetProvinces", provinces); LocationsManager locationsManager = (LocationsManager)dynamicMock.MockInstance; LocationServices locationServices = new LocationServices(locationsManager); Assert.AreEqual(4, locationServices.GetProvinces().Count); }
public void SelectProvincesOnly() { LocationsManager _locationManager = (LocationsManager)container["LocationsManager"]; Province provinceA = new Province("France"); Province provinceB = new Province("Tadjikistan"); Province provinceC = new Province("Russian"); provinceA.Id = _locationManager.AddProvince(provinceA.Name); provinceB.Id = _locationManager.AddProvince(provinceB.Name); provinceC.Id = _locationManager.AddProvince(provinceC.Name); List <Province> provinceList = _locationManager.GetProvinces(); Assert.AreEqual(4, provinceList.Count); //provinceA, provinceB, provinceC + BaseManagerTest _Contains(provinceA, provinceList); _Contains(provinceB, provinceList); _Contains(provinceC, provinceList); }
public void TestDeleteCity() { List <City> cities = new List <City>(); City city = new City { Name = "New York", DistrictId = 12 }; DynamicMock dynamicMock = new DynamicMock(typeof(LocationsManager)); dynamicMock.ExpectAndReturn("AddCity", 3, city); dynamicMock.SetReturnValue("GetCities", cities); dynamicMock.Expect("DeleteCityById", 2); LocationsManager mocklocationManager = (LocationsManager)dynamicMock.MockInstance; LocationServices locationService = new LocationServices(mocklocationManager); locationService.DeleteCity(2); Assert.AreEqual(3, locationService.AddCity(city)); Assert.AreEqual(0, locationService.GetCities().Count); }
public void TestUpdateProvince() { Province provinceOne = new Province(2, "Pekin"); List <Province> provinces = new List <Province> { provinceOne }; DynamicMock mockLocationsManager = new DynamicMock(typeof(LocationsManager)); mockLocationsManager.SetReturnValue("GetProvinces", provinces); mockLocationsManager.ExpectAndReturn("UpdateProvince", true, provinceOne); LocationsManager mocklocationManager = (LocationsManager)mockLocationsManager.MockInstance; LocationServices locationService = new LocationServices(mocklocationManager); Assert.AreEqual("Pekin", locationService.GetProvinces()[0].Name); Assert.AreEqual(true, locationService.UpdateProvince(provinceOne)); }
private void CreateLocation(LocationsManager mgr, string Title, string Address, string City, string Region, string PostalCode, string Country, string Continent) { var location = mgr.CreateLocation(); location.Title = Title; location.Address = Address; location.City = City; location.Region = Region; location.PostalCode = PostalCode; location.Country = Country; location.Content = Content; location.UrlName = Title.ToLower().Replace(" ", "-"); // add taxonomy and save var taxonomyMgr = TaxonomyManager.GetManager(); var taxon = taxonomyMgr.GetTaxa <HierarchicalTaxon>().Where(t => t.Name == Continent).Select(t => t.Id).ToArray(); location.Organizer.AddTaxa("Category", taxon); mgr.RecompileItemUrls <LocationItem>(location); }
public void TestUpdateDistrict() { Province provinceOne = new Province(2, "Pekin"); District district = new District("Pekin", provinceOne); List <District> districts = new List <District> { district }; DynamicMock mockLocationsManager = new DynamicMock(typeof(LocationsManager)); mockLocationsManager.SetReturnValue("GetDistricts", districts); mockLocationsManager.ExpectAndReturn("UpdateDistrict", true, district); LocationsManager mocklocationManager = (LocationsManager)mockLocationsManager.MockInstance; LocationServices locationService = new LocationServices(mocklocationManager); Assert.AreEqual("Pekin", locationService.GetDistricts()[0].Name); Assert.AreEqual(true, locationService.UpdateDistrict(district)); }
public void TestUpdateCity() { City city = new City { Name = "Pekin", DistrictId = 12 }; List <City> cities = new List <City> { city }; DynamicMock mockLocationsManager = new DynamicMock(typeof(LocationsManager)); mockLocationsManager.ExpectAndReturn("AddCity", 3, city); mockLocationsManager.SetReturnValue("GetCities", cities); mockLocationsManager.ExpectAndReturn("UpdateCity", true, city); LocationsManager mocklocationManager = (LocationsManager)mockLocationsManager.MockInstance; LocationServices locationService = new LocationServices(mocklocationManager); Assert.AreEqual("Pekin", locationService.GetCities()[0].Name); Assert.AreEqual(true, locationService.UpdateCity(city)); }
public void TestDeleteDistrict() { LocationsManager _locationManager = (LocationsManager)container["LocationsManager"]; Province province = new Province("France"); province.Id = _locationManager.AddProvince(province.Name); Assert.AreNotEqual(0, province.Id); District district = new District("Ile de France", province); district.Id = _locationManager.AddDistrict(district); Assert.AreNotEqual(0, district.Id); List <District> districts = _locationManager.GetDistricts(); Assert.AreEqual(3, districts.Count); _locationManager.DeleteDistrictById(district.Id); districts = _locationManager.GetDistricts(); Assert.AreEqual(2, districts.Count); }
public void TestDeleteProvinceWithDistrictIn() { Province provinceOne = new Province(2, "Pekin"); Province provinceTwo = new Province(8, "Qhinghua"); List <District> districts = new List <District> { new District("Paris", provinceOne), new District("Pekin", provinceOne), new District("Pau", provinceOne) }; DynamicMock dynamicMock = new DynamicMock(typeof(LocationsManager)); dynamicMock.SetReturnValue("GetDistricts", districts); dynamicMock.Expect("DeleteProvinceById", 8); LocationsManager mocklocationManager = (LocationsManager)dynamicMock.MockInstance; LocationServices locationService = new LocationServices(mocklocationManager); Assert.AreEqual(false, locationService.DeleteProvince(provinceOne)); }
/// <summary> /// Initializes the controls. /// </summary> /// <param name="container">The controls container.</param> /// <param name="definition">The content view definition.</param> protected override void InitializeControls(GenericContainer container, IContentViewDefinition definition) { // ensure a valid definition is passed var masterDefinition = definition as IContentViewMasterDefinition; if (masterDefinition == null) { return; } // retrieve locations from the manager var manager = LocationsManager.GetManager(this.Host.ControlDefinition.ProviderName); var query = manager.GetLocations(); // check for filters on the locations query if (masterDefinition.AllowUrlQueries.HasValue && masterDefinition.AllowUrlQueries.Value) { query = this.EvaluateUrl(query, "Date", "PublicationDate", this.Host.UrlEvaluationMode, this.Host.UrlKeyPrefix); query = this.EvaluateUrl(query, "Author", "Owner", this.Host.UrlEvaluationMode, this.Host.UrlKeyPrefix); query = this.EvaluateUrl(query, "Taxonomy", "", typeof(LocationItem), this.Host.UrlEvaluationMode, this.Host.UrlKeyPrefix); } // modify pager based on query results int?totalCount = 0; int?itemsToSkip = 0; if (masterDefinition.AllowPaging.HasValue && masterDefinition.AllowPaging.Value) { itemsToSkip = this.GetItemsToSkipCount(masterDefinition.ItemsPerPage, this.Host.UrlEvaluationMode, this.Host.UrlKeyPrefix); } // culture for Urls in pager CultureInfo uiCulture = null; if (Config.Get <ResourcesConfig>().Multilingual) { uiCulture = System.Globalization.CultureInfo.CurrentUICulture; } // check for additional filters set by the definition var filterExpression = String.Empty; // modify the query with everything from above query = Telerik.Sitefinity.Data.DataProviderBase.SetExpressions( query, filterExpression, masterDefinition.SortExpression, uiCulture, itemsToSkip, masterDefinition.ItemsPerPage, ref totalCount); this.IsEmptyView = (totalCount == 0); // display results if (totalCount == 0) { this.LocationsListControl.Visible = false; } else { this.ConfigurePager(totalCount.Value, masterDefinition); this.LocationsListControl.DataSource = query.ToList(); } }
private void CreateSampleWorker(object[] args) { SampleUtilities.RegisterToolboxWidget("Locations Widget", typeof(LocationsView), "Samples"); SampleUtilities.RegisterTheme(SamplesThemeName, SamplesThemePath); SampleUtilities.RegisterTemplate(new Guid(SamplesTemplateId), SamplesTemplateName, SamplesTemplateName, SamplesTemplatePath, SamplesThemeName); // Create Locations public landing page var result = SampleUtilities.CreatePage(new Guid(LocationsPageID), "Locations", true); if (result) { SampleUtilities.SetTemplateToPage(new Guid(LocationsPageID), new Guid(SamplesTemplateId)); var locationsView = new LocationsView(); locationsView.ContentViewDisplayMode = ContentViewDisplayMode.Automatic; SampleUtilities.AddControlToPage(new Guid(LocationsPageID), locationsView, "Content", "Locations Widget"); } #region Create Taxonomy // ensure Categories taxonomy exists var taxonomyMgr = TaxonomyManager.GetManager(); var taxonomy = taxonomyMgr.GetTaxonomies<HierarchicalTaxonomy>().FirstOrDefault(t => t.Name == "Categories"); if (taxonomy == null) { taxonomy = taxonomyMgr.CreateTaxonomy<HierarchicalTaxonomy>(new Guid(TaxonomyID)); taxonomy.Name = "Categories"; taxonomy.Title = "Categories"; taxonomy.TaxonName = "Categories"; taxonomyMgr.SaveChanges(); } // Add continents as categories if (taxonomy.Taxa.Count == 0) { var taxon = taxonomyMgr.CreateTaxon<HierarchicalTaxon>(); taxon.Title = "Europe"; taxon.Name = "Europe"; taxon.UrlName = "europe"; taxonomy.Taxa.Add(taxon); taxon = taxonomyMgr.CreateTaxon<HierarchicalTaxon>(); taxon.Title = "North America"; taxon.Name = "North America"; taxon.UrlName = "north-america"; taxonomy.Taxa.Add(taxon); taxon = taxonomyMgr.CreateTaxon<HierarchicalTaxon>(); taxon.Title = "Australia"; taxon.Name = "Australia"; taxon.UrlName = "australia"; taxonomy.Taxa.Add(taxon); taxonomyMgr.SaveChanges(); } #endregion #region Create Sample Data // init content manager var mgr = new LocationsManager(); // create sample items if not exist if (mgr.GetLocations().Count() == 0) { // North American Offices CreateLocation(mgr, "Boston Office", "460 Totten Pond Rd, Suite 640", "Waltham", "MA", "02451", "USA", "North America"); CreateLocation(mgr, "Houston Office", "10200 Grogans Mill Rd, Suite 130", "The Woodlands", "TX", "77380", "USA", "North America"); CreateLocation(mgr, "Austin Office", "701 Brazos Street, Suite 320", "Austin", "TX", "78701", "USA", "North America"); CreateLocation(mgr, "Canada Office", "460 Totten Pond Rd, Suite 640", "Waltham", "MA", "02451", "USA", "North America"); // Europe Offices CreateLocation(mgr, "London Office", "15 Bedford Square", "London", "London", "WC1B 3JA", "UK", "Europe"); CreateLocation(mgr, "Bulgaria Office", "33 Alexander Malinov Blvd.", "Sofia", "Sofia", "1729", "Bulgaria", "Europe"); CreateLocation(mgr, "Germany Office", "Balanstrasse 73", "Munich", "Munich", "81541", "Germany", "Europe"); // Australian Office CreateLocation(mgr, "Sydney Office", "81-91 Military Road", "Neutral Bay", "NSW", "2089", "Australia", "Australia"); } // save locations mgr.SaveChanges(); SampleUtilities.CreateUsersAndRoles(); #endregion }
private void CreateLocation(LocationsManager mgr, string Title, string Address, string City, string Region, string PostalCode, string Country, string Continent) { var location = mgr.CreateLocation(); location.Title = Title; location.Address = Address; location.City = City; location.Region = Region; location.PostalCode = PostalCode; location.Country = Country; location.Content = Content; location.UrlName = Title.ToLower().Replace(" ", "-"); // add taxonomy and save var taxonomyMgr = TaxonomyManager.GetManager(); var taxon = taxonomyMgr.GetTaxa<HierarchicalTaxon>().Where(t => t.Name == Continent).Select(t => t.Id).ToArray(); location.Organizer.AddTaxa("Category", taxon); mgr.RecompileItemUrls<LocationItem>(location); }
void Awake() { pc = GameObject.Find("Player").GetComponent <PlayerController>(); map = GameObject.Find("Map"); lm = GetComponent <LocationsManager>(); }