public async Task<Operaciones> FindId(string id) { Conexion db = new Conexion(); Utiles utiles = new Utiles(); Operaciones operaciones = await db.Operaciones.FindAsync(id); Operaciones_Subcontratas sub_con = await db.Operaciones_Subcontratas.SingleOrDefaultAsync(m=>m.operacion_id==id); if(sub_con !=null){ operaciones.subcontrata = sub_con.subcontrata_id; operaciones.coste_sub = sub_con.cantidad; } List<Operaciones_Documentos> lista_ficheros = await db.Operaciones_Documentos.Where(m => m.operacion_id == id).ToListAsync(); if(lista_ficheros.Count > 0){ operaciones.ficheros = lista_ficheros; } operaciones.lista_anomalias = utiles.Listas()[1]; operaciones.lista_tipo_personal = utiles.Listas()[2]; operaciones.lista_tipo_maquinaria = utiles.Listas()[3]; operaciones.lista_tipo_material = utiles.Listas()[4]; operaciones.lista_subcontratas = utiles.Listas()[5]; operaciones.valores_personal = await db.Operaciones_TipoPersonal.Where(m => m.operacion == id).ToListAsync(); operaciones.valores_material = await db.Operaciones_TipoMaterial.Where(m => m.operacion == id).ToListAsync(); operaciones.valores_maquinaria = await db.Operaciones_TipoMaquinaria.Where(m => m.operacion == id).ToListAsync(); return operaciones; }
public Operaciones() { Conexion db = new Conexion(); Utiles utiles = new Utiles(); this.id = Guid.NewGuid().ToString(); this.lista_anomalias = utiles.Listas()[1]; this.lista_tipo_personal = utiles.Listas()[2]; this.lista_tipo_maquinaria = utiles.Listas()[3]; this.lista_tipo_material = utiles.Listas()[4]; this.lista_subcontratas = utiles.Listas()[5]; }
public DetallesPerfil(UserManager<ApplicationUser> userManager, string id) { var user = userManager.FindById(id); if(user!=null){ Conexion db = new Conexion(); ApplicationDbContext dba = new ApplicationDbContext(); Utiles utiles = new Utiles(); this.id = id; this.nombre = user.nombre; this.apellido1 = user.apellido1; this.apellido2 = user.apellido2; this.telefono = user.telefono; this.email = user.email; this.fecha_creado = user.fecha_creado; this.fecha_ul_acceso = user.fecha_ul_acceso; this.perfil = user.perfil; this.roles = dba.User_Role.Where(m => m.UserId == this.id).Select(m => m.RoleId).ToList(); this.listaroles = utiles.Listas()[0]; this.historialUsuario = db.Historial.Where(m => m.usuario == this.id).OrderByDescending(m=>m.fecha).ToList(); } }
public async Task<ActionResult> Nuevo([Bind(Include="id,nombre,descripcion,anomalia,grado_anomalia,tiempo_programacion,tiempo_ejecucion,rendimiento,coste_total")] Operaciones operaciones) { if (ModelState.IsValid) { operaciones.medios = "propios"; db.Operaciones.Add(operaciones); await db.SaveChangesAsync(); Historial nuevo = new Historial("Creó", User.Identity.GetUserId(), "Operaciones", operaciones.id, operaciones.nombre, Request.UserHostAddress); TempData["Mensaje"] = "Operación creada correctamente."; return RedirectToAction("Editar", "Operaciones", new {id=operaciones.id }); } TempData["Mensaje"] = "Error al crear la Operación."; Utiles utiles = new Utiles(); operaciones.lista_anomalias = utiles.Listas()[1]; return View(operaciones); }
/// <summary> /// Constructor para editar un Apoyo /// </summary> /// <param name="editar"></param> public ApoyoForm(ApoyoLista editar) { Conexion db = new Conexion(); this.id = editar.id; this.nombre = editar.nombre; this.num_cir = editar.num_cir; this.num_empalmes = editar.num_empalmes; this.acceso_coche = editar.acceso_coche; this.distancia_pie = editar.distancia_pie.GetValueOrDefault(); this.o_acceso_coche = editar.o_acceso_coche; this.o_distancia_pie = editar.o_distancia_pie; this.observaciones = editar.observaciones; this.referencia_catastral = editar.referencia_catastral; this.seguridad = editar.seguridad; this.suelo = editar.suelo; this.sustentacion = editar.sustentacion; this.t_coordenadas = 1; this.tipo_cimentacion = editar.tipo_cimentacion; this.tipo_foemp = editar.tipo_foemp; this.linea = editar.linea; this.lat = editar.lat.Replace(",", "."); this.lon = editar.lon.Replace(",", "."); this.a_mantenimiento = editar.a_mantenimiento; this.ficheros = db.Apoyo_Documentos.Where(m => m.apoyo_id == editar.id).ToList(); this.listaInspecciones = db.Inspecciones.Where(m=>m.id_apoyo == this.id).ToList(); this.listaKRiesgo = db.KRiesgo.Where(m => m.id_apoyo == editar.id).ToList(); this.listaRiesgos = db.Riesgos.ToList(); this.listaTCalculoRiesgo = new CalculoRiesgo().ListaDrop(); if (editar.amarre) { this.a_o_s = "0"; } else { this.a_o_s = "1"; } Utiles utiles = new Utiles(); this.listaLineas = utiles.Listas()[6]; this.listaTC = utiles.Listas()[7]; this.listaCircuitos = db.Circuitos.OrderBy(m => m.nombre).ToList(); this.ano_actual = DateTime.Now.Year.ToString(); List<SelectListItem> liHoras = new List<SelectListItem>(); for (int i = 1965; i <= DateTime.Now.Year; i++) { SelectListItem nuevo = new SelectListItem(); nuevo.Text = i.ToString(); nuevo.Value = i.ToString(); liHoras.Add(nuevo); } this.listaHoras = liHoras; }
public ApoyoForm(){ Utiles utiles = new Utiles(); Conexion db = new Conexion(); this.listaLineas = utiles.Listas()[6]; this.listaTC = utiles.Listas()[7]; this.listaCircuitos = db.Circuitos.OrderBy(m => m.nombre).ToList(); this.ano_actual = DateTime.Now.Year.ToString(); List<SelectListItem> liHoras = new List<SelectListItem>(); for (int i = 1965; i <= DateTime.Now.Year; i++) { SelectListItem nuevo = new SelectListItem(); nuevo.Text = i.ToString(); nuevo.Value = i.ToString(); liHoras.Add(nuevo); } this.listaHoras = liHoras; }