Exemplo n.º 1
0
        public bail(int id)
        {
            SqlDbConnection con = new SqlDbConnection();

            con.Adaptor("select * from bail where id=" + id.ToString());
            DataTable dt = con.Fill();

            this.id         = dt.Rows[0].Field <int>("id");
            this.inmatename = dt.Rows[0].Field <String>("inmatename");
            this.inmatenum  = dt.Rows[0].Field <String>("inmatenumber");
            this.offense    = dt.Rows[0].Field <String>("offense");
            this.cases      = dt.Rows[0].Field <String>("cases");
            this.datebailed = dt.Rows[0].Field <String>("datebailed");
            this.bond       = dt.Rows[0].Field <String>("bond");
            this.court      = dt.Rows[0].Field <String>("court");
            this.approved   = dt.Rows[0].Field <String>("approved");
        }
Exemplo n.º 2
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string          query = "select * from jailofficer where lastname = '" + lastname.Text.ToString() + "'";
            SqlCommand      coms  = new SqlCommand(query, con);
            SqlDbConnection cons  = new SqlDbConnection();

            cons.Adaptor(query);
            DataTable dt = cons.Fill();

            con.Open();
            SqlDataReader reads = coms.ExecuteReader();

            while (reads.Read())
            {
                string fn = (reads["firstname"].ToString());
                string ln = (reads["lastname"].ToString());
                string mn = (reads["middlename"].ToString());
                string p  = (reads["position"].ToString());

                if (firstname.Text != fn && lastname.Text != ln && middlename.Text != mn && position.Text != p)
                {
                    if (position.Text != "" && lastname.Text != "" && firstname.Text != "" && address0.Text != "" && address1.Text != "" && birthdate.Text != "" &&
                        age.Text != "" && username.Text != "" && password.Password != "")
                    {
                        MD5 md5Hash = MD5.Create();
                        // Create a new instance of the MD5CryptoServiceProvider object.
                        MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider();

                        // Convert the input string to a byte array and compute the hash.
                        byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(password.Password));

                        // Create a new Stringbuilder to collect the bytes
                        // and create a string.
                        StringBuilder sBuilder = new StringBuilder();

                        // Loop through each byte of the hashed data
                        // and format each one as a hexadecimal string.
                        for (int i = 0; i < data.Length; i++)
                        {
                            sBuilder.Append(data[i].ToString("x2"));
                        }

                        string address = address0.Text.ToString() + " " + address1.Text.ToString();
                        string cmnd    = "insert into jailofficer values('" + position.Text.ToString() + "', '" + lastname.Text.ToString() + "', '" + firstname.Text.ToString() + "',' " + middlename.Text.ToString() + "',";
                        cmnd += "  '" + address.ToString() + "','" + birthdate.Text.ToString() + "','" + age.Text.ToString() + "','" + username.Text.ToString() + "','" + password.Password.ToString() + "','" + "" + "','" + "" + "','" + "" + "','" + "" + "')";

                        con.Open();
                        SqlCommand command = con.CreateCommand();
                        command.CommandType = CommandType.Text;
                        command.CommandText = cmnd;
                        command.ExecuteNonQuery();
                        con.Close();
                        this.Close();
                        position.Text       = "";
                        lastname.Text       = "";
                        firstname.Text      = "";
                        middlename.Text     = "";
                        address0.Text       = "";
                        address1.Text       = "";
                        birthdate.Text      = "";
                        age.Text            = "";
                        username.Text       = "";
                        password.Password   = "";
                        xpassword.Password  = "";
                        registers.IsEnabled = false;
                        MessageBox.Show("Congratulations, You have an Account!");
                    }

                    else
                    {
                        MessageBox.Show("INVALID INPUTS!");
                    }
                }
                else
                {
                    MessageBox.Show("THIS VISITOR IS ALREADY IN THE DATABASE");
                    position.Text       = "";
                    lastname.Text       = "";
                    firstname.Text      = "";
                    middlename.Text     = "";
                    address0.Text       = "";
                    address1.Text       = "";
                    birthdate.Text      = "";
                    age.Text            = "";
                    username.Text       = "";
                    password.Password   = "";
                    xpassword.Password  = "";
                    registers.IsEnabled = false;
                }
            }
            reads.Close();
            con.Close();
        }
