public void SetInformationDataModel(InformationDataModel dataModel, int index)
 {
     _fiefService.InformationList[index] = dataModel;
 }
        public InformationDataModel GetAllInformationDataModel()
        {
            InformationDataModel tempDataModel = _fiefService.InformationList[0];

            string     mountain                        = "Nej";
            string     mountainRange                   = "Nej";
            string     river                           = "Nej";
            string     coast                           = "Nej";
            string     lake                            = "Nej";
            string     plain                           = "Nej";
            string     desert                          = "Nej";
            string     swamp                           = "Nej";
            string     jungle                          = "Nej";
            List <int> animalHusbandryQuality          = new List <int>();
            List <int> fishingQuality                  = new List <int>();
            List <int> huntingQuality                  = new List <int>();
            List <int> agricultureQuality              = new List <int>();
            List <int> oreQuality                      = new List <int>();
            List <int> animalHusbandryDevelopmentLevel = new List <int>();
            List <int> fishingDevelopmentLevel         = new List <int>();
            List <int> huntingDevelopmentLevel         = new List <int>();
            List <int> agricultureDevelopmentLevel     = new List <int>();
            List <int> oreDevelopmentLevel             = new List <int>();
            List <int> healthcareDevelopmentLevel      = new List <int>();
            List <int> militaryDevelopmentLevel        = new List <int>();
            List <int> shippingDevelopmentLevel        = new List <int>();
            List <int> woodlandDevelopmentLevel        = new List <int>();
            List <int> educationDevelopmentLevel       = new List <int>();

            List <ReligionModel> religionModelList = new List <ReligionModel>()
            {
                new ReligionModel()
                {
                    Religion  = "Daakkyrkan",
                    Followers = 0,
                    Resources = "0",
                    Loyalty   = "0"
                },
                new ReligionModel()
                {
                    Religion  = "Jordesoldatens vittnen",
                    Followers = 0,
                    Resources = "0",
                    Loyalty   = "0"
                },
                new ReligionModel()
                {
                    Religion  = "Vindtron",
                    Followers = 0,
                    Resources = "0",
                    Loyalty   = "0"
                },
                new ReligionModel()
                {
                    Religion  = "Hedendomen",
                    Followers = 0,
                    Resources = "0",
                    Loyalty   = "0"
                },
                new ReligionModel()
                {
                    Religion  = "Samoriska läran",
                    Followers = 0,
                    Resources = "0",
                    Loyalty   = "0"
                },
                new ReligionModel()
                {
                    Religion  = "Kristallorden",
                    Followers = 0,
                    Resources = "0",
                    Loyalty   = "0"
                },
                new ReligionModel()
                {
                    Religion  = "Xinukulten",
                    Followers = 0,
                    Resources = "0",
                    Loyalty   = "0"
                },
                new ReligionModel()
                {
                    Religion  = "Commersium lamia",
                    Followers = 0,
                    Resources = "0",
                    Loyalty   = "0"
                },
                new ReligionModel()
                {
                    Religion  = "Övriga",
                    Followers = 0,
                    Resources = "0",
                    Loyalty   = "0"
                }
            };

            for (int x = 1; x < _fiefService.InformationList.Count; x++)
            {
                if (_fiefService.InformationList[x].Mountain == "Ja")
                {
                    mountain = "Ja";
                }

                if (_fiefService.InformationList[x].MountainRange == "Ja")
                {
                    mountainRange = "Ja";
                }

                if (_fiefService.InformationList[x].River == "Ja")
                {
                    river = "Ja";
                }

                if (_fiefService.InformationList[x].Coast == "Ja")
                {
                    coast = "Ja";
                }

                if (_fiefService.InformationList[x].Lake == "Ja")
                {
                    lake = "Ja";
                }

                if (_fiefService.InformationList[x].Plain == "Ja")
                {
                    plain = "Ja";
                }

                if (_fiefService.InformationList[x].Swamp == "Ja")
                {
                    swamp = "Ja";
                }

                if (_fiefService.InformationList[x].Jungle == "Ja")
                {
                    jungle = "Ja";
                }

                if (_fiefService.InformationList[x].Desert == "Ja")
                {
                    desert = "Ja";
                }

                animalHusbandryQuality.Add(Convert.ToInt16(_fiefService.InformationList[x].AnimalHusbandryQuality));
                fishingQuality.Add(Convert.ToInt16(_fiefService.InformationList[x].FishingQuality));
                huntingQuality.Add(Convert.ToInt16(_fiefService.InformationList[x].HuntingQuality));
                agricultureQuality.Add(Convert.ToInt16(_fiefService.InformationList[x].AgricultureQuality));
                oreQuality.Add(Convert.ToInt16(_fiefService.InformationList[x].OreQuality));

                animalHusbandryDevelopmentLevel.Add(Convert.ToInt16(_fiefService.InformationList[x].AnimalHusbandryDevelopmentLevel));
                fishingDevelopmentLevel.Add(Convert.ToInt16(_fiefService.InformationList[x].FishingDevelopmentLevel));
                huntingDevelopmentLevel.Add(Convert.ToInt16(_fiefService.InformationList[x].HuntingDevelopmentLevel));
                agricultureDevelopmentLevel.Add(Convert.ToInt16(_fiefService.InformationList[x].AgricultureDevelopmentLevel));
                oreDevelopmentLevel.Add(Convert.ToInt16(_fiefService.InformationList[x].OreDevelopmentLevel));
                healthcareDevelopmentLevel.Add(Convert.ToInt16(_fiefService.InformationList[x].HealthcareDevelopmentLevel));
                militaryDevelopmentLevel.Add(Convert.ToInt16(_fiefService.InformationList[x].MilitaryDevelopmentLevel));
                shippingDevelopmentLevel.Add(Convert.ToInt16(_fiefService.InformationList[x].ShippingDevelopmentLevel));
                woodlandDevelopmentLevel.Add(Convert.ToInt16(_fiefService.InformationList[x].WoodlandDevelopmentLevel));
                educationDevelopmentLevel.Add(Convert.ToInt16(_fiefService.InformationList[x].EducationDevelopmentLevel));

                for (int i = 1; i < _fiefService.InformationList[x].ReligionsList.Count; i++)
                {
                    religionModelList[i].Followers += _fiefService.InformationList[x].ReligionsList[i].Followers;
                }
            }

            tempDataModel.Mountain      = mountain;
            tempDataModel.MountainRange = mountainRange;
            tempDataModel.River         = river;
            tempDataModel.Coast         = coast;
            tempDataModel.Lake          = lake;
            tempDataModel.Plain         = plain;
            tempDataModel.Desert        = desert;
            tempDataModel.Jungle        = jungle;
            tempDataModel.Swamp         = swamp;

            tempDataModel.AnimalHusbandryQuality = $"{animalHusbandryQuality.Min()} - {animalHusbandryQuality.Max()}";
            tempDataModel.FishingQuality         = $"{fishingQuality.Min()} - {fishingQuality.Max()}";
            tempDataModel.HuntingQuality         = $"{huntingQuality.Min()} - {huntingQuality.Max()}";
            tempDataModel.AgricultureQuality     = $"{agricultureQuality.Min()} - {agricultureQuality.Max()}";
            tempDataModel.OreQuality             = $"{oreQuality.Min()} - {oreQuality.Max()}";

            tempDataModel.AnimalHusbandryDevelopmentLevel = $"{animalHusbandryDevelopmentLevel.Min()} - {animalHusbandryDevelopmentLevel.Max()}";
            tempDataModel.FishingDevelopmentLevel         = $"{fishingDevelopmentLevel.Min()} - {fishingDevelopmentLevel.Max()}";
            tempDataModel.HuntingDevelopmentLevel         = $"{huntingDevelopmentLevel.Min()} - {huntingDevelopmentLevel.Max()}";
            tempDataModel.AgricultureDevelopmentLevel     = $"{agricultureDevelopmentLevel.Min()} - {agricultureDevelopmentLevel.Max()}";
            tempDataModel.OreDevelopmentLevel             = $"{oreDevelopmentLevel.Min()} - {oreDevelopmentLevel.Max()}";
            tempDataModel.HealthcareDevelopmentLevel      = $"{healthcareDevelopmentLevel.Min()} - {healthcareDevelopmentLevel.Max()}";
            tempDataModel.MilitaryDevelopmentLevel        = $"{militaryDevelopmentLevel.Min()} - {militaryDevelopmentLevel.Max()}";
            tempDataModel.ShippingDevelopmentLevel        = $"{shippingDevelopmentLevel.Min()} - {shippingDevelopmentLevel.Max()}";
            tempDataModel.WoodlandDevelopmentLevel        = $"{woodlandDevelopmentLevel.Min()} - {woodlandDevelopmentLevel.Max()}";
            tempDataModel.EducationDevelopmentLevel       = $"{educationDevelopmentLevel.Min()} - {educationDevelopmentLevel.Max()}";

            tempDataModel.ReligionsList = religionModelList;
            tempDataModel.SortReligionsListIntoReligionsShowCollection();

            string s = "";

            for (int x = 1; x < _fiefService.InformationList.Count; x++)
            {
                s += $"{_fiefService.InformationList[x].FiefName} : ";
                s += $"{_fiefService.InformationList[x].FiefType}, ";
                s += $"{_fiefService.InformationList[x].Roads}{Environment.NewLine}";
            }

            tempDataModel.SelectedAllInformationText = s;

            return(tempDataModel);
        }
