Esempio n. 1
0
        public async Task <IHttpActionResult> Putreservacion(int id, reservacion reservacion)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != reservacion.id)
            {
                return(BadRequest());
            }

            db.Entry(reservacion).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!reservacionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
        private void VtnPrincipal_Loaded(object sender, RoutedEventArgs e)
        {
            lblUser.Content = user.login;
            DateTime hoy = DateTime.Today;

            lblFecha.Content = hoy.ToString("D", CultureInfo.CreateSpecificCulture("es-VE"));
            frmContenido.Navigate(new primera());
            reservacion res = new reservacion();

            res.verificafechalimite();

            switch (user.codigoPerfil)
            {
            case 3:
                btnConfiguracion.IsEnabled = false;
                break;

            case 4:
                btnNuevaReserva.IsEnabled      = false;
                btnConfiguracion.IsEnabled     = false;
                btnPagos.IsEnabled             = false;
                btnLocalizador.IsEnabled       = false;
                btnPuntosDisponibles.IsEnabled = false;
                break;
            }


            //if (user.codigoPerfil==3 || user.codigoPerfil==4)

            //System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            //dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            //dispatcherTimer.Interval = new TimeSpan(0,1,0);
            //dispatcherTimer.Start();
        }
        private void txtCliente1_KeyUp(object sender, KeyEventArgs e)
        {
            DateTime?   f   = dpfecha1.SelectedDate;
            reservacion res = new reservacion();

            if ((txtNroReserva1.Text.Equals("")) && (txtNroContrato1.Text.Equals("")) && (f == null))
            {
                dtgReservas1.ItemsSource = res.buscar_reservaConfirLoc("0", txtCliente1.Text, "", "0");
            }
            else
            {
                if ((!txtNroReserva1.Text.Equals("")) && (txtNroContrato1.Text.Equals("")) && (f == null))
                {
                    dtgReservas1.ItemsSource = res.buscar_reservaConfirLoc(txtNroReserva1.Text, txtCliente1.Text, "", "0");
                }
                else
                {
                    if ((!txtNroReserva1.Text.Equals("")) && (!txtNroContrato1.Text.Equals("")) && (f == null))
                    {
                        dtgReservas1.ItemsSource = res.buscar_reservaConfirLoc(txtNroReserva1.Text, txtCliente1.Text, "", txtNroContrato1.Text);
                    }
                    else
                    {
                        if ((!txtNroReserva1.Text.Equals("")) && (!txtNroContrato1.Text.Equals("")) && (f != null))
                        {
                            String[] ini   = f.Value.ToShortDateString().Split('/');
                            String   fechI = ini[2] + "/" + ini[1] + "/" + ini[0];
                            dtgReservas1.ItemsSource = res.buscar_reservaConfirLoc(txtNroReserva1.Text, txtCliente1.Text, fechI, txtNroContrato1.Text);
                        }
                    }
                }
            }
        }
