Пример #1
0
        public void CycleSoil()
        {
            int index = (int)(++soiltype);

            index    = index % 5;
            soiltype = (SoilType)index;
        }
Пример #2
0
        /// <summary>
        /// Provides the description of the model settings for summary (GetFullSummary)
        /// </summary>
        /// <param name="formatForParentControl">Use full verbose description</param>
        /// <returns></returns>
        public override string ModelSummary(bool formatForParentControl)
        {
            string html = "\n<div class=\"activityentry\">";

            html += "This land type has an area of <span class=\"setvalue\">" + (this.LandArea * ProportionOfTotalArea).ToString("#,##0.##") + "</span>";
            string units = (this as IResourceType).Units;

            if (units != "NA")
            {
                if (units == null || units == "")
                {
                    html += "";
                }
                else
                {
                    html += " <span class=\"setvalue\">" + units + "</span>";
                }
            }

            if (PortionBuildings > 0)
            {
                html += " of which <span class=\"setvalue\">" + this.PortionBuildings.ToString("0.##%") + "</span> is buildings";
            }
            html += "</div>";
            html += "\n<div class=\"activityentry\">";
            html += "This land has soil of index <span class=\"setvalue\">" + SoilType.ToString() + "</span>";
            html += "\n</div>";
            return(html);
        }
Пример #3
0
 public WorldCell(SoilType soilType)
 {
     SoilType  = soilType;
     Tilled    = false;
     Structure = null;
     CropIndex = -1;
 }
Пример #4
0
        public void SetSoilType(int x, int y, SoilType soilType)
        {
            this.GetSlice(x)[y] = soilType;

            if (soilType == SoilType.Water)
            {
                this.WaterTilesCount++;
            }
        }
Пример #5
0
        public SoilTypeViewModel(Window SoilTypeWindow, BindingList <SoilType> mySoils, SoilType soiltype)
        {
            this.soiltypewindow = SoilTypeWindow;
            this.mySoils        = mySoils;
            MySoilType          = soiltype;

            SaveSoilCommand = new MyICommand(SaveSoil, CanSaveSoil);
            ExitCommand     = new MyICommand(Exit);
        }
Пример #6
0
        public static SoilType getSoilType(IDBContext db, Coordinates coordinates)
        {
            SoilType rc = null;

            if (!SoilType.GetByMap(db, coordinates, out rc))
            {
                rc = SoilType.defaultype;
            }
            return(rc);
        }
Пример #7
0
        public bool AddNewSoilType(SoilType soilType)
        {
            using (var dbContext = new FlowerPlotsDBContext())
            {
                SoilType addedSoilType = dbContext.SoilTypes.Add(soilType);
                dbContext.SaveChanges();

                return(true);
            }
        }
Пример #8
0
 protected void AddRemoveSoilType(SoilType soilType)
 {
     if (ChosenSoilTypes.Contains(soilType))
     {
         ChosenSoilTypes.Remove(soilType);
     }
     else
     {
         ChosenSoilTypes.Add(soilType);
     }
 }
Пример #9
0
        public async Task <IActionResult> GetById(Guid id)
        {
            SoilType soilType = await _repository.GetByIdAsync(id);

            if (soilType == null)
            {
                return(NotFound());
            }

            return(Ok(_mapper.Map(soilType)));
        }
Пример #10
0
        public GameObject SpawnSoil(SoilType soilType)
        {
            GameObject prefab   = soilData.First(pair => pair.Key.Equals(soilType)).Value.Prefabs.GetRandomItem();
            GameObject instance = Instantiate(prefab, CachedTransform.position, CachedTransform.rotation);

            instance.transform.Translate(soilSpawnpoint, Space.World);

            instance.name = soilType.ToString().ReplaceUnderscoreWithSpace();

            return(instance);
        }
Пример #11
0
 public bool AddSoilType(SoilType soil)
 {
     using (IUnitOfWork unit = new UnitOfWork(new Context()))
     {
         SoilType s = unit.Soils.Get(soil.SoilName);
         if (s == null) //ako takvav user ne postoji,dodaj
         {
             unit.Soils.Add(soil);
             unit.Complete();
             return true;
         }
         return false;
     }
 }
