Exemplo n.º 1
0
        private void gridbind(string key)
        {
            object[]  par = new object[] { key };
            DataTable dt  = conn.GetDataTable("select * from VW_SLIK_ADDRESS where appid = @1", par, dbtimeout);

            GridViewAddr.DataSource = dt;
            GridViewAddr.DataBind();
            dt = conn.GetDataTable("select distinct tempatBekerja from VW_SLIK_ADDRESS where appid = @1", par, dbtimeout);
            GridViewComp.DataSource = dt;
            GridViewComp.DataBind();
        }
Exemplo n.º 2
0
        private List <Squad> getCompData(string URL)
        {
            Object     ar         = new object();
            var        jsonstring = JsonConvert.SerializeObject(ar);
            HttpClient httpclient = new HttpClient();

            httpclient.DefaultRequestHeaders.Accept.Clear();
            httpclient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            HttpResponseMessage msg      = httpclient.GetAsync(URL).Result;
            List <Squad>        itemList = null;

            if (msg.IsSuccessStatusCode)
            {
                var         data = msg.Content.ReadAsStringAsync().Result;
                RootObject1 obj  = JsonConvert.DeserializeObject <RootObject1>(data);
                itemList = new List <Squad>(obj.response.squads);
                GridViewComp.DataSource = itemList;
                GridViewComp.DataBind();
            }
            return(itemList);
        }