private void AsignarUbicaciones() { UbicacionUsuario objUbicacionesUsuarios = new UbicacionUsuario(); ltUbicacionesxUsuario = objUbicacionesUsuarios.ObtenerUbicacionesxUsuario(cvusuario, "", "", "", 5); //Utilerias.ApagarControlxPermiso(btnGuardar, "Actualizar", ltPermisos); for (int iContador = 0; iContador < dgvUbicaciones.Rows.Count; iContador++) { string idubicacion = dgvUbicaciones.Rows[iContador].Cells[1].Value.ToString(); if (ltUbicacionesxUsuario.Contains(idubicacion)) { dgvUbicaciones.Rows[iContador].Cells[0].Value = Resources.ic_check_circle_green_400_18dp; dgvUbicaciones.Rows[iContador].Cells[0].Tag = "check"; } else { dgvUbicaciones.Rows[iContador].Cells[0].Value = Resources.ic_lens_blue_grey_600_18dp; dgvUbicaciones.Rows[iContador].Cells[0].Tag = "uncheck"; } } }
public async Task <IActionResult> Create(UsuarioUbicacionVM usuarioUbicacionVM, List <IFormFile> FotoUsuario, List <IFormFile> Darde) { if (ModelState.IsValid) { Usuario usuario = usuarioUbicacionVM.usuario; usuario.FotoUsuario = null; usuario.Darde = null; foreach (var item in FotoUsuario) { if (item.Length > 0) { using var stream = new MemoryStream(); await item.CopyToAsync(stream); usuario.FotoUsuario = stream.ToArray(); } } foreach (var item in Darde) { if (item.Length > 0) { using var stream = new MemoryStream(); await item.CopyToAsync(stream); usuario.Darde = stream.ToArray(); } } await _usuariosService.CreateUsuario(usuario); UbicacionUsuario ubicacionUsuario = usuarioUbicacionVM.ubicacion; ubicacionUsuario.UsuarioId = usuario.Id; await _ubicacionesUsuarioService.CreateUbicacionUsuario(ubicacionUsuario); } return(RedirectToAction("Create", "GustoUsuarios")); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Pais,CCAA,Provincia,Poblacion,CP,Calle,Numero,Letra,UsuarioId")] UbicacionUsuario ubicacionUsuario) { if (id != ubicacionUsuario.Id) { return(NotFound()); } if (ModelState.IsValid) { try { await _ubicacionesUsuariosService.EditUbicacionUsuarioPost(ubicacionUsuario); } catch (DbUpdateConcurrencyException) { if (!UbicacionUsuarioExists(ubicacionUsuario.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(ubicacionUsuario)); }
public async Task <Usuario> ObtenerUsuarioConUbicacion(string identityId) { Usuario usuario = await _context.Usuario.Include(x => x.IdentityUser).FirstOrDefaultAsync(x => x.IdentityUserId == identityId); UbicacionUsuario ubicacionUsuario = await _context.UbicacionUsuario.FirstOrDefaultAsync(x => x.UsuarioId == usuario.Id); usuario.UbicacionUsuario = ubicacionUsuario; return(usuario); }
public async Task <IActionResult> Create([Bind("Id,Pais,CCAA,Provincia,Poblacion,CP,Calle,Numero,Letra,UsuarioId")] UbicacionUsuario ubicacionUsuario) { if (ModelState.IsValid) { await _ubicacionesUsuariosService.CreateUbicacionUsuario(ubicacionUsuario); return(RedirectToAction(nameof(Index))); } return(View(ubicacionUsuario)); }
private void btnImprimirDetalle_Click(object sender, EventArgs e) { usuario = cbUsuario.SelectedIndex; ubicacion = cbUbicacion.SelectedIndex; string usu = cbUsuario.SelectedValue.ToString(); string ubi = cbUbicacion.SelectedValue.ToString(); //FILTRA TODOS if (usuario == 0 & ubicacion == 0) { //Utilerias.ControlNotificaciones(panelTag, lbMensaje, 3, "modulo perfil"); //timer1.Start(); UbicacionUsuario objUbicacionUsuario = new UbicacionUsuario(); DataTable dtReporte; dtReporte = objUbicacionUsuario.ReporteUbicacionUsuarios("%", "%", "", "", 6); switch (dtReporte.Rows.Count) { case 0: DialogResult result = MessageBox.Show("Consulta Sin Resultados", "SIPAA"); break; default: ViewerReporte form = new ViewerReporte(); ReporteUbicacionesUsuarios dtrpt = new ReporteUbicacionesUsuarios(); ReportDocument ReportDoc = Utilerias.ObtenerObjetoReporte(dtReporte, this.CompanyName, dtrpt.ResourceName); ReportDoc.SetParameterValue("TotalRegistros", dtReporte.Rows.Count.ToString()); //ReportDoc.SetParameterValue("Filtro", cbEstatus.SelectedItem.ToString()); form.RptDoc = ReportDoc; form.Show(); break; } } //FILTRA CVUSUARIO,IDUBICACION else if (usuario > 0 & ubicacion > 0) { //Utilerias.ControlNotificaciones(panelTag, lbMensaje, 3, "modulo perfil"); //timer1.Start(); UbicacionUsuario objUbicacionUsuario = new UbicacionUsuario(); DataTable dtReporte; dtReporte = objUbicacionUsuario.ReporteUbicacionUsuarios(usu, ubi, "", "", 6); switch (dtReporte.Rows.Count) { case 0: DialogResult result = MessageBox.Show("Consulta Sin Resultados", "SIPAA"); break; default: ViewerReporte form = new ViewerReporte(); ReporteUbicacionesUsuarios dtrpt = new ReporteUbicacionesUsuarios(); ReportDocument ReportDoc = Utilerias.ObtenerObjetoReporte(dtReporte, this.CompanyName, dtrpt.ResourceName); ReportDoc.SetParameterValue("TotalRegistros", dtReporte.Rows.Count.ToString()); //ReportDoc.SetParameterValue("Filtro", cbEstatus.SelectedItem.ToString()); form.RptDoc = ReportDoc; form.Show(); break; } } //FILTRA CVUSUARIO else if (usuario > 0 & ubicacion == 0) { //Utilerias.ControlNotificaciones(panelTag, lbMensaje, 3, "modulo perfil"); //timer1.Start(); UbicacionUsuario objUbicacionUsuario = new UbicacionUsuario(); DataTable dtReporte; dtReporte = objUbicacionUsuario.ReporteUbicacionUsuarios(usu, "%", "", "", 6); switch (dtReporte.Rows.Count) { case 0: DialogResult result = MessageBox.Show("Consulta Sin Resultados", "SIPAA"); break; default: ViewerReporte form = new ViewerReporte(); ReporteUbicacionesUsuarios dtrpt = new ReporteUbicacionesUsuarios(); ReportDocument ReportDoc = Utilerias.ObtenerObjetoReporte(dtReporte, this.CompanyName, dtrpt.ResourceName); ReportDoc.SetParameterValue("TotalRegistros", dtReporte.Rows.Count.ToString()); //ReportDoc.SetParameterValue("Filtro", cbEstatus.SelectedItem.ToString()); form.RptDoc = ReportDoc; form.Show(); break; } } //FILTRA IDUBICACION else if (usuario == 0 & ubicacion > 0) { //Utilerias.ControlNotificaciones(panelTag, lbMensaje, 3, "modulo perfil"); //timer1.Start(); UbicacionUsuario objUbicacionUsuario = new UbicacionUsuario(); DataTable dtReporte; dtReporte = objUbicacionUsuario.ReporteUbicacionUsuarios("%", ubi, "", "", 6); switch (dtReporte.Rows.Count) { case 0: DialogResult result = MessageBox.Show("Consulta Sin Resultados", "SIPAA"); break; default: ViewerReporte form = new ViewerReporte(); ReporteUbicacionesUsuarios dtrpt = new ReporteUbicacionesUsuarios(); ReportDocument ReportDoc = Utilerias.ObtenerObjetoReporte(dtReporte, this.CompanyName, dtrpt.ResourceName); ReportDoc.SetParameterValue("TotalRegistros", dtReporte.Rows.Count.ToString()); //ReportDoc.SetParameterValue("Filtro", cbEstatus.SelectedItem.ToString()); form.RptDoc = ReportDoc; form.Show(); break; } } }
public async Task EditUbicacionUsuarioPost(UbicacionUsuario ubicacion) { _context.Update(ubicacion); await _context.SaveChangesAsync(); }
public async Task CreateUbicacionUsuario(UbicacionUsuario ubicacion) { _context.Add(ubicacion); await _context.SaveChangesAsync(); }