Example #3
0
 public void SetDataModel(IDataModelBase dataModel, int index)
 {
     if (dataModel != null)
     {
         if (dataModel.GetType() == typeof(InformationDataModel))
         {
             InformationDataModel tempDataModel = (InformationDataModel)dataModel;
             _fiefService.InformationList[index] = (InformationDataModel)tempDataModel.Clone();
         }
         else if (dataModel.GetType() == typeof(ArmyDataModel))
         {
             ArmyDataModel tempDataModel = (ArmyDataModel)dataModel;
             _fiefService.ArmyList[index] = (ArmyDataModel)tempDataModel.Clone();
         }
         else if (dataModel.GetType() == typeof(EmployeesDataModel))
         {
             EmployeesDataModel tempDataModel = (EmployeesDataModel)dataModel;
             _fiefService.EmployeesList[index] = (EmployeesDataModel)tempDataModel.Clone();
         }
         else if (dataModel.GetType() == typeof(ManorDataModel))
         {
             ManorDataModel tempDataModel = (ManorDataModel)dataModel;
             _fiefService.ManorList[index] = (ManorDataModel)tempDataModel.Clone();
         }
         else if (dataModel.GetType() == typeof(BoatbuildingDataModel))
         {
             BoatbuildingDataModel tempDataModel = (BoatbuildingDataModel)dataModel;
             _fiefService.BoatbuildingList[index] = (BoatbuildingDataModel)tempDataModel.Clone();
         }
         else if (dataModel.GetType() == typeof(ExpensesDataModel))
         {
             ExpensesDataModel tempDataModel = (ExpensesDataModel)dataModel;
             _fiefService.ExpensesList[index] = (ExpensesDataModel)tempDataModel.Clone();
         }
         else if (dataModel.GetType() == typeof(StewardsDataModel))
         {
             StewardsDataModel tempDataModel = (StewardsDataModel)dataModel;
             for (int x = 0; x < _fiefService.StewardsList.Count; x++)
             {
                 _fiefService.StewardsList[x] = (StewardsDataModel)tempDataModel.Clone();
             }
         }
         else if (dataModel.GetType() == typeof(SubsidiaryDataModel))
         {
             SubsidiaryDataModel tempDataModel = (SubsidiaryDataModel)dataModel;
             _fiefService.SubsidiaryList[index] = (SubsidiaryDataModel)tempDataModel.Clone();
         }
         else if (dataModel.GetType() == typeof(IncomeDataModel))
         {
             IncomeDataModel tempDataModel = (IncomeDataModel)dataModel;
             _fiefService.IncomeList[index] = (IncomeDataModel)tempDataModel.Clone();
         }
         else if (dataModel.GetType() == typeof(BuildingsDataModel))
         {
             BuildingsDataModel tempDataModel = (BuildingsDataModel)dataModel;
             _fiefService.BuildingsList[index] = (BuildingsDataModel)tempDataModel.Clone();
         }
         else if (dataModel.GetType() == typeof(WeatherDataModel))
         {
             WeatherDataModel tempDataModel = (WeatherDataModel)dataModel;
             _fiefService.WeatherList[index] = (WeatherDataModel)tempDataModel.Clone();
         }
         else if (dataModel.GetType() == typeof(MinesDataModel))
         {
             MinesDataModel tempDataModel = (MinesDataModel)dataModel;
             _fiefService.MinesList[index] = (MinesDataModel)tempDataModel.Clone();
         }
         else if (dataModel.GetType() == typeof(PortDataModel))
         {
             PortDataModel tempDataModel = (PortDataModel)dataModel;
             _fiefService.PortsList[index] = (PortDataModel)tempDataModel.Clone();
         }
         else if (dataModel.GetType() == typeof(TradeDataModel))
         {
             TradeDataModel tempDataModel = (TradeDataModel)dataModel;
             _fiefService.TradeList[index] = (TradeDataModel)tempDataModel.Clone();
         }
         else
         {
             Console.WriteLine("ERROR!");
         }
     }
 }