Ejemplo n.º 1
0
        //EDITAR SUBESTACION
        public SubestacionesForm Editar(string id)
        {
            var db = new Conexion();
            SubestacionesForm editar = new SubestacionesForm();

            conn.Open();
            //cadena para insertar una torre
            NpgsqlCommand command = new NpgsqlCommand("select * from Ed_Subestacion('" + id + "')", conn);

            NpgsqlDataReader dr = command.ExecuteReader();

            while (dr.Read())
            {
                editar.id = dr[0].ToString();
                editar.nombre = dr[1].ToString();
                editar.coordenadas = dr[2].ToString().Trim(new Char[] { 'P', 'O', 'I', 'N', 'T', '(', ')' });
                Regex regex = new Regex(" ");
                string[] substrings = regex.Split(editar.coordenadas);
                editar.lat = substrings[0];
                editar.lon = substrings[1];
                editar.t_coordenadas = 1;
                editar.ficheros = db.Subestaciones_Documentos.Where(m => m.subestacion_id == id).ToList();
            }

            return editar;


        }
Ejemplo n.º 2
0
 //MODIFICAR SUBESTACION POR UTM
 public bool UTM_Modificar(SubestacionesForm subestacion)
 {
     conn.Open();
     NpgsqlCommand command = new NpgsqlCommand("select UTM_U_Subestacion('" + subestacion.id + "','" + subestacion.nombre + "'," + subestacion.lon.Replace(",", ".") + "," + subestacion.lat.Replace(",", ".") + ")", conn);
     NpgsqlDataReader dr = command.ExecuteReader();
     bool value = false;
     while (dr.Read())
     {
         value = bool.Parse(dr[0].ToString());
     }
     conn.Close();
     return value;
 }
Ejemplo n.º 3
0
        public bool Modificar(SubestacionesForm sub)
        {
            conn.Open();
            string modificar = "";
            bool retorno = false;
            //cadena para insertar una torre
            NpgsqlCommand command = new NpgsqlCommand("select * from U_Subestaciones('" + sub.id + "','" + sub.nombre + "'," + sub.lat + "," + sub.lon + ")", conn);

            NpgsqlDataReader dr = command.ExecuteReader();
            while (dr.Read())
            {
                modificar = dr[0].ToString();
            }

            if (modificar == "True")
            {
                retorno = true;
            }

            conn.Close();


            return retorno;
        }