Esempio n. 4
0
 public void editar(reservacion editaReservacion)
 {
     using (DBTallerEntities db = new DBTallerEntities())
     {
         db.Entry(editaReservacion).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Esempio n. 5
0
 public void nuevo(reservacion nuevoReservacion)
 {
     using (DBTallerEntities db = new DBTallerEntities())
     {
         db.reservacion.Add(nuevoReservacion);
         db.SaveChanges();
     }
 }
Esempio n. 6
0
        public ActionResult CheckinConfirmed(int id)
        {
            reservacion  res        = bd.reservacion.Find(id);
            SqlParameter parametro1 = new SqlParameter("@idViaje", res.idviaje);
            SqlParameter parametro2 = new SqlParameter("@idCliente", Session["IDUsuario"]);

            bd.Database.ExecuteSqlCommand("exec dbo.Check_In_Viaje @idViaje, @idCliente", parametro1, parametro2);
            return(RedirectToAction("MainCliente"));
        }
Esempio n. 7
0
        public ActionResult CheckinConfirmed(int id)
        {
            reservacion  res        = db.reservacion.Find(id);
            SqlParameter parametro1 = new SqlParameter("@idViaje", res.idviaje);
            SqlParameter parametro2 = new SqlParameter("@idCliente", res.idcliente);

            db.Database.ExecuteSqlCommand("exec dbo.Check_In_Viaje @idViaje, @idCliente", parametro1, parametro2);
            return(RedirectToAction("MainAdministrador"));
        }
Esempio n. 8
0
 public async void ListNotificaciones_ItemSelected(object sender, SelectedItemChangedEventArgs e)
 {
     (sender as ListView).SelectedItem = null;
     if (e.SelectedItem != null)
     {
         reservacion objetoseleccionado = (reservacion)e.SelectedItem;
         await App.Current.MainPage.Navigation.PushAsync(new DetalleOrden(objetoseleccionado) { BindingContext = e.SelectedItem });
     }
 }
Esempio n. 9
0
        public ActionResult CancelarVuelo(int id)
        {
            reservacion res = bd.reservacion.Find(id);

            if (res == null)
            {
                return(HttpNotFound());
            }
            return(View(res));
        }
Esempio n. 10
0
        public reservacion buscarId(int?id)
        {
            reservacion oReservacion = new reservacion();

            using (DBTallerEntities db = new DBTallerEntities())
            {
                oReservacion = db.reservacion.Find(id);
            }
            return(oReservacion);
        }
Esempio n. 11
0
        public async Task <IHttpActionResult> Getreservacion(int id)
        {
            reservacion reservacion = await db.reservacion.FindAsync(id);

            if (reservacion == null)
            {
                return(NotFound());
            }

            return(Ok(reservacion));
        }
 public bool CreateReservation(reservacion reservation)
 {
     reservationContex.reservacion.Add(reservation);
     if (reservationContex.SaveChanges() == 1)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 13
0
        public async Task <IHttpActionResult> Postreservacion(reservacion reservacion)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.reservacion.Add(reservacion);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = reservacion.id }, reservacion));
        }
Esempio n. 14
0
        public ActionResult CancelarVueloConfirmed(int id)
        {
            reservacion res = bd.reservacion.Find(id);

            if ((res.viajevuelo.viaje.horadepartida - DateTime.Now).TotalHours < 24)
            {
                return(RedirectToAction("MainCliente"));
            }
            bd.reservacion.Remove(res);
            bd.SaveChanges();
            return(RedirectToAction("MainCliente"));
        }
