Esempio n. 1
0
        public List <csPath> ListarPath(int codNegocio)
        {
            List <csPath> lista = new List <csPath>();

            cnn = Conexion.AbrirCnn();
            csPath path;

            try
            {
                cmd = new SqlCommand("select * from path where fk_id_negocio=@fk_id_negocio", cnn);
                cmd.Parameters.AddWithValue("@fk_id_negocio", codNegocio);
                read = cmd.ExecuteReader();
                while (read.Read())
                {
                    int    id_path       = int.Parse(read["id_path"].ToString());
                    String pathS         = read["path"].ToString();
                    int    fk_id_negocio = int.Parse(read["fk_id_negocio"].ToString());
                    path = new csPath(id_path, pathS, fk_id_negocio);
                    lista.Add(path);
                }
            }
            catch (Exception ex)
            {
                rta = ex.ToString();;
            }
            return(lista);
        }
Esempio n. 2
0
        public Boolean CrearPath(csPath path)
        {
            cnn = Conexion.AbrirCnn();
            Boolean retorno = false;

            try
            {
                cmd = new SqlCommand("INSERT INTO path (path,fk_id_negocio) VALUES (@path,@idNegocio)", cnn);
                cmd.Parameters.AddWithValue("@path", path.path);
                cmd.Parameters.AddWithValue("@idNegocio", path.fk_id_negocio);
                cmd.ExecuteNonQuery();
                retorno = true;
                Conexion.CerrarCnn(cnn);
            }
            catch (Exception ex)
            {
                Conexion.CerrarCnn(cnn);
                rta = ex.ToString();
            }
            return(retorno);
        }