public async Task <IActionResult> OnGetAsync(int id) { try { var Roles = ((ClaimsIdentity)User.Identity).Claims.Where(d => d.Type == "Roles").Select(s1 => s1.Value).FirstOrDefault().Split("|"); if (string.IsNullOrEmpty(Roles.Where(a => a == "23").FirstOrDefault())) { return(RedirectToPage("/NoPermiso")); } var Pais = ((ClaimsIdentity)User.Identity).Claims.Where(d => d.Type == "Pais").Select(s1 => s1.Value).FirstOrDefault(); this.Pais = Pais; Normas = await normas.ObtenerLista(""); Objeto = await service.ObtenerPorId(id); return(Page()); } catch (ApiException ex) { Errores error = JsonConvert.DeserializeObject <Errores>(ex.Content.ToString()); ModelState.AddModelError(string.Empty, error.Message); return(Page()); } }
//Programacion para encontrar una factura manual public async Task <IActionResult> OnGetBuscarFM(string idB) { try { var FM = await service.ObtenerPorId(Convert.ToInt32(idB)); return(new JsonResult(FM)); } catch (ApiException ex) { Errores error = JsonConvert.DeserializeObject <Errores>(ex.Content.ToString()); return(new JsonResult(error)); } }
public async Task <ActionResult> OnGetPDF(int id) { try { var factura = await service.ObtenerPorId(id); PdfReader reader = new PdfReader(new MemoryStream(factura.PdfFac)); PdfStamper stamper = new PdfStamper(reader, new FileStream(factura.PdfFactura, FileMode.Create)); return(new JsonResult(true)); } catch (Exception ex) { byte[] all = null; return(new JsonResult(all)); } }
public async Task <IActionResult> OnGetAsync(string id) { try { var Roles = ((ClaimsIdentity)User.Identity).Claims.Where(d => d.Type == "Roles").Select(s1 => s1.Value).FirstOrDefault().Split("|"); if (string.IsNullOrEmpty(Roles.Where(a => a == "4").FirstOrDefault())) { return(RedirectToPage("/NoPermiso")); } var ids = Convert.ToInt32(id); Liquidacion = await liquidaciones.ObtenerPorId(ids); Usuarios = await users.ObtenerLista(""); Rols = await roles.ObtenerLista(""); var Pais = ((ClaimsIdentity)User.Identity).Claims.Where(d => d.Type == "Pais").Select(s1 => s1.Value).FirstOrDefault(); this.Pais = Pais; ParametrosFiltros filt = new ParametrosFiltros(); filt.Codigo3 = Liquidacion.EncCierre.idCierre; filt.NumCierre = Liquidacion.EncCierre.idCierre; //filt.Asignados = true; var objetos = await service.ObtenerListaCompras(filt); Objeto = new ComprasViewModel[Liquidacion.DetCierre.Length]; for (int i = 0; i < Objeto.Length; i++) { Objeto[i] = objetos.Where(a => a.id == Liquidacion.DetCierre[i].idFactura).FirstOrDefault(); } return(Page()); } catch (ApiException ex) { Errores error = JsonConvert.DeserializeObject <Errores>(ex.Content.ToString()); ModelState.AddModelError(string.Empty, error.Message); return(Page()); } }
public async Task <IActionResult> OnGetAsync(int id) { try { var Roles = ((ClaimsIdentity)User.Identity).Claims.Where(d => d.Type == "Roles").Select(s1 => s1.Value).FirstOrDefault().Split("|"); if (string.IsNullOrEmpty(Roles.Where(a => a == "6").FirstOrDefault())) { return(RedirectToPage("/NoPermiso")); } Rol = await service.ObtenerPorId(id); return(Page()); } catch (ApiException ex) { ModelState.AddModelError(string.Empty, ex.Message); return(Page()); } }
public async Task <IActionResult> OnGetAsync(int id) { try { Roles = await roles.ObtenerLista(""); Usuarios = await service.ObtenerLista(""); Input = await service.ObtenerPorId(id); var Rol = Roles.Where(a => a.NombreRol.ToUpper().Contains("Aprobador".ToUpper())).FirstOrDefault(); var RolA = Roles.Where(a => a.NombreRol.ToUpper().Contains("Administrador".ToUpper())).FirstOrDefault(); var RolCA = Roles.Where(a => a.NombreRol.ToUpper().Contains("Contador Aprobador".ToUpper())).FirstOrDefault(); Usuarios = Usuarios.Where(a => a.idRol == Rol.idRol || a.idRol == RolA.idRol || a.idRol == RolCA.idRol).ToArray(); return(Page()); } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.Message); return(Page()); } }
public async Task <IActionResult> OnGetAsync(string id) { try { var Roles = ((ClaimsIdentity)User.Identity).Claims.Where(d => d.Type == "Roles").Select(s1 => s1.Value).FirstOrDefault().Split("|"); if (string.IsNullOrEmpty(Roles.Where(a => a == "13").FirstOrDefault())) { return(RedirectToPage("/NoPermiso")); } Usuarios = await usuario.ObtenerLista(""); int ids = Convert.ToInt32(id); Dimensiones = await dimensiones.ObtenerLista(""); Objeto = await service.ObtenerPorId(ids); return(Page()); } catch (ApiException ex) { ModelState.AddModelError(string.Empty, ex.Message); return(Page()); } }
public async Task <IActionResult> OnGetAsync(string id) { try { var Roles = ((ClaimsIdentity)User.Identity).Claims.Where(d => d.Type == "Roles").Select(s1 => s1.Value).FirstOrDefault().Split("|"); if (string.IsNullOrEmpty(Roles.Where(a => a == "4").FirstOrDefault())) { return(RedirectToPage("/NoPermiso")); } var ids = Convert.ToInt32(id); Liquidacion = await liquidaciones.ObtenerPorId(ids); Periodo = Liquidacion.EncCierre.Periodo; filtro.FechaInicio = Liquidacion.EncCierre.FechaInicial; filtro.FechaFinal = Liquidacion.EncCierre.FechaFinal; var idLogin = int.Parse(((ClaimsIdentity)User.Identity).Claims.Where(d => d.Type == ClaimTypes.Actor).Select(s1 => s1.Value).FirstOrDefault()); // Objeto = await service.ObtenerLista(filtro); Usuarios = await usuario.ObtenerLista(""); Usuario = Usuarios.Where(a => a.id == idLogin).FirstOrDefault(); ParametrosFiltros filt = new ParametrosFiltros(); var Pais = ((ClaimsIdentity)User.Identity).Claims.Where(d => d.Type == "Pais").Select(s1 => s1.Value).FirstOrDefault(); this.Pais = Pais; Proveedores = await proveedor.ObtenerLista(""); /* filt.FechaInicio = new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 26); * filt.FechaFinal = filt.FechaInicio.AddMonths(1);*/ filt.FechaInicio = filtro.FechaInicio; filt.FechaFinal = filtro.FechaFinal; filt.NumCierre = Liquidacion.EncCierre.idCierre; //filt.Asignados = true; var objetos = await service.ObtenerListaCompras(filt); Objeto = new ComprasViewModel[Liquidacion.DetCierre.Length]; for (int i = 0; i < Objeto.Length; i++) { Objeto[i] = objetos.Where(a => a.id == Liquidacion.DetCierre[i].idFactura).FirstOrDefault(); Objeto[i].PdfFac = new byte[0]; } //Liquidacion.EncCierre. Objeto = Objeto.OrderBy(a => a.FecFactura).ToArray(); await compras.RealizarLecturaEmails(); await compras.LecturaBandejaEntrada(); Gastos = await gastos.ObtenerLista(""); return(Page()); } catch (ApiException ex) { Errores error = JsonConvert.DeserializeObject <Errores>(ex.Content.ToString()); ModelState.AddModelError(string.Empty, error.Message); return(Page()); } }