Exemplo n.º 1
0
        private void fmprisoner_b_add_Click(object sender, RoutedEventArgs e)
        {
            prisoner prisoner = new prisoner();

            prisoner.firstname   = firstname.Text.ToString();
            prisoner.middlename  = middlename.Text.ToString();
            prisoner.lastname    = lastname.Text.ToString();
            prisoner.address     = address.Text.ToString();
            prisoner.age         = age.Text.ToString();
            prisoner.gender      = gender.Text.ToString();
            prisoner.birthdate   = birthdate.DisplayDate.ToString("yyyy-MM-dd");
            prisoner.height      = height.Text.ToString();
            prisoner.weight      = weight.Text.ToString();
            prisoner.citizenship = citizenship.Text.ToString();
            prisoner.religion    = religion.Text.ToString();
            prisoner.datein      = datein.DisplayDate.ToString("yyyy-MM-dd");
            prisoner.civilstatus = civilstatus.Text.ToString();
            prisoner.jailstatus  = jailstatus.Text.ToString();
            prisoner.add();
            this.Close();
            prisonermain pm = new prisonermain();

            //pm.Close();
            pm.Show();
            loading l = new loading();

            l.Show();
            MessageBox.Show("Successfully inserted!");
        }
Exemplo n.º 2
0
        private void update_cell_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DataGrid     dataGrid     = datagrid_cell;
                DataGridRow  Row          = (DataGridRow)dataGrid.ItemContainerGenerator.ContainerFromIndex(dataGrid.SelectedIndex);
                DataGridCell RowAndColumn = (DataGridCell)dataGrid.Columns[0].GetCellContent(Row).Parent;
                ((TextBlock)RowAndColumn.Content).Text = id.Text;
                con.Open();

                SqlCommand command = con.CreateCommand();
                command.CommandType = CommandType.Text;
                command.CommandText = "update cell set cell='" + cellnum.Text.ToString() + "', description= '" + description.Text.ToString() + "', num_inmates = '" + num_inmates.Text.ToString() + "', status = '" + status.Text.ToString() + "' where id = '" + id.Text + "'";
                command.ExecuteNonQuery();
                con.Close();
                MessageBox.Show("Successfully Updated!");
                edit.Visibility          = Visibility.Hidden;
                datagrid_cell.Visibility = Visibility.Visible;
                cellmain cm = new cellmain();
                cm.Show();
                loading l = new loading();
                l.Show();
                this.Close();
            }
            catch
            {
                MessageBox.Show("Invalid Inputs");
            }

            cellmain CM = new cellmain();

            CM.Show();
            this.Close();
        }
Exemplo n.º 3
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            DataGrid     dataGrid     = datagrid_escort;
            DataGridRow  Row          = (DataGridRow)dataGrid.ItemContainerGenerator.ContainerFromIndex(dataGrid.SelectedIndex);
            DataGridCell RowAndColumn = (DataGridCell)dataGrid.Columns[0].GetCellContent(Row).Parent;

            ((TextBlock)RowAndColumn.Content).Text = id.Text;
            con.Open();

            SqlCommand command = con.CreateCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "delete from escort where id = '" + id.Text + "'";
            command.ExecuteNonQuery();
            con.Close();
            MessageBox.Show("Successfully Deleted!");
            edit.Visibility            = Visibility.Hidden;
            datagrid_escort.Visibility = Visibility.Visible;
            this.Close();
            escort  es = new escort();
            loading l  = new loading();

            l.Show();
            es.Show();
        }
Exemplo n.º 4
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            this.Close();
            escort  es = new escort();
            loading l  = new loading();

            l.Show();
            es.Show();
        }
Exemplo n.º 5
0
        private void fmprisoner_b_cancel_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
            prisonermain pm = new prisonermain();

            loading l = new loading();

            l.Show();
            pm.Show();
        }
Exemplo n.º 6
0
        //DELETE BUTTON
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            DataGrid     dataGrid     = datagrid_prisoner;
            DataGridRow  Row          = (DataGridRow)dataGrid.ItemContainerGenerator.ContainerFromIndex(dataGrid.SelectedIndex);
            DataGridCell RowAndColumn = (DataGridCell)dataGrid.Columns[0].GetCellContent(Row).Parent;

            ((TextBlock)RowAndColumn.Content).Text = id.Text;
            con.Open();

            SqlCommand command = con.CreateCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "delete from prisoner where id = '" + id.Text + "'";
            command.ExecuteNonQuery();
            con.Close();
            MessageBox.Show("Successfully Deleted!");
            edit.Visibility = Visibility.Hidden;
            datagrid_prisoner.Visibility = Visibility.Visible;

            //audittrail
            //dashboard d = new dashboard();
            //audittrail au = new audittrail();
            //au.users = d.username.Text.ToString();
            //au.activity = "deleted  prisoner information";
            //au.dateOfActivity = DateTime.Now.ToString();
            //au.timeOfActivity = DateTime.Now.ToString("G");
            //au.add();

            parchive ar = new parchive();

            ar.firstname   = firstname.Text.ToString();
            ar.middlename  = middlename.Text.ToString();
            ar.lastname    = lastname.Text.ToString();
            ar.address     = address.Text.ToString();
            ar.age         = age.Text.ToString();
            ar.gender      = gender.Text.ToString();
            ar.birthdate   = birthdate.DisplayDate.ToString("yyyy-MM-dd");
            ar.height      = height.Text.ToString();
            ar.weight      = weight.Text.ToString();
            ar.citizenship = citizenship.Text.ToString();
            ar.religion    = religion.Text.ToString();
            ar.datein      = datein.DisplayDate.ToString("yyyy-MM-dd");
            ar.civilstatus = civilstatus.Text.ToString();
            ar.jailstatus  = jailstatus.Text.ToString();

            ar.add();

            this.Close();
            prisonermain pm = new prisonermain();

            pm.Show();
            loading l = new loading();

            l.Show();
        }
