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);
            }
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            AdminLogin al = pl.AdminLogins.Single(AdminLogin => AdminLogin.Userid == 1);

            try
            {
                if (textBox3.Text == textBox4.Text && textBox3.Text != "" && textBox4.Text != "")
                {
                    al.Password = textBox4.Text;
                    al.Email    = textBox2.Text;
                    al.UserName = textBox1.Text;
                    pl.SubmitChanges();
                    MessageBox.Show("Profile Successfully Updated !");
                    this.Hide();
                    Add_New_Criminal_Information a = new Add_New_Criminal_Information();
                    a.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Password Doesn't Match !");
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
Пример #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);
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         CrimeInfo ci = new CrimeInfo();
         ci.Criminal_ID = int.Parse(textBox1.Text);
         ci.Crime       = comboBox1.Text;
         ci.Year        = int.Parse(textBox3.Text);
         ci.Area        = textBox4.Text;
         ci.Age         = int.Parse(textBox2.Text);
         db.CrimeInfos.InsertOnSubmit(ci);
         db.SubmitChanges();
         MessageBox.Show("Information Inserted !!");
         this.Hide();
         Matched_Criminal_History_Form f = new Matched_Criminal_History_Form(int.Parse(textBox1.Text));
         f.ShowDialog();
     }
     catch (Exception ee)
     {
         MessageBox.Show(ee.Message);
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         AdminLogin al = pl.AdminLogins.Single(AdminLogin => AdminLogin.Email == email);
         if (textBox1.Text == textBox2.Text && textBox1.Text != "" && textBox2.Text != "")
         {
             al.Password = textBox1.Text;
             pl.SubmitChanges();
             MessageBox.Show("Password Successfully Changed !");
             this.Hide();
             adminLogin a = new adminLogin();
             a.ShowDialog();
         }
         else
         {
             MessageBox.Show("Password Doesn't Match !!");
         }
     }
     catch (Exception ex)
     {
     }
 }