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(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { this.Close(); escort es = new escort(); loading l = new loading(); l.Show(); es.Show(); }
private void update_Click(object sender, RoutedEventArgs e) { escort cm = new escort(); con.Open(); SqlCommand command = con.CreateCommand(); command.CommandType = CommandType.Text; command.CommandText = "update escort set firstname = '" + firstname.Text.ToString() + "', lastname = '" + lastname.Text.ToString() + "', position = '" + position.Text.ToString() + "' , escort = '" + p_id.Text.ToString() + "' where id = '" + id.Text + "'"; command.ExecuteNonQuery(); MessageBox.Show("Successfully Updated!!"); con.Close(); }
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!"); } }
private void Button_Click_2(object sender, RoutedEventArgs e) { escort main = new escort(); main.Show(); }