예제 #1
0
        private void button_getVictims_Click(object sender, EventArgs e)
        {
            button_getVictims.Enabled = false;

            Victim[] victims                         = VictimsManager.GetVictimsOfCrime(this.crime.id);

            foreach (var victim in victims)
            {
                victim.items_stolen=StolenItemsManager.GetVictimsStolenItems(victim.id);
                VictimsDetailsForm form = new VictimsDetailsForm(victim);
                form.Show();
            }
        }
예제 #2
0
        private void button_getVictims_Click(object sender, EventArgs e)
        {
            button_getVictims.Enabled = false;

            Victim[] victims = VictimsManager.GetVictimsOfCrime(this.crime.id);

            foreach (var victim in victims)
            {
                victim.items_stolen = StolenItemsManager.GetVictimsStolenItems(victim.id);
                VictimsDetailsForm form = new VictimsDetailsForm(victim);
                form.Show();
            }
        }
예제 #3
0
        private void save_button_Click(object sender, EventArgs e)
        {
            //DISABLE BUTTON
            button_save.Enabled = false;

            //get crime details
            String date_of_crime     = dateTimePicker_dateOfCrime.Text;
            String time_of_crime     = GetTimeOfCrime();
            String type_of_crime     = comboBox_type_of_crime.Text;
            String crime_commited    = comboBox_crimeCommited.Text;
            String details_of_crime  = textfield_details_of_crime.Text;
            String location_of_crime = textfield_crime_location.Text;

            //create crime object
            Crime crime = new Crime(date_of_crime, details_of_crime, type_of_crime, crime_commited, time_of_crime, location_of_crime, -1);


            //if the crime selected has victims
            if (comboBox_type_of_crime.Text.Equals(types_of_crimes[0]) || comboBox_type_of_crime.Text.Equals(types_of_crimes[1]))
            {
                //create victims form
                VictimsDetailsForm form = new VictimsDetailsForm(perpetrator, crime);

                //close this form
                this.Close();

                //show it
                form.ShowDialog();

                //return
                return;
            }

            // we are dealing with a victimless crime
            else
            {
                Debug.WriteLine("Text                =" + comboBox_crimeCommited.Text);
                Debug.WriteLine("This Crime Has No Victims");
                //save perpetrator
                PerpetratorsManager.Save(perpetrator);

                //set the id of the perpetrator
                crime.perpetrator_id = perpetrator.id;


                //save crime
                bool sucess = CrimesManager.Save(crime);
            }

            //display error message
        }
예제 #4
0
        private void save_button_Click(object sender, EventArgs e)
        {
            //DISABLE BUTTON
            button_save.Enabled = false;

            //get crime details
            String date_of_crime                     = dateTimePicker_dateOfCrime.Text;
            String time_of_crime                     = GetTimeOfCrime();
            String type_of_crime                     = comboBox_type_of_crime.Text;
            String crime_commited                    = comboBox_crimeCommited.Text;
            String details_of_crime                  = textfield_details_of_crime.Text;
            String location_of_crime = textfield_crime_location.Text;

            //create crime object
            Crime crime                              = new Crime(date_of_crime, details_of_crime, type_of_crime, crime_commited, time_of_crime,location_of_crime,-1);

            //if the crime selected has victims
            if (comboBox_type_of_crime.Text.Equals(types_of_crimes[0]) || comboBox_type_of_crime.Text.Equals(types_of_crimes[1]))
            {

                //create victims form
                VictimsDetailsForm form              = new VictimsDetailsForm(perpetrator, crime);

                //close this form
                this.Close();

                //show it
                form.ShowDialog();

                //return
                return;
            }

            // we are dealing with a victimless crime
            else
            {
                Debug.WriteLine("Text                =" + comboBox_crimeCommited.Text);
                Debug.WriteLine("This Crime Has No Victims");
                //save perpetrator
                PerpetratorsManager.Save(perpetrator);

                //set the id of the perpetrator
                crime.perpetrator_id                 = perpetrator.id;

                //save crime
                bool sucess                          = CrimesManager.Save(crime);

            }

            //display error message
        }