/// <summary> /// Método Insertar Apoyo con coordenadas UTM /// </summary> /// <param name="nuevo"></param> /// <returns></returns> public bool Insertar_UTM(ApoyoForm nuevo) { if (nuevo.a_o_s == "0") { nuevo.amarre = true; nuevo.sustentacion = false; } else { nuevo.amarre = false; nuevo.sustentacion = true; } conn.Open(); //cadena para insertar una torre NpgsqlCommand command = new NpgsqlCommand("select C_APOYO('" + nuevo.id + "','" + nuevo.nombre + "'," + nuevo.lon.Replace(",", ".") + "," + nuevo.lat.Replace(",", ".") + ",'" + nuevo.tipo_cimentacion + "'," + nuevo.ano_actual + "," + nuevo.o_acceso_coche + "," + nuevo.o_distancia_pie + ",'" + nuevo.referencia_catastral + "','" + nuevo.amarre + "','" + nuevo.sustentacion + "'," + nuevo.num_empalmes + ",'" + nuevo.seguridad + "','" + nuevo.suelo + "','" + nuevo.tipo_foemp + "','" + nuevo.observaciones + "','" + nuevo.linea + "','" + nuevo.a_mantenimiento +"',"+ nuevo.num_cir + ")", conn); NpgsqlDataReader dr = command.ExecuteReader(); bool id = false; while (dr.Read()) { id = bool.Parse(dr[0].ToString()); } conn.Close(); return id; }
public async Task<ActionResult> Editar(string id) { try { ApoyoLista apoyo = await db.ApoyoLista.FindAsync(id); if (apoyo == null) { return HttpNotFound(); } bool comprobar =new Apoyo().ComprobarApoyo(id, User.Identity.GetUserId()); if (comprobar) { ApoyoForm editar = new ApoyoForm(apoyo); TempData["confirmacion"] = "Desea Eliminar esta Inspección?"; TempData["confirmacionD"] = "Desea Eliminar este Documento?"; return View(editar); } else { TempData["MensajeAP"] = "Prohibido el acceso a este Apoyo con tus credenciales"; return RedirectToAction("Index","Acceso"); //throw new HttpException(401, "Unauthorized"); } } catch (Exception e) { throw new HttpException(500, e.ToString()); } }
//Update APOYO UTM public bool UTM_E_Apoyo(ApoyoForm apoyo) { conn.Open(); string modificar = ""; bool retorno = false; //cadena para insertar una torre NpgsqlCommand command = new NpgsqlCommand("select * from UTM_E_Apoyo('" + apoyo.id + "','" + apoyo.nombre + "'," + apoyo.lat.Replace(",", ".") + "," + apoyo.lon.Replace(",", ".") + ",'" + apoyo.tipo_cimentacion + "'," + apoyo.ano_actual + "," + apoyo.o_acceso_coche + "," + apoyo.o_distancia_pie + ",'" + apoyo.linea + "','" + apoyo.referencia_catastral + "','" + apoyo.amarre + "','" + apoyo.sustentacion + "'," + apoyo.num_empalmes + ",'" + apoyo.observaciones + "','" + apoyo.seguridad + "','" + apoyo.suelo + "','" + apoyo.tipo_foemp +"','"+ apoyo.a_mantenimiento + "'," + apoyo.num_cir + ")", conn); NpgsqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { modificar = dr[0].ToString(); } if (modificar == "True") { retorno = true; } conn.Close(); return retorno; }
public ActionResult Nuevo() { ApoyoForm nuevo = new ApoyoForm(); return View(nuevo); }