Example #1
0
 public static void mostrarCuenta(int pos)
 {
     Alquiler alq = new Alquiler();
     alq = BRL.AlquilerBRL.busquedaporPlaca(placas[pos]);
     CuentaAlquiler cuenta = new CuentaAlquiler(alq);
     cuenta.ShowDialog();
 }
Example #2
0
 public static void insertarAlquiler(Alquiler alq)
 {
     DAL.Alquiler.insertarAlquiler(alq);
 }
Example #3
0
        public static void insertarAlquiler(Alquiler alq)
        {
            //string Time = "16:23:01";
            //DateTime date = DateTime.ParseExact(Time, "hh:mm:ss tt", System.Globalization.CultureInfo.CurrentCulture);
            //DateTime date = DateTime.ParseExact(Time, "HH:mm:ss",CultureInfo.InvariantCulture);

            string connectionString = ConfigurationManager.ConnectionStrings["ParkeoConnString"].ConnectionString;

            //string consulta2 = "INSERT INTO dbo.Alquler (Fecha_I, Fecha_F, Hora_I, Hora_F, Placa, Posicion, Obsevacion, Tarifa_IdTarifa) VALUES (@fechaInic, @fechaFin, @horaIni, @horaFin, @placa, @posicion, @observacion, @tarifaId) ";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand("insertarAlquiler", connection);
                command.CommandType = CommandType.StoredProcedure;

                command.Parameters.AddWithValue("fechaInic", alq.FechaInicio);
                //command.Parameters.AddWithValue("fechaFin", "NULL");
                command.Parameters.AddWithValue("horaInic", alq.horaInicio);
                //command.Parameters.AddWithValue("horaFin", "NULL");
                command.Parameters.AddWithValue("placa", alq.Placa);
                command.Parameters.AddWithValue("posicion", alq.Posicion);
                command.Parameters.AddWithValue("observacion", alq.Observacion);
                command.Parameters.AddWithValue("tarifaId", alq.Tarifa_IdTarifa);

                try
                {
                    connection.Open();
                    command.ExecuteNonQuery();
                }
                catch (SqlException ex)
                {
                    throw ex;
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Example #4
0
        public static Alquiler buscarPorPlaca(String placa)
        {
            Alquiler alq = new Alquiler();

            string connectionString = ConfigurationManager.ConnectionStrings["ParkeoConnString"].ConnectionString;

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand("PA_cuentaVehiculo", connection);
                command.CommandType = CommandType.StoredProcedure;

                command.Parameters.AddWithValue("@placa", placa);

                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();

                    while (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            alq.Id1 = reader.GetInt32(0);
                            alq.Placa = reader.GetString(1);
                            alq.Hora_Inic = reader.GetTimeSpan(2);
                            alq.Posicion = reader.GetString(3);
                            alq.Precio = reader.GetDouble(4);
                        }
                        reader.NextResult();
                    }

                    reader.Close();
                }
                catch (SqlException ex)
                {
                    throw ex;
                }
                catch (Exception ex)
                {
                    throw ex;
                }

            }
            return alq;
        }
Example #5
0
        public CuentaAlquiler(Alquiler al)
        {
            InitializeComponent();

            label_Placa.Text = al.Placa;
        }