Пример #12
0
        public BuildingData(int rent, float secondsPerRent, int weight, int price, int repairCost, int destructionCost, int cleanupCosts,
                            SoilType soilType,
                            FoundationType foundation, float maxHealth)
        {
            this.rent           = rent;
            this.secondsPerRent = secondsPerRent;
            this.weight         = weight;
            this.price          = price;

            this.repairCost      = repairCost;
            this.destructionCost = destructionCost;
            this.cleanupCosts    = cleanupCosts;
            this.maxHealth       = maxHealth;

            SoilType   = soilType;
            Foundation = foundation;
        }
Пример #13
0
        public async Task <IActionResult> Post(SoilTypeRequest request)
        {
            try
            {
                SoilType soilType = _mapper.Map(request);

                soilType = await _repository.AddAsync(soilType);

                return(CreatedAtAction(nameof(GetById), new { id = soilType.Id }, _mapper.Map(soilType)));
            }

            catch (DataStoreException e)
            {
                _logger.LogError(e.Message, e, request);
                return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
            }
        }
Пример #14
0
        private void Initialize()
        {
            Flowers   = new List <Flower>(ConnectionService.Instance.proxy.GetFlowers());
            SoilTypes = new List <SoilType>(ConnectionService.Instance.proxy.GetSoilTypes());

            if (MainWindow.selectedPlot != null)
            {
                Area             = MainWindow.selectedPlot.Area.ToString();
                MoisturePerc     = MainWindow.selectedPlot.MoisturePerc.ToString();
                PlantingDate     = MainWindow.selectedPlot.PlantingDate;
                HarvestDate      = MainWindow.selectedPlot.HarvestDate;
                Stage            = MainWindow.selectedPlot.Stage;
                StageImage       = MainWindow.selectedPlot.StageImage;
                SelectedFlower   = MainWindow.selectedPlot.Flower;
                SelectedSoilType = MainWindow.selectedPlot.Soil;
                Clay             = MainWindow.selectedPlot.Soil.ClayPercent;
                Sand             = MainWindow.selectedPlot.Soil.SandPercent;
                Silt             = MainWindow.selectedPlot.Soil.SiltPercent;

                switch (stage)
                {
                case FlowerPlotStages.Empty:
                    canStart = true;
                    break;

                case FlowerPlotStages.Seed:
                    canGermination = true;
                    break;

                case FlowerPlotStages.Germination:
                    canGrowth = true;
                    break;

                case FlowerPlotStages.Growth:
                    canFlowering = true;
                    break;

                case FlowerPlotStages.Flowering:
                    canCut = true;
                    break;
                }

                CanChangeStage();
            }
        }
