private void btnGuardaFDP_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(txtDescFDP.Text) || string.IsNullOrWhiteSpace(cmbEstatusFDP.SelectedItem.ToString()) || cmbEstatusFDP.SelectedIndex == -1) { MessageBox.Show("No debe dejar campos vacíos", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } formasdepago fdp = new formasdepago(); fdp.codigo = codigoFDP; fdp.descripcion = txtDescFDP.Text.ToUpper(); if (!fdp.existeFDP()) { fdp.estatus = cmbEstatusFDP.SelectedItem.ToString(); if (fdp.guardar_editar() == 1) { MessageBox.Show("Datos guardados satisfactoriamente", "Exitoso", MessageBoxButton.OK, MessageBoxImage.Information); btnNuevoFDP_Click(sender, e); //dtgFDP.ItemsSource = null; dtgFDP.ItemsSource = fdp.listar(); } else { MessageBox.Show("No se pudo guardar el registro", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void dtgFDP_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (dtgFDP.SelectedIndex != -1) { formasdepago item = dtgFDP.SelectedItem as formasdepago; codigoFDP = item.codigo; txtDescFDP.Text = item.descripcion; cmbEstatusFDP.SelectedItem = item.estatus; } }
private void txtDescFDP_LostFocus(object sender, RoutedEventArgs e) { formasdepago fdp = new formasdepago(); fdp.codigo = codigoFDP; fdp.descripcion = txtDescFDP.Text.ToUpper(); if (fdp.existeFDP()) { MessageBox.Show("Forma de Pago existente en la base de datos. Intente con otra descripción", "Error", MessageBoxButton.OK, MessageBoxImage.Error); if (codigoFDP == -1) { txtDescFDP.Text = ""; } } }
private void tbConfiguracion_Loaded(object sender, RoutedEventArgs e) { temporada tem = new temporada(); SqlDataReader sr = tem.listarTemporada(); DataTable dt = new DataTable(); dt.Columns.Add("temporada"); dt.Columns.Add("inicio"); dt.Columns.Add("fin"); dt.Columns.Add("infante"); dt.Columns.Add("ninio"); dt.Columns.Add("adulto"); dt.Columns.Add("hotel"); if (sr != null) { while (sr.Read()) { DataRow row = dt.NewRow(); row[0] = sr.GetString(6).Trim(new char[] { ' ' }); row[1] = sr.GetDateTime(1).ToShortDateString(); row[2] = sr.GetDateTime(2).ToShortDateString(); row[3] = sr.GetDouble(3).ToString("N2", CultureInfo.CreateSpecificCulture("es-VE")); row[4] = sr.GetDouble(4).ToString("N2", CultureInfo.CreateSpecificCulture("es-VE")); row[5] = sr.GetDouble(5).ToString("N2", CultureInfo.CreateSpecificCulture("es-VE")); row[6] = sr.GetString(7); dt.Rows.Add(row); } dtgCargos.ItemsSource = dt.DefaultView; sr.Close(); } cargo car = new cargo(); DataTable dtcar = new DataTable(); dtcar.Columns.Add("descripcion"); dtcar.Columns.Add("observacion"); sr = car.listar(); if (sr != null) { while (sr.Read()) { DataRow row = dtcar.NewRow(); //sr.GetString(2).Trim(new char[] { ' ' }) //condicion de validar si es nulo row[0] = sr.IsDBNull(1) ? "" : sr.GetString(1).Trim(new char[] { ' ' }); row[1] = sr.IsDBNull(2) ? "" : sr.GetString(1).Trim(new char[] { ' ' }); //row[0] = sr.GetString(1).Trim(new char[] { ' ' }); //row[1] = sr.GetString(2).Trim(new char[] { ' ' }); dtcar.Rows.Add(row); } dtgCargos1.ItemsSource = dtcar.DefaultView; sr.Close(); } montoPA mpa = new montoPA(); DataTable dtmon = new DataTable(); dtmon.Columns.Add("monto"); dtmon.Columns.Add("inicio"); dtmon.Columns.Add("fin"); dtmon.Columns.Add("observacion"); sr = mpa.buscartodos(); if (sr != null) { while (sr.Read()) { DataRow rowM = dtmon.NewRow(); rowM[0] = sr.GetDouble(0).ToString("N2", CultureInfo.CreateSpecificCulture("es-VE")); rowM[1] = sr.GetDateTime(2).ToShortDateString(); rowM[2] = sr.GetDateTime(3).ToShortDateString(); rowM[3] = sr.GetString(1); dtmon.Rows.Add(rowM); } dtgMontoPA.ItemsSource = dtmon.DefaultView; sr.Close(); } DataTable dtmontos = new DataTable(); dtmontos.Columns.Add("concepto"); dtmontos.Columns.Add("monto"); dtmontos.Columns.Add("ref"); sr = mpa.buscarmontos(); if (sr != null) { while (sr.Read()) { DataRow rowM = dtmontos.NewRow(); rowM[0] = sr.GetString(0); rowM[1] = sr.GetDouble(1).ToString("N2", CultureInfo.CreateSpecificCulture("es-VE")); rowM[2] = sr.GetInt32(2); dtmontos.Rows.Add(rowM); } dtgMontos.ItemsSource = dtmontos.DefaultView; sr.Close(); } cargar_cmbEstatusFDP(); formasdepago fdp = new formasdepago(); dtgFDP.ItemsSource = fdp.listar(); cargar_cmbEstatusBnc(); banco bnc = new banco(); dtgBnc.ItemsSource = bnc.listar(); cargar_cmbEstatusTT(); tipotarjeta tt = new tipotarjeta(); dtgTT.ItemsSource = tt.listar(); cargar_cmbEstatusUsr(); usuario usr = new usuario(); cmbPerfilUsr.ItemsSource = usr.listarPerfiles(); cmbPerfilUsr.DisplayMemberPath = "nombreperfil"; cmbPerfilUsr.SelectedValuePath = "codigo"; lusu = usr.listar(); dtgUsr.ItemsSource = lusu; dtgUsr.Items.Refresh(); //cmbPerfilUsr }