protected void Page_Load(object sender, EventArgs e) { User user = new User(); user = (User)Session["CurrentUser"]; if (user.RoleID != 1) { Response.Redirect("404.aspx"); } GridViewVehicles.DataSource = logvehicles.ListVehicles(); GridViewVehicles.DataBind(); }
protected void BtnConsultar_Click(object sender, EventArgs e) { DateTime Fecha1 = Convert.ToDateTime(TxtFechaInicio.Text); DateTime Fecha2 = Convert.ToDateTime(TxtFechaFinal.Text); GridViewVehicles.DataSource = logvehicles.ListVehicleDate(Fecha1, Fecha2); GridViewVehicles.DataBind(); User userAux = (User)Session["CurrentUser"]; ReferenceWSUser.IwcfUsersClient aux = new ReferenceWSUser.IwcfUsersClient(); aux.InsertUserLog(userAux.UserID, 2, "El usuario a consultado la lista vehiculos por fecha", DateTime.Now); aux.Close(); }
protected void btnSearch_Click(object sender, EventArgs e) { Customer login = (Customer)Session["login"]; if (String.IsNullOrEmpty(tBoxSearchVehicles.Text)) { VehicleDAO vehicledao = new VehicleDAO(login.CustomerId, login.Password); List <Vehicle> vehicles = vehicledao.FindVehicles(String.Empty, ddlVehicleType.Text); if (vehicles.Count > 0) { GridViewVehicles.DataSource = vehicles; GridViewVehicles.DataBind(); lblNoResults.Visible = false; } else { lblNoResults.Visible = true; } } else { VehicleDAO vehicledao = new VehicleDAO(login.CustomerId, login.Password); List <Vehicle> vehicles = vehicledao.FindVehicles(tBoxSearchVehicles.Text, ddlVehicleType.Text); if (vehicles.Count > 0) { GridViewVehicles.DataSource = vehicles; GridViewVehicles.DataBind(); lblNoResults.Visible = false; } else { lblNoResults.Visible = true; } GridViewVehicles.DataSource = vehicles; GridViewVehicles.DataBind(); } }