예제 #1
0
        public ActionResult InicioDetVenta(cmVentaDet oDest)
        {
            if (Session["UserName"] == null)
            {
                return(RedirectToAction("TravelInicio", "Logueo"));
            }
            var resultado = new JObject();

            try
            {
                CD_DetVenta       odVenta  = new CD_DetVenta();
                List <cmVentaDet> lsDetSal = new List <cmVentaDet>();
                lsDetSal = odVenta.fnlsRecuperaSalidaDes(oDest);

                if (lsDetSal.Count > 0)
                {
                    resultado["LsSalidas"] = JToken.FromObject(lsDetSal);
                    resultado["Exito"]     = true;
                }
            }
            catch (Exception x)
            {
                resultado["Exito"] = false;
            }
            return(Content(resultado.ToString()));
        }
예제 #2
0
        public ActionResult InsertaViajeros(List <cmViajeros> oUsrViajeros)
        {
            if (Session["UserName"] == null)
            {
                return(RedirectToAction("TravelInicio", "Logueo"));
            }
            JObject resultado = new JObject();

            if (oUsrViajeros.Count > 0)
            {
                CD_Viajeros cdViajeros = new CD_Viajeros();
                oUsrViajeros.ToList().ForEach(cc => cc.idUsuario = Session["UserID"].ToString());
                cmHabitacion oHabitacion = new cmHabitacion
                {
                    iPasajeros = oUsrViajeros.Count,
                    idViaje    = oUsrViajeros[0].idViaje
                };
                CD_DetVenta odVenta = new CD_DetVenta();
                decimal     tot     = 0;
                switch (oUsrViajeros[0].sOpcionTour)
                {
                case "btnOp-0":
                    oHabitacion.iDecremento = 0;
                    foreach (cmHabitacion hab in odVenta.fnlsRecuperaOpciones(oHabitacion))
                    {
                        tot += hab.dCosto;
                    }
                    oUsrViajeros.ToList().ForEach(cc => cc.dCostoTotal = tot);
                    break;

                case "btnOp-1":
                    oHabitacion.iDecremento = 1;
                    foreach (cmHabitacion hab in odVenta.fnlsRecuperaOpciones(oHabitacion))
                    {
                        tot += hab.dCosto;
                    }
                    oUsrViajeros.ToList().ForEach(cc => cc.dCostoTotal = tot);
                    break;

                case "btnOp-2":
                    oHabitacion.iDecremento = 2;
                    foreach (cmHabitacion hab in odVenta.fnlsRecuperaOpciones(oHabitacion))
                    {
                        tot += hab.dCosto;
                    }
                    oUsrViajeros.ToList().ForEach(cc => cc.dCostoTotal = tot);
                    break;

                case "btnOp-3":
                    oHabitacion.iDecremento = 0;
                    foreach (cmHabitacion hab in odVenta.fnlsRecuperaOpciones(oHabitacion))
                    {
                        tot += hab.dCosto;
                    }
                    oUsrViajeros.ToList().ForEach(cc => cc.dCostoTotal = tot);
                    break;
                }

                if (cdViajeros.InsertaViajeros(oUsrViajeros))
                {
                    resultado["Exito"]  = true;
                    Session["UserID"]   = Session["UserID"];
                    Session["UserName"] = Session["UserName"];
                    Session["dCosto"]   = tot;
                }
                else
                {
                    resultado["Exito"] = false;
                }
            }
            else
            {
                resultado["Exito"] = false;
            }
            return(Content(resultado.ToString()));
        }
예제 #3
0
        public ActionResult ObtienePropuestas(cmHabitacion oHabitacion)
        {
            if (Session["UserName"] == null)
            {
                return(RedirectToAction("TravelInicio", "Logueo"));
            }
            var resultado = new JObject();

            try
            {
                CD_DetVenta         odVenta        = new CD_DetVenta();
                List <cmHabitacion> lsHabitaciones = new List <cmHabitacion>();
                int count = 0;
                if (oHabitacion.iPasajeros > 2)
                {
                    while (count < 3)
                    {
                        oHabitacion.iDecremento = count;
                        lsHabitaciones          = odVenta.fnlsRecuperaOpciones(oHabitacion);
                        decimal tot = 0;
                        foreach (cmHabitacion hab in lsHabitaciones)
                        {
                            tot += hab.dCosto;
                        }
                        if (count == 0)
                        {
                            resultado["Opcion0"] = JToken.FromObject(lsHabitaciones);
                            resultado["Total0"]  = tot;
                        }
                        if (count == 1)
                        {
                            resultado["Opcion1"] = JToken.FromObject(lsHabitaciones);
                            resultado["Total1"]  = tot;
                        }
                        if (count == 2)
                        {
                            resultado["Opcion2"] = JToken.FromObject(lsHabitaciones);
                            resultado["Total2"]  = tot;
                        }
                        count++;
                    }
                }
                else
                {
                    oHabitacion.iDecremento = 0;
                    lsHabitaciones          = odVenta.fnlsRecuperaOpciones(oHabitacion);
                    decimal tot = 0;
                    foreach (cmHabitacion hab in lsHabitaciones)
                    {
                        tot += hab.dCosto;
                    }
                    resultado["Opcion"] = JToken.FromObject(lsHabitaciones);
                    resultado["Total"]  = tot;
                }
                if (lsHabitaciones.Count > 0)
                {
                    resultado["Exito"] = true;
                }

                /*lsHabitaciones = odVenta.fnlsRecuperaOpciones(new cmHabitacion
                 * {
                 *  iPasajeros = 10,
                 *  idViaje = 2,
                 *  iDecremento = 0
                 * });*/
            }
            catch (Exception ex)
            {
                resultado["Exito"] = false;
            }
            return(Content(resultado.ToString()));
        }