Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var resources = new ObservableCollection<Resource>();
            resources.Add(new Resource()
                {
                    Name = "Gold",
                });
            resources.Add(new Resource()
                {
                    Name = "Aluminium",
                });
            resources.Add(new Resource()
                {
                    Name = "Helium-3",
                });
            resources.ForEach(r => MongoHelpers.SaveData(r));

            var buildings = new ObservableCollection<Building>();
            for (var i = 0; i < 3; i++)
            {
                var b = new Building();
                b.Name = "name" + i;
                b.Resources = new ObservableCollection<ResourceInBuilding>()
                    {
                        new ResourceInBuilding(){ ResourceId = resources[i].Id, ProducePerTurn = 0, UsefullType = UsefullTypes.ForBuilding }
                    };
                b.BuildsRequested = i*12;
                b.BuildsCompleted = 0;
                buildings.Add(b);
            }

            buildings.ForEach(b => MongoHelpers.SaveData(b));
        }
 private bool GetNewBuildingsFilter(Building x)
 {
     if (AppCache.ApplicationViewModel.UserProfile.City != null)
     {
         return !AppCache.ApplicationViewModel.UserProfile.City.BuildingInCityIds.Contains(x.Id);
     }
     return false;
 }
 private bool GetBuildingsInQueryFilter(Building x)
 {
     return true;// x.Status == BuildingStatuses.InQuery;
 }
Exemple #4
0
 public Building SaveBuilding(string authToken, Building building)
 {
     MongoHelpers.SaveData(building);
     return building;
 }