private static DAL.Reserva GetInstance() { if (reserva_dal == null) { reserva_dal = new DAL.Reserva(); } return(reserva_dal); }
private void btnGuardar_Click(object sender, EventArgs e) { //DateTime fechaHoy = DateTime.Now; //MessageBox.Show("Campo " + fechaHoy, "ERROR"); try { //tarifa.Precio += 20; //MessageBox.Show("Campo " + tarifa.Precio + " " + tarifa.IdTarifa, "ERROR"); DAL.Reserva reservea = new DAL.Reserva(); reservea.Fecha_I = dtpInicio.Value; reservea.Fecha_F = dtpFin.Value; reservea.IdCliente = Convert.ToInt32(cmboxCliente.SelectedValue); reservea.IdTarifa = tarifa.IdTarifa; foreach (DataGridViewRow item in dgvAutos.Rows) { if (item.Cells[6].Value != null || Convert.ToInt32(item.Cells[6].Value) != 0) { DAL.DetalleReserva detalle = new DAL.DetalleReserva(); detalle.Placa = item.Cells[0].Value.ToString(); detalle.IdTipoVehiculo = Convert.ToInt32(item.Cells[1].Value); detalle.Hora_I = item.Cells[2].Value.ToString(); detalle.Hora_F = item.Cells[3].Value.ToString(); detalle.IdPosicion = Convert.ToInt32(item.Cells[4].Value); reservea.setReservaCliente(detalle); } } } catch (SqlException ex) { throw ex; } catch (Exception ex) { throw ex; } }