public async Task ListRegionsNotNull()
        {
            DatosRegion   datosRegion = new DatosRegion();
            List <Region> regions     = await datosRegion.GetRegions();

            int result = regions.Count > 0 ? 1 : 0;

            Assert.AreEqual(1, result, 0.001, "Regions list is empty");
        }
Esempio n. 2
0
 protected void llenarCbo()
 {
     try
     {
         cboRegion.DataSource = DatosRegion.ListarRegion();
         cboRegion.DataBind();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Esempio n. 3
0
    public static Provincia BuscarProvincia(int codigo)
    {
        try
        {
            Provincia obj = new Provincia();

            Conexion c = new Conexion();

            string servidor = c.cadena();

            SqlConnection conexion = new SqlConnection(servidor);
            SqlCommand    comando  = new SqlCommand
            {
                Connection  = conexion,
                CommandType = CommandType.StoredProcedure,
                CommandText = "P_BUSCAR_PROVINCIA"
            };

            SqlParameter parametro = new SqlParameter
            {
                ParameterName = "@PIN_CODIGO",
                SqlDbType     = SqlDbType.Int,
                Value         = codigo
            };

            comando.Parameters.Add(parametro);
            SqlDataAdapter myDA = new SqlDataAdapter(comando);
            DataTable      dt   = new DataTable();
            myDA.Fill(dt);
            obj.Id          = int.Parse(dt.Rows[0][0].ToString());
            obj.Descripcion = dt.Rows[0][1].ToString();
            obj.Region      = DatosRegion.BuscarRegion(Convert.ToInt32(dt.Rows[0][2].ToString()));
            obj.Estado      = dt.Rows[0][3].ToString();

            return(obj);
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }