Skip to content

Commit

Permalink
mvc casi listo
Browse files Browse the repository at this point in the history
  • Loading branch information
ranfis committed Aug 3, 2012
1 parent 272e8f9 commit fa01c62
Show file tree
Hide file tree
Showing 49 changed files with 1,549 additions and 26,465 deletions.
Binary file modified AirlineApp/bin/AirlineApp.dll
Binary file not shown.
Binary file modified AirlineApp/bin/AirlineApp.pdb
Binary file not shown.
13,206 changes: 0 additions & 13,206 deletions AirlineApp/bin/EntityFramework.xml

This file was deleted.

2 changes: 0 additions & 2 deletions AirlineApp/obj/Debug/AirlineApp.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ D:\AirlineApp\AirlineApp\AirlineApp\obj\Debug\AirlineApp.dll
D:\AirlineApp\AirlineApp\AirlineApp\obj\Debug\AirlineApp.pdb
C:\ProyectoFinal3\AirlineApp\bin\AirlineApp.dll
C:\ProyectoFinal3\AirlineApp\bin\AirlineApp.pdb
C:\ProyectoFinal3\AirlineApp\bin\EntityFramework.xml
C:\ProyectoFinal3\AirlineApp\obj\Debug\AirlineApp.csprojResolveAssemblyReference.cache
C:\ProyectoFinal3\AirlineApp\obj\Debug\AirlineApp.dll
C:\ProyectoFinal3\AirlineApp\obj\Debug\AirlineApp.pdb
Binary file not shown.
Binary file modified AirlineApp/obj/Debug/AirlineApp.dll
Binary file not shown.
Binary file modified AirlineApp/obj/Debug/AirlineApp.pdb
Binary file not shown.
32 changes: 19 additions & 13 deletions FlightService/FlightService.asmx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,48 @@