Esempio n. 15
0
        private void btnCancelarReserva_Click(object sender, EventArgs e)
        {
            int?id = GetId();

            if (id != null)
            {
                oReservacion             = controladorReservacion.buscarId(id);
                oReservacion.observacion = "RESERVACION CANCELADA";
                controladorReservacion.editar(oReservacion);
                DateTime fecha = System.Convert.ToDateTime(oReservacion.fecha);
                actualizar(fecha);
            }
        }
        public bool ActualizarValoracionReservacion(int idReservacion, int valoracion)
        {
            reservacion re = reservationContex.reservacion.Where(r => r.id_reservacion == idReservacion).FirstOrDefault();

            re.valoracion = valoracion;
            if (reservationContex.SaveChanges() == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 17
0
        public ActionResult CheckinAdmin(int id)
        {
            reservacion res = db.reservacion.Find(id);

            if ((res.viajevuelo.viaje.horadepartida - DateTime.Now).TotalHours > 24)
            {
                return(RedirectToAction("MainCliente"));
            }
            if (res == null)
            {
                return(HttpNotFound());
            }
            return(View(res));
        }
Esempio n. 18
0
        public ActionResult CambiarVuelo(int id)
        {
            reservacion res = bd.reservacion.Find(id);

            if ((res.viajevuelo.viaje.horadepartida - DateTime.Now).TotalHours < 24)
            {
                return(RedirectToAction("MainCliente"));
            }
            ViewBag.idvuelo            = new SelectList(bd.reservacion, "idvuelo", "idvuelo");
            ViewBag.idviaje            = new SelectList(bd.reservacion, "idviaje", "idviaje");
            TempData["idAsientoViejo"] = (int)res.asiento.First().idasiento;

            return(View());
        }
Esempio n. 19
0
        public async Task <IHttpActionResult> Deletereservacion(int id)
        {
            reservacion reservacion = await db.reservacion.FindAsync(id);

            if (reservacion == null)
            {
                return(NotFound());
            }

            db.reservacion.Remove(reservacion);
            await db.SaveChangesAsync();

            return(Ok(reservacion));
        }
        private void btnTraspasoPago_Click(object sender, RoutedEventArgs e)
        {
            if (txtmonto1.Text.Equals("") || lstCargos1.SelectedIndex == -1 || lstReservas.SelectedIndex == -1)
            {
                MessageBox.Show("Debe todos los campos para el traspaso del pago", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            reservacion res = new reservacion();

            string[] r = lstReservas.SelectedItem.ToString().Split('-');
            res.agregar_Pago(p.reserva, lstCargos1.SelectedItem.ToString(), (-1 * Convert.ToDouble(txtmonto1.Text)), p.trasaccion, p.documento, "", p.fecha, txtobservacion.Text, 1, 0, p.cuenta, p.tipo, "", p.puntosA);
            res.agregar_Pago(Convert.ToInt32(r[0]), lstCargos1.SelectedItem.ToString(), Convert.ToInt32(txtmonto1.Text), p.trasaccion, p.documento, "", p.fecha, txtobservacion.Text, 1, 0, p.cuenta, p.tipo, "", p.puntosA);
            MessageBox.Show("Se ha completado el traslado del pago correctamente", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
            this.Hide();
        }
Esempio n. 21
0
        public ActionResult AgregarEquipaje(int idReservacion)
        {
            reservacion res = db.reservacion.Find(idReservacion);

            if ((res.viajevuelo.viaje.horadepartida - DateTime.Now).TotalHours > 24 || res.estado != "check-in")
            {
                return(RedirectToAction("MainCliente"));
            }
            if (res == null)
            {
                return(HttpNotFound());
            }
            TempData["idcliente"] = res.idcliente;
            TempData["idViaje"]   = res.idviaje;
            return(View(new equipaje()));
        }
        public async Task <IHttpActionResult> Postreservacion(string json)
        {
            JObject     o           = JObject.Parse(json);
            reservacion reservacion = new reservacion();

            try
            {
                reservacion.monto             = (decimal)o["monto"];
                reservacion.CANCHA_idCANCHA   = (int)o["idCancha"];
                reservacion.cancha            = db.canchas.FirstOrDefault(x => x.idCANCHA == reservacion.CANCHA_idCANCHA);
                reservacion.USUARIO_idUSUARIO = (int)o["idUsuario"];
                reservacion.usuario           = db.usuarios.FirstOrDefault(x => x.idUSUARIO == reservacion.USUARIO_idUSUARIO);
                reservacion.hora  = (string)o["fecha"];
                reservacion.fecha = (string)o["fecha"];
            }
            catch (Exception e)
            {
                return(BadRequest(ModelState));
            }

            db.reservacions.Add(reservacion);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                var n = ex;
                if (reservacionExists(reservacion.idRESERVACION))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }
            //Aqui va el envio de un correo.
            Execute();
            return(CreatedAtRoute("DefaultApi", new { id = reservacion.idRESERVACION }, reservacion));
        }
        public ActionResult BoardingPass(reservacion reservacion)
        {
            usuario     clienteConsulta     = db.usuario.Where(u => u.pasaporte == reservacion.codreservacion).FirstOrDefault();
            reservacion reservacionConsulta = db.reservacion.Where(r => r.pasedeabordaje == reservacion.pasedeabordaje).FirstOrDefault();

            if (reservacionConsulta != null)
            {
                if (clienteConsulta.idusuario == reservacionConsulta.codcliente)
                {
                    ModelState.AddModelError("", "Verificado");
                }
                else
                {
                    ModelState.AddModelError("", "Reservacion no coincide con el pasaporte");
                }
            }
            else
            {
                ModelState.AddModelError("", "Pase de abordaje no registrado");
            }
            return(View());
        }
Esempio n. 24
0
 private void btnGuardar_Click(object sender, RoutedEventArgs e)
 {
     if (btnActualizar.IsEnabled == true)
     {
         MessageBox.Show("Hay cambios sin aplicar", "ADVERTENCIA", MessageBoxButton.OK, MessageBoxImage.Warning);
         return;
     }
     if (MessageBox.Show("¿Seguro desea cambiar la relación puntos por año del contrato N° " + n_contrato + "?", "Pregunta", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
     {
         reservacion reserva = new reservacion();
         reserva.cliente    = txtcedula.Text;
         reserva.n_contrato = n_contrato;
         for (int i = 0; i <= dtpunAnio.Rows.Count - 1; i++)
         {
             String[] p  = dtpunAnio.Rows[i][2].ToString().Split(',');
             String[] p1 = dtpunAnio.Rows[i][3].ToString().Split(',');
             reserva.quitar_puntos(Convert.ToInt32(p[0]), Convert.ToInt32(p1[0]), Convert.ToInt32(dtpunAnio.Rows[i][1].ToString()));
         }
         MessageBox.Show("Se ha guardado correctamente", "Información", MessageBoxButton.OK, MessageBoxImage.Information);
         if (actualizo)
         {
             int mod = disponibles_act - disponibles_ant;
             anios_mod = anios_mod.TrimStart(',');
             anios_mod = anios_mod.TrimEnd(',');
             reserva.log(us.login, n_contrato.ToString(), disponibles_ant, disponibles_act, mod, anios_mod);
             actualizo = false;
         }
         anios_mod       = "";
         disponibles_ant = 0;
         disponibles_act = 0;
         for (int j = 0; j <= dtpunAnio.Rows.Count - 1; j++)
         {
             string[] p = dtpunAnio.Rows[j][2].ToString().Split(',');
             disponibles_ant = disponibles_ant + Convert.ToInt32(p[0]);
         }
     }
 }
 public DetalleOrden(reservacion reservacionRecibida = null)
     : this()
 {
     ReservacionUsar = reservacionRecibida;
     ObtenerDetalle();
 }
        private void btnGuardalocalizador_Click(object sender, RoutedEventArgs e)
        {
            if ((dtgReservas1.Items.Count > 0))
            {
                int loc = 0;

                for (int j = 0; j <= dtgdetalle.Items.Count - 1; j++)
                {
                    if ((dtgdetalle.Items[j] as System.Data.DataRowView).Row.ItemArray[9].ToString().Trim(new char[] { ' ' }).Equals(""))
                    {
                        loc++;
                    }
                }
                if (loc == dtgdetalle.Items.Count)
                {
                    MessageBox.Show("No ha proporcionado ningún localizador", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }
                if (loc > 0)
                {
                    if (MessageBox.Show("Hay " + loc + " habitacion(es) sin localizador, ¿Seguro desea continuar?", "Pregunta", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
                    {
                        return;
                    }
                }
                reservacion res = new reservacion();

                for (int i = 0; i <= dtgdetalle.Items.Count - 1; i++)
                {
                    res.guardarlocalizador(numeroReserva, (dtgdetalle.Items[i] as System.Data.DataRowView).Row.ItemArray[9].ToString(), Convert.ToInt32((dtgdetalle.Items[i] as System.Data.DataRowView).Row.ItemArray[6].ToString()), txtObservacion.Text);
                }
                //COncatenar localizador en pagos
                string locIC = "", locCPB = "";
                for (int i = 0; i <= dtgdetalle.Items.Count - 1; i++)
                {
                    if ((dtgdetalle.Items[i] as System.Data.DataRowView).Row.ItemArray[0].ToString().Equals("COCHE PUNTA BLANCA"))
                    {
                        locCPB = locCPB + "," + (dtgdetalle.Items[i] as System.Data.DataRowView).Row.ItemArray[9].ToString();
                    }
                    if ((dtgdetalle.Items[i] as System.Data.DataRowView).Row.ItemArray[0].ToString().Equals("ISLA CARIBE"))
                    {
                        locIC = locIC + "," + (dtgdetalle.Items[i] as System.Data.DataRowView).Row.ItemArray[9].ToString();
                    }
                }
                if (!locIC.Equals(""))
                {
                    locIC = locIC.TrimStart(',');
                    locIC = locIC.TrimEnd(',');
                    res.localizadorPago(numeroReserva, locIC, "ISLA CARIBE");
                }
                if (!locCPB.Equals(""))
                {
                    locCPB = locCPB.TrimStart(',');
                    locCPB = locCPB.TrimEnd(',');
                    res.localizadorPago(numeroReserva, locCPB, "COCHE PUNTA BLANCA");
                }
                MessageBox.Show("Se han guardado los localizadores correctamente", "Información", MessageBoxButton.OK, MessageBoxImage.Information);
                if (loc == 0)
                {
                    MessageBox.Show("Se puede generar la confirmación de la reserva", "Información", MessageBoxButton.OK, MessageBoxImage.Information);
                    btnConfirmacion.IsEnabled = true;
                }
                else
                {
                    btnConfirmacion.IsEnabled = false;
                }

                /*dtgdetalle.ItemsSource = null;
                 * dtgReservas1.ItemsSource = null;
                 * txtCliente1.Text = "";
                 * txtNroContrato1.Text = "";
                 * txtNroReserva1.Text = "";
                 * dpfecha1.SelectedDate = null;*/
            }
        }
        private void frmTraspaso_Loaded(object sender, RoutedEventArgs e)
        {
            lstCargos1.Items.Clear();
            lstReservas.Items.Clear();
            reservacion   res = new reservacion();
            SqlDataReader sr  = res.trasladoPagos();

            lstCargos1.Items.Add("TODO INCLUIDO");
            lstCargos1.Items.Add("PUNTOS ACELERADOS");
            if (sr != null)
            {
                if (sr.HasRows)
                {
                    while (sr.Read())
                    {
                        lstReservas.Items.Add(sr.GetInt32(0) + "-" + sr.GetString(1).Trim(new char[] { ' ' }) + "-" + sr.GetInt32(3));
                    }
                }
            }
            sr.Close();
            DataTable dt = new DataTable();

            dt.Columns.Add("concepto");
            dt.Columns.Add("monto");
            dt.Columns.Add("puntosA");
            dt.Columns.Add("transaccion");
            dt.Columns.Add("documento");
            dt.Columns.Add("fecha");
            dt.Columns.Add("tipo");
            dt.Columns.Add("cuenta");
            dt.Columns.Add("hotel");
            dt.Columns.Add("observacion");
            DataRow row = dt.NewRow();

            row[0]              = p.concepto;
            row[1]              = p.monto.ToString("N2", CultureInfo.CreateSpecificCulture("es-VE"));
            row[2]              = p.puntosA;
            row[3]              = p.trasaccion;
            row[4]              = p.documento;
            row[5]              = p.fecha;
            row[6]              = p.tipo;
            row[7]              = p.cuenta;
            row[8]              = p.hotel;
            row[9]              = p.observacion;
            lstCargos1.Text     = p.concepto;
            txtobservacion.Text = p.observacion;
            txtmonto1.Text      = p.monto.ToString("N2", CultureInfo.CreateSpecificCulture("es-VE"));
            dt.Rows.Add(row);
            dtgPagos.ItemsSource = dt.DefaultView;
            sr = res.buscar_cargos();
            if (sr != null)
            {
                if (sr.HasRows)
                {
                    while (sr.Read())
                    {
                        lstCargos1.Items.Add(sr.GetString(0).Trim(new char[] { ' ' }));
                    }
                }
            }
        }