private void ElimFildtgActReg_Click(object sender, RoutedEventArgs e) { if (dtgActReg.SelectedIndex >= 0) { if (MessageBox.Show("Desea eliminar la fila seleccionada?", "Confirmación", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { int j = 0; if (txtBsqActReg.Text == "") { j = dtgActReg.SelectedIndex; } else { actreg ar = dtgActReg.SelectedItem as actreg; int i = 0; foreach (actreg item in lar) { if (item.nr == ar.nr && item.tomo == ar.tomo) { j = i; } i++; } } lar.RemoveAt(j); txtBsqActReg_KeyUp(sender, null); } } }
private void dtgActReg_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (dtgActReg.SelectedIndex >= 0) { actreg ar = dtgActReg.SelectedItem as actreg; dpFechaCelebActReg.SelectedDate = ar.fcel; dpFechaProtActReg.SelectedDate = ar.fprot; txtNrActReg.Text = ar.nr; txtTomoActReg.Text = ar.tomo; txtPtosATratActReg.Text = ar.ptosatratar; // nr = ar.nr; tomo = ar.tomo; // } }
public void filtrar_coincidencias_dtgActReg(string valor) { List <actreg> laux = new List <actreg>(); actreg ar; foreach (actreg item in lar) { if (item.nr.Contains(valor) || item.tomo.Contains(valor)) { ar = new actreg(); ar = new actreg(); ar.fcel = item.fcel; ar.fprot = item.fprot; ar.nr = item.nr; ar.tomo = item.tomo; ar.ptosatratar = item.ptosatratar; ar.string_fcel = item.string_fcel; ar.string_fprot = item.string_fprot; laux.Add(ar); } } dtgActReg.ItemsSource = laux; }
private void btnGuardarActReg_Click(object sender, RoutedEventArgs e) { if (dpFechaCelebActReg.Text == "") { MessageBox.Show("Campo Fecha Celebración vacío", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (dpFechaProtActReg.Text == "") { MessageBox.Show("Campo Fecha Protocolización vacío", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (string.IsNullOrWhiteSpace(txtNrActReg.Text)) { MessageBox.Show("Campo N° vacío", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (string.IsNullOrWhiteSpace(txtTomoActReg.Text)) { MessageBox.Show("Campo Tomo vacío", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (string.IsNullOrWhiteSpace(txtPtosATratActReg.Text)) { MessageBox.Show("Campo Puntos a Tratar vacío", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } nar = new actreg(); nar.fcel = Convert.ToDateTime(dpFechaCelebActReg.SelectedDate); nar.fprot = Convert.ToDateTime(dpFechaProtActReg.SelectedDate); nar.nr = txtNrActReg.Text.ToUpper(); nar.tomo = txtTomoActReg.Text.ToUpper(); nar.ptosatratar = txtPtosATratActReg.Text.ToUpper(); nar.string_fcel = nar.fcel.ToShortDateString(); nar.string_fprot = nar.fprot.ToShortDateString(); if (nr == "") { lar.Add(nar); } else { foreach (actreg ar in lar) { if (nr == ar.nr && tomo == ar.tomo) { ar.fcel = nar.fcel; ar.fprot = nar.fprot; ar.nr = nar.nr; ar.tomo = nar.tomo; ar.ptosatratar = nar.ptosatratar; ar.string_fcel = nar.string_fcel; ar.string_fprot = nar.string_fprot; } } } dtgActReg.ItemsSource = lar; dtgActReg.Items.Refresh(); limpiar_item_actas_registradas(); txtBsqActReg_KeyUp(sender, null); }