Exemple #1
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();
        }
Exemple #2
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();
        }