namespace FlightService
{
/// <summary>
/// Descripción breve de FlightService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// Para permitir que se llame a este servicio Web desde un script, usando ASP.NET AJAX, quite la marca de comentario de la línea siguiente.
// [System.Web.Script.Services.ScriptService]

public class FlightService : System.Web.Services.WebService
{
airlineEntities airline = new airlineEntities();

[WebMethod]
public List<vuelo> buscarVuelos(String partida, String destino, String fecha)
public List<vuelo> listarVuelosPor(String partida, String destino, String fecha)
{
List<vuelo> filtro = new List<vuelo>();
try
{

String par = partida.Substring(partida.IndexOf("(")).Replace("(", "").Replace(")", "");
String des = destino.Substring(destino.IndexOf("(")).Replace("(", "").Replace(")", "");

DateTime date = Convert.ToDateTime(fecha);
var vuelos = airline.LISTVUELOSPORFECHAS(date.ToString("yyyy-MM-dd"));

filtro = vuelos.ToList().FindAll(x => (x.origen.Equals(par) && x.destino.Equals(des)));
filtro = vuelos.ToList().FindAll(x => (x.origen.Equals(partida) && x.destino.Equals(destino)));
}
catch (Exception)
{
filtro = null;
}
return filtro;
}

[WebMethod]
public List<vuelo> buscarVuelos2()
public List<vuelo> listarVuelos()
{
return airline.vueloes.ToList();
List<vuelo> filtro = new List<vuelo>();
try
{

return airline.vueloes.ToList();
}
catch (Exception)
{
filtro = null;
}
return filtro;
}

[WebMethod]
public List<aeropuerto> listaAeropuertos()
{
Expand All @@ -58,6 +63,7 @@ public List<aeropuerto> listaAeropuertos()
}
return aeropuertos;
}

[WebMethod]
public List<avion> capacidadVuelo(int vuelo)
{
Expand Down
Binary file modified FlightService/bin/FlightService.dll
Binary file not shown.
Binary file modified FlightService/bin/FlightService.pdb
Binary file not shown.
Binary file modified FlightService/obj/Debug/FlightService.dll
Binary file not shown.
Binary file modified FlightService/obj/Debug/FlightService.pdb
Binary file not shown.
25 changes: 23 additions & 2 deletions JRTravel/Controllers/LoginController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ namespace JRTravel.Controllers
{
public class LoginController : Controller
{
public bool validarLogin()
{
bool resultado = true;
JRTravel.Models.RegexValidator.iniciar();
if (!JRTravel.Models.RegexValidator.validar["texto"].IsMatch(Request["txtUser"]))
{
resultado = false;
}
if (!JRTravel.Models.RegexValidator.validar["texto"].IsMatch(Request["txtPass"]))
{
resultado = false;
}
return resultado;
}
public ActionResult Index()
{
String user = Request["txtUser"];
Expand All @@ -22,6 +36,7 @@ public ActionResult Index()
}
else
{

Response.Redirect("Home/Nosotros");
}
}
Expand All @@ -33,8 +48,14 @@ public ActionResult Registro()
using (JRTravel.Models.TravelAgencyEntities TA = new Models.TravelAgencyEntities())
{
JRTravel.Models.usuario usuario = new Models.usuario();
// TODO
// TODO
usuario.nusuario = Request["txtNombreUsuario"];
usuario.clave = Request["txtClave"];
usuario.correo = Request["txtCorreo"];
usuario.nombre = Request["txtNombre"];
usuario.apellido = Request["txtApellidos"];



TA.SaveChanges();
}
return View();
Expand Down
68 changes: 63 additions & 5 deletions JRTravel/Controllers/ReservacionController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,77 @@ namespace JRTravel
{
public class ReservacionController : Controller
{
JRTravel.Models.TravelAgencyEntities TA = new Models.TravelAgencyEntities();
protected String listaAeropuertos()
{
using (Servicio.FlightService servicio = new Servicio.FlightService())
{
System.Text.StringBuilder aeropuertos = new System.Text.StringBuilder("[");
try
{
var lista = servicio.listaAeropuertos();
foreach (var x in lista)
{
aeropuertos.Append('"'.ToString());
aeropuertos.Append(x.ciudad);
aeropuertos.Append(" (" + x.codigo + ")");
aeropuertos.Append('"'.ToString() + ",");
}
aeropuertos.Remove(aeropuertos.Length - 1, 1);
aeropuertos.Append("]");
return aeropuertos.ToString();
}
catch (Exception)
{
return "";
}
}

}

public ActionResult Index()
{
var @reservaciones = TA.reservacions.ToList();
var @usuarios = TA.usuarios.ToList();
ViewBag.Reservaciones = @reservaciones;
ViewBag.Usuarios = @usuarios;
return View();
}

public ActionResult Buscar()
{
var @aeropuertos = listaAeropuertos();
ViewBag.Aeropuertos = @aeropuertos;
return View();
}

[HttpPost]
public ActionResult Buscar(String txtPartida, String txtDestino, String datepickerPartida, String datepickerRetorno)
{
HttpCookie cookie = new HttpCookie("RES");
cookie.Values["partida"] = txtPartida;
cookie.Values["destino"] = txtDestino;
cookie.Values["fechapartida"] = datepickerPartida;
cookie.Values["fecharegreso"] = datepickerRetorno;
Response.Cookies.Add(cookie);
Response.Redirect("Vuelos");
return View();
}
public ActionResult Vuelos()
{
HttpCookie cookie = Request.Cookies["RES"];
String partida, destino, fecha, fecha2;
partida = cookie.Values["partida"];
destino = cookie.Values["destino"];
fecha = cookie.Values["fechapartida"];
fecha2 = cookie.Values["fecharegreso"];

partida = partida.Substring(partida.IndexOf("(")).Replace("(", "").Replace(")", "");
destino = destino.Substring(destino.IndexOf("(")).Replace("(", "").Replace(")", "");
Request.Cookies["RES"].Value = null;
Request.Cookies.Remove(cookie.Name);

using (Servicio.FlightService servicio = new Servicio.FlightService()){
var @vuelos = servicio.listarVuelosPor(partida,destino,fecha);
ViewBag.Vuelos = @vuelos;
}


return View();
}
public ActionResult Reservaciones()
Expand Down
51 changes: 51 additions & 0 deletions JRTravel/JRTravel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,19 @@
<DesignTime>True</DesignTime>
<DependentUpon>TravelAgency.edmx</DependentUpon>
</Compile>
<Compile Include="Models\RegexValidator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Controllers\ReservacionController.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Web References\Servicio\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="Content\bootstrap.css" />
Expand All @@ -100,10 +111,23 @@
<Content Include="Global.asax" />
<Content Include="Scripts\bootstrap.js" />
<Content Include="Scripts\calls.js" />
<Content Include="Scripts\validacion.js" />
<Content Include="Scripts\jquery-1.7.2.min.js" />
<Content Include="Scripts\jquery-ui-1.8.21.custom.min.js" />
<Content Include="Scripts\modernizr-1.7.js" />
<Content Include="Scripts\modernizr-1.7.min.js" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Content Include="Views\Reservacion\Vuelos.cshtml" />
<None Include="Web References\Servicio\aeropuerto1.datasource">
<DependentUpon>Reference.map</DependentUpon>
</None>
<None Include="Web References\Servicio\avion1.datasource">
<DependentUpon>Reference.map</DependentUpon>
</None>
<None Include="Web References\Servicio\FlightService.disco" />
<Content Include="Web.config" />
<Content Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
Expand All @@ -128,6 +152,14 @@
<Content Include="Views\Shared\_LogOnPartial.cshtml" />
<Content Include="Views\Shared\_Layout.cshtml" />
<Content Include="Views\Web.config" />
<None Include="Web References\Servicio\FlightService.wsdl" />
<None Include="Web References\Servicio\Reference.map">
<Generator>MSDiscoCodeGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
<None Include="Web References\Servicio\vuelo1.datasource">
<DependentUpon>Reference.map</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
Expand Down Expand Up @@ -162,6 +194,25 @@
<ItemGroup>
<Content Include="Views\Login\Registro.cshtml" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<WebReferences Include="Web References\" />
</ItemGroup>
<ItemGroup>
<WebReferenceUrl Include="http://localhost:3737/FlightService.asmx">
<UrlBehavior>Dynamic</UrlBehavior>
<RelPath>Web References\Servicio\</RelPath>
<UpdateFromURL>http://localhost:3737/FlightService.asmx</UpdateFromURL>
<ServiceLocationURL>
</ServiceLocationURL>
<CachedDynamicPropName>
</CachedDynamicPropName>
<CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName>
<CachedSettingsPropName>JRTravel_FlightService_FlightService</CachedSettingsPropName>
</WebReferenceUrl>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
32 changes: 32 additions & 0 deletions JRTravel/Models/RegexValidator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text.RegularExpressions;

namespace JRTravel.Models
{
public static class RegexValidator
{
public static Dictionary<String, Regex> validar;

public static void iniciar()
{
validar = new Dictionary<string, Regex>();
validar.Add("texto", new Regex("^[A-Za-z áéíóú]*$"));
validar.Add("ciudad", new Regex("^[A-Za-z() áéíóú,]*$"));
validar.Add("fecha", new Regex("^[0-9]{2}+/+[0-9]{2}+/+[0-9]{4}+$"));
validar.Add("numero", new Regex("^[0-9]*$"));
validar.Add("decimal", new Regex("^[0-9.]*$"));
validar.Add("cedula", new Regex("^[[0-9]{3}-[0-9]{7}-[0-9]{1}]*$"));
validar.Add("email", new Regex("^[A-Za-z0-9._-]+@[A-Za-z]+.com$"));


}

public static bool validarCon(String txt,String patron){
Regex r = new Regex(patron);
return r.IsMatch(txt);
}
}
}
12 changes: 6 additions & 6 deletions JRTravel/Models/TravelAgency.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fa01c62

Please sign in to comment.