private void button3_Click(object sender, EventArgs e)
        {
            //dataGridView1.Refresh();
            ProjectLINQDataContext pl2 = new ProjectLINQDataContext();
            Criminal_Info          cif = pl2.Criminal_Infos.SingleOrDefault(Criminal_Info => Criminal_Info.Criminal_ID == int.Parse(textBox2.Text));

            try
            {
                if (pl2 != null)
                {
                    pl2.Criminal_Infos.DeleteOnSubmit(cif);
                    pl2.SubmitChanges();
                    MessageBox.Show("Deleted Successfully");
                    dataGridView1.DataSource = pl2.Criminal_Infos;
                    dataGridView1.Refresh();
                    textBox2.Text  = null;
                    textBox3.Text  = null;
                    textBox4.Text  = null;
                    comboBox1.Text = null;
                    textBox6.Text  = null;
                    textBox7.Text  = null;
                }
                else
                {
                    MessageBox.Show("Data not found");
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                Criminal_Info ci = db.Criminal_Infos.Single(Criminal_Info => Criminal_Info.Finger_Print == path1);

                if (ci != null)
                {
                    MessageBox.Show("Fingerprint Macthed");
                    this.Hide();
                    Matched_Criminal_History_Form fp = new Matched_Criminal_History_Form(ci.Criminal_ID);
                    fp.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Fingerprint doesn't Match");
                    this.Hide();
                    Add_New_Criminal_Information al = new Add_New_Criminal_Information();
                    al.ShowDialog();
                }
            }

            catch (Exception ex)
            {
                // MessageBox.Show(ex.Message);
                MessageBox.Show("Fingerprint doesn't Match");
                this.Hide();
                Add_New_Criminal_Information al = new Add_New_Criminal_Information();
                al.ShowDialog();
            }
        }
Ejemplo n.º 3
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         Criminal_Info cf = new Criminal_Info();
         cf.Finger_Print = str1;
         cf.Photo        = str;
         cf.Name         = textBox1.Text;
         cf.NID_No_      = int.Parse(textBox3.Text);
         cf.Gender       = g;
         cf.DOB          = textBox6.Text;
         cf.Birth_Place  = textBox2.Text;
         cf.Blood_Group  = comboBox3.Text;
         DateTime current = DateTime.Now;
         int      age     = current.Year - int.Parse(textBox6.Text);
         cf.Age = age;
         db.Criminal_Infos.InsertOnSubmit(cf);
         db.SubmitChanges();
         MessageBox.Show("Information Inserted");
     }
     catch (Exception ee)
     {
         MessageBox.Show(ee.Message);
     }
 }
        private void button2_Click(object sender, EventArgs e)
        {
            ProjectLINQDataContext pl     = new ProjectLINQDataContext();
            DataGridViewRow        newrow = dataGridView1.Rows[indexRow];
            Criminal_Info          ci     = pl.Criminal_Infos.Single(Criminal_Info => Criminal_Info.Criminal_ID == int.Parse(textBox2.Text));

            try
            {
                if (ci != null)
                {
                    ci.Name        = textBox3.Text;
                    ci.DOB         = textBox4.Text;
                    ci.Blood_Group = comboBox1.Text;
                    ci.Birth_Place = textBox7.Text;
                    ci.NID_No_     = int.Parse(textBox6.Text);
                    pl.SubmitChanges();
                    newrow.Cells[1].Value = textBox3.Text;
                    newrow.Cells[1].Value = textBox3.Text;
                    newrow.Cells[3].Value = textBox4.Text;
                    newrow.Cells[4].Value = comboBox1.Text;
                    newrow.Cells[5].Value = textBox7.Text;
                    newrow.Cells[6].Value = textBox6.Text;
                    MessageBox.Show("Profile Successfully Updated !");
                    textBox2.Text  = null;
                    textBox3.Text  = null;
                    textBox4.Text  = null;
                    comboBox1.Text = null;
                    textBox6.Text  = null;
                    textBox7.Text  = null;
                }

                else
                {
                    MessageBox.Show("Data Not found");
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
        public Matched_Criminal_History_Form(int s)
        {
            InitializeComponent();

            this.s = s;
            using (data)
            {
                Criminal_Info ci = data.Criminal_Infos.Single(Criminal_Info => Criminal_Info.Criminal_ID == s);
                if (ci != null)
                {
                    textBox7.Text = ci.Criminal_ID.ToString();
                    textBox1.Text = ci.Name;
                    textBox8.Text = ci.Gender;
                    textBox3.Text = ci.DOB;
                    DateTime current = DateTime.Now;
                    int      age     = current.Year - int.Parse(ci.DOB);
                    textBox4.Text     = age.ToString();
                    textBox2.Text     = ci.Blood_Group;
                    textBox5.Text     = ci.Birth_Place;
                    textBox6.Text     = ci.NID_No_.ToString();
                    pictureBox1.Image = Image.FromFile(ci.Photo);
                }
            }
        }
 partial void DeleteCriminal_Info(Criminal_Info instance);
 partial void UpdateCriminal_Info(Criminal_Info instance);
 partial void InsertCriminal_Info(Criminal_Info instance);