private void button_Buscar_Viajes_Click(object sender, EventArgs e) { if ((textBox_Nombre.Text == "") && (textBox_Apellido.Text == "") && (textBox_DNI.Text == "")) { Mensaje_Error("Cargue el Cliente"); return; } if (dateTimePicker1.Value <= Globals.getDateFechaSistema()) { dataGridView_Viajes.DataSource = DAORendicionViaje.getViajes(Convert.ToInt32(persona.ID), Convert.ToDateTime(dateTimePicker1.Value), Convert.ToInt32(comboBox1.SelectedValue), Convert.ToDecimal(textBox1.Text)); if (dataGridView_Viajes.DataSource != null) { this.dataGridView_Viajes.Columns["ID"].Visible = false; } setTotal(); } else { Mensaje_Error("La fecha no puede ser a futuro"); return; } }
private void RendirViaje_Load(object sender, EventArgs e) { DataTable turnos = DAORendicionViaje.getTurnos(); comboBox1.ValueMember = "TURNO_ID"; comboBox1.DisplayMember = "TURNO_DESCRIPCION"; comboBox1.DataSource = turnos; dateTimePicker1.Value = Globals.getDateFechaSistema(); button_Buscar_Viajes_Click(sender, e); }
private void button_Aceptar_Click(object sender, EventArgs e) { if (textBox_Numero.Text != "A generar") { Mensaje_Error("Limpie los datos de la última operación"); return; } if (Validaciones()) { Mensaje_Error("No están todos los datos obligatorios"); return; } if (dataGridView_Viajes.RowCount == 0) { Mensaje_Error("No hay viajes para rendir"); return; } else { int rendNumero = DAORendicionViaje.viajeYaRendido(dataGridView_Viajes.Rows); if (rendNumero > 0) { Mensaje_Error("Los viajes ya han sido rendidos. Pago numero: " + rendNumero); textBox_Numero.Text = rendNumero.ToString(); return; } else { var resultado = Mensaje_Pregunta("¿Está seguro que desea realizar el pago?", "Generar Pago"); if (resultado == DialogResult.Yes) { try { DAORendicionViaje.crearRendicion(Convert.ToDateTime(dateTimePicker1.Value), Convert.ToInt32(persona.ID), Convert.ToInt32(comboBox1.SelectedValue), this.total, Convert.ToDecimal(textBox1.Text)); int numPago = DAORendicionViaje.buscarIDPagoInsertado(); textBox_Numero.Text = Convert.ToString(numPago); Mensaje_OK("El pago fue realizado con éxito"); button_Buscar_Viajes_Click(sender, e); } catch { Mensaje_Error("Falló la creación del pago en la base de datos"); } } } } }
private void cargarTodo() { this.fechaRendicion.Value = DateUtils.getDateFromConfig(); this.choferes = new List <ViajeChofer>(); this.turnos = new List <Turno>(); this.dao = new DAOViajes(); this.tur = new DAOAutomovil(); this.daoren = new DAORendicionViaje(); turnos = tur.getAllTurn(); this.cbTurno.Enabled = false; this.comboChofer.Enabled = false; this.btCalcular.Enabled = false; this.btRendir.Enabled = false; this.fechaRendicion.Enabled = true; setComboTurno(); dgViajesRealizados.DataSource = null; dgMontoTotal.DataSource = null; //dgViajesRealizados.Refresh(); //dgMontoTotal.Refresh(); }
private void cargarPorUsuario() { this.fechaRendicion.Value = DateUtils.getDateFromConfig(); this.choferes = new List <ViajeChofer>(); this.turnos = new List <Turno>(); this.dao = new DAOViajes(); this.tur = new DAOAutomovil(); this.daoren = new DAORendicionViaje(); this.cbTurno.Enabled = false; this.comboChofer.Enabled = false; this.btCalcular.Enabled = false; this.btRendir.Enabled = false; this.fechaRendicion.Enabled = true; turnos = tur.getAllTurn(); setComboTurno(); List <ViajeChofer> ca = daoren.getviajessinturno(this.idechofer); if (ca.Count().Equals(0)) { MessageBox.Show("Usted no posee viajes"); this.fechaRendicion.Enabled = false; } else { ViajeChofer c = ca.First(); this.idechofer = c.getId(); this.txtCNombre.Text = c.getName(); this.txtCApellido.Text = c.getLastname(); this.txtCDoc.Text = c.getDoc(); this.txtCTel.Text = c.getPhone(); this.txtCMail.Text = c.getEmail(); this.dtCFecha.Value = c.getDate(); //this.btCalcular.Enabled = true; dgViajesRealizados.DataSource = null; dgMontoTotal.DataSource = null; //dgViajesRealizados.Refresh(); //dgMontoTotal.Refresh(); } }