Exemplo n.º 7
0
        //EDIT-CANCELBUTTON
        private void add_cancel_cell_Click(object sender, RoutedEventArgs e)
        {
            edit.Visibility          = Visibility.Hidden;
            datagrid_cell.Visibility = Visibility.Visible;
            cell     p  = new cell();
            cellmain cm = new cellmain();

            cm.Show();
            loading l = new loading();

            l.Show();
            this.Close();
        }
Exemplo n.º 8
0
        //EDIT-CANCELBUTTON
        private void add_cancel_prisoner_Click(object sender, RoutedEventArgs e)
        {
            edit.Visibility = Visibility.Hidden;
            datagrid_prisoner.Visibility = Visibility.Visible;
            prisoner p = new prisoner();

            p.refreshTB_prisoner();
            this.Close();
            prisonermain pm = new prisonermain();

            pm.Show();

            loading l = new loading();

            l.Show();
        }
Exemplo n.º 9
0
        private void restore_Click(object sender, RoutedEventArgs e)
        {
            string       ident        = p.id.Text;
            DataGrid     dataGrid     = datagrid_archive;
            DataGridRow  Row          = (DataGridRow)dataGrid.ItemContainerGenerator.ContainerFromIndex(dataGrid.SelectedIndex);
            DataGridCell RowAndColumn = (DataGridCell)dataGrid.Columns[0].GetCellContent(Row).Parent;

            ((TextBlock)RowAndColumn.Content).Text = ident;
            con.Open();

            SqlCommand command = con.CreateCommand();

            command.CommandType = CommandType.Text;
            restore res = new restore();

            res.firstname   = p.firstname.Text.ToString();
            res.middlename  = p.middlename.Text.ToString();
            res.lastname    = p.lastname.Text.ToString();
            res.address     = p.address.Text.ToString();
            res.age         = p.age.Text.ToString();
            res.gender      = p.gender.Text.ToString();
            res.birthdate   = p.birthdate.DisplayDate.ToString("yyyy-MM-dd");
            res.height      = p.height.Text.ToString();
            res.weight      = p.weight.Text.ToString();
            res.citizenship = p.citizenship.Text.ToString();
            res.religion    = p.religion.Text.ToString();
            res.datein      = p.datein.DisplayDate.ToString("yyyy-MM-dd");
            res.civilstatus = p.civilstatus.Text.ToString();
            res.jailstatus  = p.jailstatus.Text.ToString();

            res.add();

            command.CommandText = "delete from archive_prisoner where id = '" + ident + "'";
            command.ExecuteNonQuery();
            con.Close();
            MessageBox.Show("Successfully Deleted!");

            this.Close();

            pm.Show();
            loading l = new loading();

            l.Show();
        }
Exemplo n.º 10
0
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     es.lastname  = lastname.Text.ToString();
     es.firstname = firstname.Text.ToString();
     es.position  = position.Text.ToString();
     es.escort    = p_id.Text.ToString();
     if (lastname.Text.ToString() != "" && firstname.Text.ToString() != "" && position.Text.ToString() != "" && p_id.Text.ToString() != "")
     {
         es.add();
         MessageBox.Show("Succesfully inserted!");
         this.Close();
         escort escort = new escort();
         escort.Show();
         loading l = new loading();
         l.Show();
     }
     else
     {
         MessageBox.Show("INVALID INPUTS!");
     }
 }
Exemplo n.º 11
0
        //UPDATE PRISONER
        private void update_prisoner_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DataGrid     dataGrid     = datagrid_prisoner;
                DataGridRow  Row          = (DataGridRow)dataGrid.ItemContainerGenerator.ContainerFromIndex(dataGrid.SelectedIndex);
                DataGridCell RowAndColumn = (DataGridCell)dataGrid.Columns[0].GetCellContent(Row).Parent;
                ((TextBlock)RowAndColumn.Content).Text = id.Text;
                con.Open();

                SqlCommand command = con.CreateCommand();
                command.CommandType = CommandType.Text;
                command.CommandText = "update prisoner set lastname='" + lastname.Text.ToString() + "', firstname= '" + firstname.Text.ToString() + "', middlename = '" + middlename.Text.ToString() + "', address = '" + address.Text.ToString() + "', age = '" + age.Text.ToString() + "', gender = '" + gender.Text.ToString() + "', birthdate = '" + birthdate.DisplayDate.ToString("yyyy-MM-dd") + "', height = '" + height.Text.ToString() + "', weight = '" + weight.Text.ToString() + "', citizenship= '" + citizenship.Text.ToString() + "', religion= '" + religion.Text.ToString() + "', datein= '" + datein.Text.ToString() + "', civilstatus = '" + civilstatus.Text.ToString() + "', jailstatus = '" + jailstatus.Text.ToString() + "' where id = '" + id.Text + "'";
                command.ExecuteNonQuery();
                con.Close();
                MessageBox.Show("Successfully Updated!");
                edit.Visibility = Visibility.Hidden;
                datagrid_prisoner.Visibility = Visibility.Visible;

                MainWindow d    = new MainWindow();
                audittrail au   = new audittrail();
                string     user = d.id_login.Text.ToString();
                au.users          = user;
                au.activity       = "update prisoner information";
                au.dateOfActivity = DateTime.Now.ToString();
                au.timeOfActivity = DateTime.Now.ToString("G");
                au.add();

                this.Close();
                prisonermain pm = new prisonermain();
                pm.Show();
                loading l = new loading();
                l.Show();
            }
            catch
            {
                MessageBox.Show("Invalid Inputs");
            }
        }