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(); }
private void button1_Click(object sender, EventArgs e) { restore rt = new restore(); rt.Show(); }
private void dbRestore_Click(object sender, EventArgs e) { restore frm = new restore(); CheckFormStatus(frm); }