Пример #15
0
        private void Cut()
        {
            if (!Conflict())
            {
                Stage            = FlowerPlotStages.Empty;
                StageImage       = "";
                MoisturePerc     = "0";
                SelectedFlower   = null;
                SelectedSoilType = null;
                PlantingDate     = "";
                HarvestDate      = "";


                Plot newFlowerPlot = CreateFlowerPlot();

                newFlowerPlot.Id     = MainWindow.selectedPlot.Id;
                newFlowerPlot.Flower = new Flower {
                    Name = "", Id = 1
                };
                newFlowerPlot.Soil = new SoilType {
                    Name = "", Id = 1, ClayPercent = 0, SandPercent = 0, SiltPercent = 0
                };

                if (ConnectionService.Instance.proxy.EditFlowerPlot(newFlowerPlot))
                {
                    canStart              = false;
                    canSeed               = false;
                    canGermination        = false;
                    canGrowth             = false;
                    canFlowering          = false;
                    canCut                = false;
                    MainWindow.logMessage = "Cut flowers.";
                    LogService.Instance.LogInformation("Cut flowers.");
                    LogService.Instance.SendServerInformation("Cut flowers.");
                }
                else
                {
                    MainWindow.logMessage = "Error while cutting flowers.";
                    LogService.Instance.LogError("Error while cutting flowers.");
                    LogService.Instance.SendServerError("Error while cutting flowers.");
                    MessageBox.Show("Error cut.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
    // Use this for initialization
    void Start()
    {
        GameObject _GM = GameObject.Find("_GM");

        solutions    = _GM.GetComponent <Solutions>();
        buildingList = _GM.GetComponent <BuildingList>();
        upgradeList  = _GM.GetComponent <UpgradeList>();

        sprite = GetComponentInChildren <SpriteRenderer>();

        // Raycast downwards to terrain and assign joint anchor
        RaycastHit2D terrainHit = Physics2D.Raycast(transform.position + Vector3.up * 10, -Vector2.up, float.MaxValue, terrainLayer);

        if (terrainHit.collider != null)
        {
            Vector2 hitPoint    = terrainHit.point;
            string  terrainName = terrainHit.collider.gameObject.name;

            // Try to automatically set soil type based on terrain name

            string[] typeNames = Enum.GetNames(typeof(SoilType));
            Array    typeVals  = Enum.GetValues(typeof(SoilType));
            for (int i = 0; i < typeNames.Length; i++)
            {
                if (terrainName.Equals(typeNames[i]))
                {
                    soilType = (SoilType)typeVals.GetValue(i);
                }
            }

            gameObject.name = gameObject.name + " of " + soilType + " on " + terrainHit.collider.gameObject.name;

            if (!soilType.ToString().Equals(terrainName))
            {
                Debug.Log("WARNING: Soil type property name of building zone do not equal terrain name: " + soilType + " != " + terrainHit.collider.gameObject.name);
            }
        }
        else
        {
            Debug.Log("WARNING: Terrain not found of building platform");
        }
    }
Пример #17
0
        public static float SoilTypeSwitch(SoilType soilType)
        {
            switch (soilType)
            {
            case SoilType.Sand:
                return(300.0f);

            case SoilType.Loam:
                return(240.0f);

            case SoilType.Clay:
                return(180.0f);

            case SoilType.Peat:
                return(120.0f);

            default:
                return(0.0f);
            }
        }
Пример #18
0
        public async Task <IActionResult> Delete(Guid id)
        {
            try
            {
                SoilType soilType = await _repository.GetByIdAsync(id);

                if (soilType == null)
                {
                    return(NotFound());
                }

                await _repository.DeleteAsync(soilType);

                return(Ok(id));
            }

            catch (DataStoreException e)
            {
                _logger.LogError(e.Message, e, id);
                return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
            }
        }
Пример #19
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            // validacija da se moraju unijeti brojevi
            clay = Int32.Parse(txtClay.Text);
            sand = Int32.Parse(txtSand.Text);
            silt = Int32.Parse(txtSilt.Text);

            string name = "Cl" + clay + "Sa" + sand + "Si" + silt;
            int    sum  = clay + sand + silt;

            if (!String.IsNullOrEmpty(txtClay.Text) && !String.IsNullOrEmpty(txtSand.Text) && !String.IsNullOrEmpty(txtSilt.Text) && sum == 100)
            {
                SoilType newSoilType = new SoilType {
                    ClayPercent = clay, SandPercent = sand, SiltPercent = silt, Name = name
                };

                if (ConnectionService.Instance.proxy.AddNewSoilType(newSoilType))
                {
                    MainWindow.logMessage = "Added a new soil type.";
                    LogService.Instance.LogInformation("Added a new soil type.");
                    LogService.Instance.SendServerInformation("Added a new soil type.");
                    this.Close();
                }
                else
                {
                    MainWindow.logMessage = "Error while adding a new soil type.";
                    LogService.Instance.LogError("Error while adding a new soil type.");
                    LogService.Instance.SendServerError("Error while adding a new soil type.");
                    MessageBox.Show("Enter a numbers (sum = 100)", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MainWindow.logMessage = "Error while adding a new soil type.";
                LogService.Instance.LogError("Error while adding a new soil type.");
                LogService.Instance.SendServerError("Error while adding a new soil type.");
                MessageBox.Show("Enter a numbers (sum = 100)", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #20
0
        /// <summary>
        /// Provides the description of the model settings for summary (GetFullSummary)
        /// </summary>
        /// <param name="formatForParentControl">Use full verbose description</param>
        /// <returns></returns>
        public override string ModelSummary(bool formatForParentControl)
        {
            string html = "\n<div class=\"activityentry\">";

            if (LandArea == 0)
            {
                html += "<span class=\"errorlink\">NO VALUE</span> has been set for the area of this land";
            }
            else if (ProportionOfTotalArea == 0)
            {
                html += "The proportion of total area assigned to this land type is <span class=\"errorlink\">0</span> so no area is assigned";
            }
            else
            {
                html += "This land type has an area of <span class=\"setvalue\">" + (this.LandArea * ProportionOfTotalArea).ToString("#,##0.##") + "</span>";
                string units = (this as IResourceType).Units;
                if (units != "NA")
                {
                    if (units == null || units == "")
                    {
                        html += "";
                    }
                    else
                    {
                        html += " <span class=\"setvalue\">" + units + "</span>";
                    }
                }
            }

            if (PortionBuildings > 0)
            {
                html += " of which <span class=\"setvalue\">" + this.PortionBuildings.ToString("0.##%") + "</span> is buildings";
            }
            html += "</div>";
            html += "\n<div class=\"activityentry\">";
            html += "This land is identified as <span class=\"setvalue\">" + SoilType.ToString() + "</span>";
            html += "\n</div>";
            return(html);
        }
Пример #21
0
        public void GetType(AbstractTile tile)
        {
            // check and cast to approriate type directly
            if (tile is AbstractBuildingTile buildingTile)
            {
                hasSoil       = buildingTile.HasSoil;
                hasFoundation = buildingTile.HasFoundation;
                hasDebris     = buildingTile.HasDebris;

                if (!hasSoil)
                {
                    return;
                }

                soilType = buildingTile.GetSoilType();

                if (!hasFoundation)
                {
                    return;
                }

                foundationType = buildingTile.GetFoundationType();

                if (!buildingTile.HasBuilding || hasDebris)
                {
                    return;
                }

                buildingType = buildingTile.GetBuildingType();
                buildingTier = buildingTile.Building.CurrentTier;

                BuildingHealth buildingHealth = buildingTile.Building.GetComponent <BuildingHealth>();

                this.buildingHealth = buildingHealth.CurrentBuildingHealth;
                foundationHealth    = buildingHealth.CurrentFoundationHealth;
                soilHealth          = buildingHealth.CurrentSoilHealth;
            }
        }
Пример #22
0
        public override void ReadConfiguration(XElement Configuration)
        {
            base.ReadConfiguration(Configuration);

            if (Update)
            {
                foreach (var s in Configuration.Element("SoilTypes").Elements("SoilType"))
                {
                    SoilType st = new SoilType();
                    st.ExtensiveRate    = s.SafeParseDouble("ExtensiveRate") ?? 0;
                    st.IntermediateRate = s.SafeParseDouble("IntermediateRate") ?? 0;
                    st.IntensiveRate    = s.SafeParseDouble("IntensiveRate") ?? 0;
                    st.Name             = s.SafeParseString("Name");
                    soils.Add(s.SafeParseString("Name").ToLower(), st);
                }

                YearFactors = new Dictionary <int, double>();
                foreach (var s in Configuration.Element("YearFactors").Elements("YearFactor"))
                {
                    YearFactors.Add(s.SafeParseInt("Year").Value, s.SafeParseDouble("Factor").Value);
                }
            }
        }
Пример #23
0
    public override void ReadConfiguration(XElement Configuration)
    {
      base.ReadConfiguration(Configuration);

      if (Update)
      {
        foreach (var s in Configuration.Element("SoilTypes").Elements("SoilType"))
        {
          SoilType st = new SoilType();
          st.ExtensiveRate = s.SafeParseDouble("ExtensiveRate")??0;
          st.IntermediateRate = s.SafeParseDouble("IntermediateRate") ?? 0;
          st.IntensiveRate = s.SafeParseDouble("IntensiveRate") ?? 0;
          st.Name = s.SafeParseString("Name");
          soils.Add(s.SafeParseString("Name").ToLower(),st);
        }

        YearFactors = new Dictionary<int, double>();
        foreach (var s in Configuration.Element("YearFactors").Elements("YearFactor"))
        {
          YearFactors.Add(s.SafeParseInt("Year").Value, s.SafeParseDouble("Factor").Value);
        }
      }
    }
Пример #24
0
        public async Task <IActionResult> Put(Guid id, SoilTypeRequest request)
        {
            try
            {
                SoilType soilType = await _repository.GetByIdAsync(id);

                if (soilType == null)
                {
                    return(NotFound());
                }

                _mapper.Map(soilType, request);

                await _repository.UpdateAsync(soilType);

                return(Ok());
            }

            catch (DataStoreException e)
            {
                _logger.LogError(e.Message, e, request);
                return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
            }
        }
Пример #25
0
        public BuildingData[] GetBuildingData(BuildingType buildingType, FoundationType foundationType, SoilType soilType)
        {
            List <BuildingTierData> buildingTypeData = buildingTierData.First(pair => pair.Key.Equals(buildingType)).Value;

            BuildingData[] data = new BuildingData[buildingTypeData.Count];

            for (int i = 0; i < buildingTypeData.Count; i++)
            {
                BuildingData datum = buildingTypeData[i].GetData();

                datum.SoilType   = soilType;
                datum.Foundation = foundationType;

                data[i] = datum;
            }

            return(data);
        }
Пример #26
0
 public SoilTypeData GetSoilData(SoilType soilType)
 {
     return(soilData.First(pair => pair.Key.Equals(soilType)).Value);
 }
Пример #27
0
    string[] getInfo(SoilType type)
    {
        string[] info = new string[4];

        switch (type)
        {
        case SoilType.Bedrock: {
            info[0] = "Bedrock";
            info[1] = "Grondgesteente";
            info[2] = @"
Bedrock is the hardest layer, that normally lies underneath the more softer soils. It has been <b>compressed</b> into one by the pressure of the layers above. 
This is a kind of stiffest soil where an earthquake can easily pass through. 
";
            info[3] = @"
Grondgesteente is de hardste laag, die normaal gesproken onder de zachtere lagen ligt. Het is in elkaar gedrukt door de druk van de lagen die er bovenop liggen. De aardbeving kan makkelijker door deze grondlaag heen bewegen.";
            break;
        }

        case SoilType.Marl: {
            info[0] = "Marl";
            info[1] = "Mergel";
            info[2] = @"
Marl consists mostly of <b>mud</b> or mudstone, which contains variable amounts of clays and silt. 
This is a kind of stiff soil where an earthquake can easily pass through, with little amplification effects.
                    ";
            info[3] = @"
Mergel​ ​bestaat​ ​voor​ ​het​ ​grootste​ ​deel​ ​uit​ ​<b>modder</b>,​ ​wat​ ​bestaat​ ​uit​ ​verschillende​ ​lagen van​ ​klei​ ​en​ ​silt.​ 
​Dit​ ​is​ ​een​ ​stevige​ ​bodemlaag​ ​waar​ ​een​ ​aardbeving​ ​makkelijk​ ​doorheen beweegt,​ ​met​ ​weinig​ ​versterkende​ ​effecten.";
            break;
        }

        case SoilType.Limestone: {
            info[0] = "Limestone";
            info[1] = "Kalksteen";
            info[2] = @"
Limestone is a <b>sedimentary</b> rock, which means that it is formed in water. It consists of shells, minerals and coral. 
This is a soft rock layer, which slows down the waves but increases intensity."
            ;
            info[3] = @"
Kalksteen is een <b>rotslaag</b> die is opgebouwd van natuurlijke stoffen die zijn gevormd in het water. Het bestaat uit schelpen, mineralen en koraal.
Deze deeltjes zijn zo hard op elkaar gedrukt dat ze een gesteente zijn geworden. Het is een zachte soort rotslaag, waar de snelheid van de aardbeving door wordt afgenomen, maar die de intensiteit nog hoger maakt.";
            break;
        }

        case SoilType.Sand: {
            info[0] = "Sand";
            info[1] = "Zand";
            info[2] = @"

                    ";
            info[3] = "";
            break;
        }

        case SoilType.Sandstone: {
            info[0] = "Sandstone";
            info[1] = "Zandsteen";
            info[2] = @"
Sandstone is a bit more porous compared to rocksalt. Therefore gas has been able to develop in between the layer. 
The gas is contained by a denser soil layer on top of it. This layer therefore intensifies the earthquake, as the gas releases, the soil becomes more unstable. 
                    ";
            info[3] = @"
Zandsteen is wat poreuzer dan zoutsteen. Daardoor kan het gas dat zich heeft ontwikkelt in de laag gevangen blijven, omdat het niet kan ontsnappen door de zoutsteenlaag. De gassen die hier zijn gewonnen laten ruimtes over in de grondlaag. Als er een aardbeving doorheen gaat, zullen deze instorten, waardoor de intensiteit van de aardbeving wordt versterkt.";
            break;
        }

        case SoilType.Clay: {
            info[0] = "Clay";
            info[1] = "Klei";
            info[2] = @"
Clay is a <b>fine-grained</b> natural soil material. Combined with the groundwater it acts elastic. 
This means that the earthquake will be amplified when it passes through. 
                    ";
            info[3] = @"
Klei​ ​is​ ​een​ ​natuurlijke​ ​grondlaag​ ​​ ​met​ ​een <b>fijnkorrelige​ ​structuur​</b>.​ ​Gecombineerd​ ​met het​ ​grondwater,​ ​zorgt​ ​dit​ ​ervoor​ ​dat​ ​het​ ​elastisch​ ​wordt​ ​als​ ​er​ ​een​ ​aardbeving​ ​is​ ​veroorzaakt. 
Dit​ ​betekent​ ​dat​ ​het​ ​effect​ ​van​ ​de​ ​aardbeving​ ​wordt​ ​versterkt​ ​als​ ​het​ ​door​ ​de​ ​kleilaag​ ​heen beweegt.";
            break;
        }

        case SoilType.Quicksand: {
            info[0] = "Quicksand";
            info[1] = "Drijfzand";
            info[2] = @"
Quicksand is a <b>water saturated</b> layer. A special effect occurs here when an earthquake hits, called liquefaction. 
Liquefaction means that the ground will start to act like a liquid, that will cause heavy objects like buildings and cars to sink. 
                    ";
            info[3] = @"
Drijfzand​ ​is​ ​een​ ​<b>​ ​water​ ​verzadigde​ ​</b>​ ​grondlaag.​ ​Als​ ​er​ ​een​ ​aardbeving​ ​wordt veroorzaakt,​ ​heeft​ ​deze​ ​grond​ ​een​ ​speciaal​ ​effect,​ ​wat​ ​bodemvervloeiing​ ​heet.​ 
​Dit​ ​betekent dat​ ​de​ ​grond​ ​zich​ ​als​ ​een​ ​vloeistof​ ​zal​ ​gaan​ ​gedragen,​ ​waardoor​ ​zwaardere​ ​objecten​ ​als huizen​ ​en​ ​auto’s​ ​in​ ​de​ ​grond​ ​zullen​ ​zinken.";
            break;
        }

        case SoilType.RockSalt: {
            info[0] = "Rock Salt";
            info[1] = "Zoutsteen";
            info[2] = @"
Rock salt occurs in vast beds of sedimentary evaporite minerals that result from the drying up of enclosed lakes, playas, and seas. 
It is a stiff layer, and has a little damping effect on the earthquake.
                    ";
            info[3] = @"
Zoutsteen komt voor in plaatsen waar grote hoeveelheden mineralen zijn neergedaald, nadat een meer of zee is verdampt. Het is een harde laag die weinig effect heeft op de aardbeving.";
            break;
        }

        default: {
            info[0] = "?";
            info[1] = "?";
            info[2] = "?";
            info[3] = "?";
            break;
        }
        }


        return(info);
    }
Пример #28
0
        private static void AddToBase()
        {
            using (IUnitOfWork context = new UnitOfWork(new Context()))
            {
                context.DeleteDatabase();
                User adminUser = new User()
                {
                    Username = "******",
                    Password = "******",
                    Name     = "Biljana",
                    Lastname = "Vukelic",
                    TypeUser = UserTypes.ADMIN
                };

                User regularUser = new User()
                {
                    Username = "******",
                    Password = "******",
                    Name     = "obican",
                    Lastname = "obican",
                    TypeUser = UserTypes.REGULAR
                };


                SoilType soil1 = new SoilType()
                {
                    SoilName    = "Smonica",
                    ClayPercent = 20,
                    SandPercent = 20,
                    SiltPercent = 60
                };
                SoilType soil2 = new SoilType()
                {
                    SoilName    = "Crnica",
                    ClayPercent = 80,
                    SandPercent = 10,
                    SiltPercent = 10
                };
                SoilType soil3 = new SoilType()
                {
                    SoilName    = "Gajnjaca",
                    ClayPercent = 70,
                    SandPercent = 20,
                    SiltPercent = 10
                };

                Flower flower1 = new Flower()
                {
                    FlowerName = "Ruza"
                };

                Flower flower2 = new Flower()
                {
                    FlowerName = "Gerber"
                };

                Flower flower3 = new Flower()
                {
                    FlowerName = "Bozur"
                };

                FlowerPlotIteration flowerPlot1 = new FlowerPlotIteration()
                {
                    Area         = 5,
                    Id           = 501,
                    Stage        = StageTypes.Idle,
                    HarvestDate  = DateTime.Now,
                    MoisturePerc = 10,
                    PlantingDate = DateTime.Now,
                    FlowerName   = "Ruza",
                    SoilName     = "Crnica[Clay:80% Sand:10% Slit:10%]",
                    LastChange   = DateTime.Now.Ticks
                };

                FlowerPlotIteration flowerPlot2 = new FlowerPlotIteration()
                {
                    Area         = 6,
                    Id           = 502,
                    Stage        = StageTypes.Planted,
                    HarvestDate  = DateTime.Now,
                    MoisturePerc = 20,
                    PlantingDate = DateTime.Now,
                    FlowerName   = "Gerber",
                    SoilName     = "Smonica[Clay:20% Sand:20% Slit:60%]",
                    LastChange   = DateTime.Now.Ticks
                };

                FlowerPlotIteration flowerPlot3 = new FlowerPlotIteration()
                {
                    Area         = 7,
                    Id           = 503,
                    Stage        = StageTypes.Bloomed,
                    HarvestDate  = DateTime.Now,
                    MoisturePerc = 30,
                    PlantingDate = DateTime.Now,
                    FlowerName   = "Bozur",
                    SoilName     = "Gajnjaca[Clay:70% Sand:20% Slit:10%]",
                    LastChange   = DateTime.Now.Ticks
                };

                try
                {
                    context.Users.Add(adminUser);
                    context.Users.Add(regularUser);
                    context.Soils.Add(soil1);
                    context.Soils.Add(soil2);
                    context.Soils.Add(soil3);
                    context.FlowersType.Add(flower1);
                    context.FlowersType.Add(flower2);
                    context.FlowersType.Add(flower3);
                    context.Flowers.Add(flowerPlot1);
                    context.Flowers.Add(flowerPlot2);
                    context.Flowers.Add(flowerPlot3);

                    context.Complete();
                }
                catch (Exception)
                {
                    LogManager.GetLogger("Server").Debug("Error with adding to base.");
                }
            }
        }
Пример #29
0
 public SoilBlock(int Cost, SoilType Type)
 {
     this.Cost = Cost;
     this.Type = Type;
 }
Пример #30
0
 public void InitializeTest()
 {
     soil = new SoilType();
 }
Пример #31
0
        /// <inheritdoc/>
        public override string ModelSummary()
        {
            using (StringWriter htmlWriter = new StringWriter())
            {
                htmlWriter.Write("\r\n<div class=\"activityentry\">");
                if (LandArea == 0)
                {
                    htmlWriter.Write("<span class=\"errorlink\">NO VALUE</span> has been set for the area of this land");
                }
                else if (ProportionOfTotalArea == 0)
                {
                    htmlWriter.Write("The proportion of total area assigned to this land type is <span class=\"errorlink\">0</span> so no area is assigned");
                }
                else
                {
                    htmlWriter.Write("This land type has an area of <span class=\"setvalue\">" + (this.LandArea * ProportionOfTotalArea).ToString("#,##0.##") + "</span>");
                }
                string units = (this as IResourceType).Units;
                if (units != "NA")
                {
                    if (units == null || units == "")
                    {
                        htmlWriter.Write("");
                    }
                    else
                    {
                        htmlWriter.Write(" <span class=\"setvalue\">" + units + "</span>");
                    }
                }

                if (PortionBuildings > 0)
                {
                    htmlWriter.Write(" of which <span class=\"setvalue\">" + this.PortionBuildings.ToString("0.##%") + "</span> is buildings");
                }
                htmlWriter.Write("</div>");
                htmlWriter.Write("\r\n<div class=\"activityentry\">");
                htmlWriter.Write("This land is identified as <span class=\"setvalue\">" + SoilType.ToString() + "</span>");
                htmlWriter.Write("\r\n</div>");
                return(htmlWriter.ToString());
            }
        }