Exemplo n.º 3
0
        private void train_detect_Click(object sender, RoutedEventArgs e)
        {
            SqlConnection cons = new SqlConnection(@"Data Source=DESKTOP-RVI30EH\SQLEXPRESS;Initial Catalog=jms;Integrated Security=True");

            string          query = "select * from " + type;
            SqlCommand      coms  = new SqlCommand(query, cons);
            SqlDbConnection con   = new SqlDbConnection();

            cons.Open();
            //getting sql data from case registration prisoner to prisoner main
            SqlDataReader read = coms.ExecuteReader();

            string firstname;

            while (read.Read())
            {
                if (read["firstname"].ToString() == face_persons.Text.ToString())
                {
                    firstname = read["firstname"].ToString();
                    string identifier = read["id"].ToString();

                    frame_active = false;
                    MessageBox.Show("A face is detected");
                    this.Close();

                    if (type == "prisoner")
                    {
                        prisonermain pm = new prisonermain();
                        pm.Show();
                        pm.datagrid_prisoner.Visibility = Visibility.Hidden;
                        pm.edit.Visibility  = Visibility.Visible;
                        pm.firstname.Text   = read["firstname"].ToString();
                        pm.middlename.Text  = read["middlename"].ToString();
                        pm.birthdate.Text   = read["birthdate"].ToString();
                        pm.lastname.Text    = read["lastname"].ToString();
                        pm.address.Text     = read["address"].ToString();
                        pm.age.Text         = read["age"].ToString();
                        pm.gender.Text      = read["gender"].ToString();
                        pm.weight.Text      = read["weight"].ToString();
                        pm.height.Text      = read["height"].ToString();
                        pm.citizenship.Text = read["citizenship"].ToString();
                        pm.religion.Text    = read["religion"].ToString();
                        pm.datein.Text      = read["datein"].ToString();
                        pm.civilstatus.Text = read["civilstatus"].ToString();
                        pm.jailstatus.Text  = read["jailstatus"].ToString();
                    }

                    if (type == "visitor")
                    {
                        visitormain pm = new visitormain();
                        pm.Show();
                        pm.datagrid_visitor.Visibility = Visibility.Hidden;
                        pm.edit_visitor.Visibility     = Visibility.Visible;
                        pm.id.Text         = read["id"].ToString();
                        pm.relation.Text   = read["relation"].ToString();
                        pm.lastname.Text   = read["lastname"].ToString();
                        pm.firstname.Text  = read["firstname"].ToString();
                        pm.middlename.Text = read["middlename"].ToString();
                        pm.address0.Text   = read["address"].ToString();
                        pm.gender.Text     = read["gender"].ToString();
                        pm.relation.Text   = read["relation"].ToString();
                    }
                    break;
                }

                //else
                //{
                //    MessageBox.Show("FACE NOT FOUND ON '"+ type +"' LISTS");
                //}
            }

            read.Close();
            cons.Close();
        }
Exemplo n.º 4
0
        //EDIT A PRISONER
        private void datagrid_case_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            prisonermain pms = new prisonermain();

            pms.Show();
            pms.datagrid_prisoner.Visibility = Visibility.Hidden;
            pms.edit.Visibility              = Visibility.Visible;
            pms.bail.Visibility              = Visibility.Hidden;
            pms.hearing_schedule.Visibility  = Visibility.Hidden;
            pms.cell_transfer.Visibility     = Visibility.Hidden;
            pms.cell_registration.Visibility = Visibility.Hidden;
            pms.case_registration.Visibility = Visibility.Visible;
            pms.save_case.Visibility         = Visibility.Hidden;
            pms.update_case.Visibility       = Visibility.Visible;

            DataGrid    gd           = (DataGrid)sender;
            DataRowView row_selected = gd.SelectedItem as DataRowView;

            if (row_selected != null)
            {
                SqlConnection cons = new SqlConnection(@"Data Source=DESKTOP-RVI30EH\SQLEXPRESS;Initial Catalog=jms;Integrated Security=True");
                //pm.inmate_name.Text = row_selected["inmatename"].ToString();
                pms.inmatenum.Text  = row_selected["inmatenum"].ToString();
                pms.casenum.Text    = row_selected["casenum"].ToString();
                pms.offense1.Text   = row_selected["offense"].ToString();
                pms.datefiled.Text  = row_selected["datefiled"].ToString();
                pms.datesen.Text    = row_selected["datesen"].ToString();
                pms.senstatus.Text  = row_selected["senstatus"].ToString();
                pms.senreceive.Text = row_selected["senreceive"].ToString();
                pms.sendue.Text     = row_selected["sendue"].ToString();
                string          identifier = row_selected["inmatenum"].ToString();
                string          query      = "select * from prisoner where id = '" + identifier + "'";
                SqlCommand      coms       = new SqlCommand(query, cons);
                SqlDbConnection con        = new SqlDbConnection();

                con.Adaptor(query);
                DataTable dt = con.Fill();

                cons.Open();
                //getting sql data from case registration prisoner to prisoner main
                SqlDataReader read = coms.ExecuteReader();
                while (read.Read())
                {
                    pms.id.Text          = (read["id"].ToString());
                    pms.firstname.Text   = (read["firstname"].ToString());
                    pms.lastname.Text    = (read["lastname"].ToString());
                    pms.birthdate.Text   = (read["birthdate"].ToString());
                    pms.middlename.Text  = (read["middlename"].ToString());
                    pms.address.Text     = (read["address"].ToString());
                    pms.age.Text         = (read["age"].ToString());
                    pms.gender.Text      = (read["gender"].ToString());
                    pms.weight.Text      = (read["weight"].ToString());
                    pms.height.Text      = (read["height"].ToString());
                    pms.citizenship.Text = (read["citizenship"].ToString());
                    pms.religion.Text    = (read["religion"].ToString());
                    pms.datein.Text      = (read["datein"].ToString());
                    pms.civilstatus.Text = (read["civilstatus"].ToString());
                    pms.jailstatus.Text  = (read["jailstatus"].ToString());
                }
                read.Close();
                cons.Close();
            }
        }