Esempio n. 1
0
        //Display Block info
        public static Crimes DisplayCrimeInfo(int CrimeID)
        {
            Crimes crime = null;

            using (SqlConnection sqlCon = new SqlConnection(connectionStr))
            {
                sqlCon.Open();
                if (sqlCon.State == System.Data.ConnectionState.Open)
                {
                    SqlCommand sqlCmd = new SqlCommand(@"SELECT CRIME.CrimeID, CRIME.Name, CRIME.Severity FROM CRIME WHERE CRIME.CrimeID = @CrimeID", sqlCon);
                    // string blockID = BlockID.ToString();
                    sqlCmd.Parameters.AddWithValue("@CrimeID", CrimeID);
                    SqlDataReader reader = sqlCmd.ExecuteReader();
                    while (reader.Read())
                    {
                        crime = new Crimes
                        {
                            CrimeID   = reader.GetInt32(reader.GetOrdinal("CrimeID")),
                            CrimeName = reader.GetString(reader.GetOrdinal("Name")).Trim(),
                            Severity  = reader.GetString(reader.GetOrdinal("Severity"))
                        };
                    }
                }
            }
            return(crime);
        }
Esempio n. 2
0
        private void findCrimeButton_Click(object sender, EventArgs e)
        {
            int    crimeIDVal = int.Parse(findCrimeIDTextbox.Text);
            Crimes crime1     = Queries.DisplayCrimeInfo(crimeIDVal);

            editCrimeNameTextBox.Text = crime1.CrimeName;
            Console.WriteLine(editCrimeNameTextBox.Text);
            editSeverityTextBox.Text = crime1.Severity.ToString();
            Console.WriteLine(editSeverityTextBox);
        }
Esempio n. 3
0
        private void AddCrime(string str)
        {
            var data  = str.Split(new string[] { "__" }, StringSplitOptions.None);
            var crime = new Crime(data[0], data[1]);

            if (Crimes.Add(crime))
            {
                CrimesAutoCompletion.Add(crime.Description);
                CrimesAutoCompletion.Add(crime.ToString());
            }
        }
Esempio n. 4
0
 private void Grid_MouseUp(object sender, MouseButtonEventArgs e)
 {
     try
     {
         Crimes path = Grid.SelectedItem as Crimes;
         MessageBox.Show("Идентификатор угрозы: " + path.Id + "\nНаименование угрозы: " + path.Name +
                         "\nОписание угрозы: " + path.Discription + "\nИсточник угрозы: " + path.Source
                         + "\nОбъект воздействия угрозы: " + path.ImpactedObject + "\nНарушение конфиденциальности: "
                         + path.Confidentiality + "\nНарушение целостности: " + path.Integrity + "\nНарушение доступности: " + path.Accessibility);
     }
     catch (Exception) { MessageBox.Show("Error"); }
 }
Esempio n. 5
0
        public void Each()
        {
            foreach (var key in Crimes.All)
            {
                var crimes = new Crimes(null);
                crimes.Add(key);
                var committed = crimes.AllCommitted();

                Assert.That(committed.Count, Is.EqualTo(1));
                Assert.That(committed[0], Is.EqualTo(key));
            }
        }
Esempio n. 6
0
        public static void ClearDictionaries()
        {
            States.Clear();
            Continents.Clear();
            PopTypes.Clear();
            Goods.Clear();
            CountryTags.Clear();
            Religions.Clear();
            Cultures.Clear();
            CultureGroups.Clear();
            Ideologies.Clear();
            Buildings.Clear();
            PolicyGroups.Clear();
            SubPolicies.Clear();
            Schools.Clear();
            Techs.Clear();
            Inventions.Clear();
            Units.Clear();
            Governments.Clear();
            Crimes.Clear();
            EventModifiers.Clear();
            NationalValues.Clear();
            Terrain.Clear();

            States         = null;
            Continents     = null;
            PopTypes       = null;
            Goods          = null;
            CountryTags    = null;
            Religions      = null;
            Cultures       = null;
            CultureGroups  = null;
            Ideologies     = null;
            Buildings      = null;
            PolicyGroups   = null;
            SubPolicies    = null;
            Schools        = null;
            Techs          = null;
            Inventions     = null;
            Units          = null;
            Governments    = null;
            Crimes         = null;
            EventModifiers = null;
            NationalValues = null;
            Terrain        = null;
        }
Esempio n. 7
0
        public void All()
        {
            var crimes = new Crimes(null);

            for (var i = 0; i < 2; i++)
            {
                foreach (var crime in Crimes.All)
                {
                    crimes.Add(crime);
                }
            }

            Assert.That(crimes.AllCommitted().Count, Is.EqualTo(Crimes.All.Count));

            foreach (var crime in Crimes.All)
            {
                Assert.That(crimes.AllCommitted(), Contains.Item(crime));
            }
        }
