Пример #1
0
        private void addCrime_Click(object sender, EventArgs e)
        {
            int crimeId;
            int inmateId;

            if (Int32.TryParse(crimeDropDown?.SelectedItem?.ToString(), out crimeId) && Int32.TryParse(AddCrimeToInmateComboBox?.SelectedItem?.ToString(), out inmateId))
            {
                CrimeIDQueries.AddCrimeID(crimeId, inmateId);
                this.ResetGrid(inmateId);
            }
        }
Пример #2
0
        private void deleteBtn_Click(object sender, EventArgs e)
        {
            int id;
            int inmateID;

            if (Int32.TryParse(deleteTxt.Text, out id) && Int32.TryParse(DeleteCrimeOfInmateIDComboBox.SelectedItem.ToString(), out inmateID))
            {
                CrimeIDQueries.DeleteCrimeID(id, inmateID);
                this.ResetGrid(inmateID);
            }
        }
Пример #3
0
        private void ResetGrid(int inmateId)
        {
            this.crimeIDGrid.Rows.Clear();
            var crimeids = CrimeIDQueries.GetOneCrimeID(inmateId);

            foreach (var x in crimeids)
            {
                this.crimeIDGrid.Rows.Add(
                    x.ID,
                    x.CrimeID,
                    x.InmateID,
                    x.CrimeName
                    );
            }
        }
Пример #4
0
        public CrimeIDForm()
        {
            InitializeComponent();
            this.crimeIDGrid.Columns.Add("ID", "ID");
            this.crimeIDGrid.Columns.Add("Crime ID", "Crime ID");
            this.crimeIDGrid.Columns.Add("Inmate ID", "Inmate ID");
            this.crimeIDGrid.Columns.Add("Crime Name", "Crime Name");

            var IDs = CrimeIDQueries.PopulateDropDowns();

            foreach (string x in IDs)
            {
                FindInmateCombo.Items.Add(x);
                AddCrimeToInmateComboBox.Items.Add(x);
                DeleteCrimeOfInmateIDComboBox.Items.Add(x);
            }

            var crimes = CrimeIDQueries.getAllIdsOfCrimes();

            foreach (int x in crimes)
            {
                crimeDropDown.Items.Add(x);
            }
        }