private void Add_Click(object sender, EventArgs e)
        {
            string          points     = Points_textBox.Text;
            string          image_Text = openFileDialog1.FileName;
            involved_people inp        = new involved_people(Age_txt.Text, Name_txt.Text, Location_txt.Text, image_Text, points);

            // ID_txt.Text = counter.ToString();
            inp.name     = Name_txt.Text;
            inp.age      = Age_txt.Text;
            inp.location = Location_txt.Text;
            inp.image    = image_Text;
            listi.Add(inp);
            read_IDs();

            int n = dataGridView1.Rows.Add();

            dataGridView1.Rows[n].Cells[0].Value = ID_txt.Text;
            dataGridView1.Rows[n].Cells[1].Value = Name_txt.Text;
            dataGridView1.Rows[n].Cells[2].Value = Age_txt.Text;
            dataGridView1.Rows[n].Cells[3].Value = Location_txt.Text;
            dataGridView1.Rows[n].Cells[4].Value = image_Text;
            dataGridView1.Rows[n].Cells[5].Value = Points_textBox.Text;
            inp.Suspects_IDs(ID_txt.Text);
            inp.add_suspect_in_list(ID_txt.Text, Age_txt.Text, Name_txt.Text, Location_txt.Text, image_Text, points);
            clear();
        }
        private void Edit_Click(object sender, EventArgs e)
        {
            selected_row = dataGridView1.CurrentCell.RowIndex;
            DataGridViewRow newDataRow = dataGridView1.Rows[selected_row];
            string          image_Text = newDataRow.Cells[4].Value.ToString();

            // newDataRow.Cells[3].Value = image_Text;
            involved_people inp = new involved_people(Age_txt.Text, Name_txt.Text, Location_txt.Text, image_Text, Points_textBox.Text);
            ////////////////////////// lazm a check bl id ////////////////////
            string check = newDataRow.Cells[0].Value.ToString();

            // MessageBox.Show(check);
            try
            {
                inp.update_suspect(check, Name_txt.Text, Age_txt.Text, Location_txt.Text, Points_textBox.Text);

                newDataRow.Cells[0].Value = ID_txt.Text;
                newDataRow.Cells[1].Value = Name_txt.Text;
                newDataRow.Cells[2].Value = Age_txt.Text;
                newDataRow.Cells[3].Value = Location_txt.Text;
                newDataRow.Cells[5].Value = Points_textBox.Text;
                clear();
            }
            catch (Exception)
            {
            }
        }
示例#3
0
 bool add_suspect(involved_people iv)
 {
     if (!criminals.ContainsKey(iv.id))
     {
         criminals.Add(iv.id, iv);
         iv.add_case(id);
         // el fn dy beta5od el string el hwa id beta3 el case te7oto
         //lel suspect fe el crime list beto3o
         return(true);
     }
     else
     {
         return(false);
     }
 }
 private void Delete_Click(object sender, EventArgs e)
 {
     try
     {
         selected_row = dataGridView1.CurrentCell.RowIndex;
         DataGridViewRow newDataRow = dataGridView1.Rows[selected_row];
         string          image_Text = newDataRow.Cells[4].Value.ToString();
         involved_people inp        = new involved_people(Age_txt.Text, Name_txt.Text, Location_txt.Text, image_Text, Points_textBox.Text);
         /////////////////// lazm a check bl id////////////
         string check = newDataRow.Cells[0].Value.ToString();
         inp.delete_suspect(check);
         dataGridView1.Rows.RemoveAt(selected_row);
         clear();
     }
     catch (Exception)
     {
     }
 }