Esempio n. 8
0
        public Events(Location loc, int radius, int limit)
        {
            list = new ArrayList <Event>();
            Crimes           crimes           = new Crimes();
            TrafficCollision trafficCollision = new TrafficCollision();
            FireIncidents    fireIncidents    = new FireIncidents();

            crimes.get(loc, radius, limit);
            trafficCollision.get(loc, radius, limit);
            fireIncidents.get(loc, radius, limit);
            for (int i = 1; i < crimes.list.Length; i++)
            {
                Point point = new Point()
                {
                    lng = crimes.list[i].loc.longitude.ToString(),
                    lat = crimes.list[i].loc.latitude.ToString()
                };
                Event tmp = new Event(point, crimes.list[i].ToString());
                this.list.Add(tmp);
            }
            for (int i = 1; i < trafficCollision.list.Length; i++)
            {
                Point point = new Point()
                {
                    lng = trafficCollision.list[i].coordinate.longitude.ToString(),
                    lat = trafficCollision.list[i].coordinate.latitude.ToString()
                };
                Event tmp = new Event(point, trafficCollision.list[i].ToString());
                this.list.Add(tmp);
            }
            for (int i = 0; i < fireIncidents.list.Length; i++)
            {
                Point point = new Point()
                {
                    lng = fireIncidents.list[i].loc.longitude.ToString(),
                    lat = fireIncidents.list[i].loc.latitude.ToString()
                };
                Event tmp = new Event(point, fireIncidents.list[i].ToString());
                this.list.Add(tmp);
            }
        }
Esempio n. 9
0
 static void Main(string[] args)
 {
     Crimes crimes = new Crimes(args);
 }
        public void setLifeEvents()
        {
            int randomNumber = 0;

            while (lifeEvents.Count < numberOfLifeEvents)
            {
                randomNumber = DiceRoll.roll(1, 100);

                if (1 <= randomNumber && randomNumber <= 10)
                {
                    Tragedies tragedies = new Tragedies(parents, siblings);
                    lifeEvents.Add($"You suffered a tragedy. {tragedies.Roll()}");
                }
                else if (11 <= randomNumber && randomNumber <= 20)
                {
                    Boons boons = new Boons();
                    lifeEvents.Add($"You gained a bit of good fortune. {boons.Roll()}");
                    equipment.Add(boons.GetItem());
                }
                else if (21 <= randomNumber && randomNumber <= 30)
                {
                    Individual individual = Individual.generateIndividual();
                    if (lifeEvents.Contains("You fell in love or got married"))
                    {
                        lifeEvents.Add($"You had a child.\n{individual.getString()}");
                    }
                    else
                    {
                        lifeEvents.Add($"You fell in love or got married.\n{individual.getString()}");
                    }
                }
                else if (31 <= randomNumber && randomNumber <= 40)
                {
                    Individual adventurer = Individual.generateIndividual();
                    adventurer.relationship = "Hostile";
                    adventurer.setLivingStatus();

                    lifeEvents.Add($"You made an enemy of an adventurer. You are {(DiceRoll.roll(1, 6) % 2 == 0 ? "to blame" : "blameless")} for the rift between you two. " +
                                   $"Work with your DM to determine this hostile character’s identity and the danger this enemy poses to you.\n{adventurer.getString()}");
                }
                else if (41 <= randomNumber && randomNumber <= 50)
                {
                    Individual adventurer = Individual.generateIndividual();
                    adventurer.relationship = "Friendly";
                    adventurer.setLivingStatus();

                    lifeEvents.Add($"You made a friend of an adventurer. Work with your DM to add more detail to this friendly character and establish how your friendship began.\n{adventurer.getString()}");
                }
                else if (51 <= randomNumber && randomNumber <= 70)
                {
                    lifeEvents.Add("You spent time working in a job related to your background. Start the game with an extra 2d6 gp.");
                }
                else if (71 <= randomNumber && randomNumber <= 75)
                {
                    Individual individual = Individual.generateIndividual();
                    lifeEvents.Add($"You met someone important. Work out additional details with your DM as needed to fit this character into your backstory.\n{individual.getString()}");
                }
                else if (76 <= randomNumber && randomNumber <= 80)
                {
                    Adventures adventures = new Adventures();
                    lifeEvents.Add($"You went on an adventure. {adventures.Roll()} Work with your DM to determine the nature of the adventure and the creatures you encountered.");
                    equipment.Add(adventures.GetItem());
                }
                else if (81 <= randomNumber && randomNumber <= 85)
                {
                    SupernaturalEvents supernaturalEvents = new SupernaturalEvents();
                    lifeEvents.Add($"You had a supernatural experience. {supernaturalEvents.Roll()}");
                }
                else if (86 <= randomNumber && randomNumber <= 90)
                {
                    Wars wars = new Wars();
                    lifeEvents.Add($"You fought in a battle. {wars.Roll()} Work with your DM to come up with the reason for the battle and the factions involved. It might have been a small conflict between your community and a band of orcs, or it could have been a major battle in a larger war.");
                }
                else if (91 <= randomNumber && randomNumber <= 95)
                {
                    Crimes      crimes      = new Crimes();
                    Punishments punishments = new Punishments();

                    lifeEvents.Add($"You committed a crime or were wrong accused of doing so, the nature of which was was {crimes.Roll()}. {punishments.Roll()}");
                }
                else if (96 <= randomNumber && randomNumber <= 99)
                {
                    lifeEvents.Add($"You encountered something magical. {new ArcaneMatters().Roll()}");
                }
                else if (randomNumber == 100)
                {
                    WeirdStuff weirdStuff = new WeirdStuff();
                    lifeEvents.Add($"Something truly strange happened to you. {weirdStuff.Roll()}");
                }
            }
        }