private void button6_Click(object sender, EventArgs e) { //查询人脸 string faceurl = eip.Text + ":8090/face/find"; string personId = personid.Text; Hashtable ht = new Hashtable(); ht.Add("pass", "12345678"); ht.Add("personId", personId); string aa = HttpUitls.DoPost(faceurl, ht); //HttpRequest是自定义的一个类 //MessageBox.Show(aa); Facepic pic = JsonConvert.DeserializeObject<Facepic>(aa); //MessageBox.Show(pic); for (int i = 0; i < pic.data.Count; i++) { string strImageURL = pic.data[i].path; //MessageBox.Show(strImageURL); string savepath = @"D:\Fx\" + pic.data[i].personId + ".jpg"; WebClient mywebclient = new WebClient(); try { mywebclient.DownloadFile(strImageURL, savepath); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } MessageBox.Show("照片查询成功"); } }
private void button11_Click(object sender, EventArgs e) { //远程开门 string faceurl = eip.Text + ":8090/device/openDoorControl"; Hashtable ht = new Hashtable(); ht.Add("pass", "12345678"); string aa = HttpUitls.DoPost(faceurl, ht); //HttpRequest是自定义的一个类 MessageBox.Show(aa); }
private void button2_Click(object sender, EventArgs e) { //获取设备序列号 string url = eip.Text + ":8090/getDeviceKey"; //将接口传入,这个HttpUitls的类,有兴趣可以研究下,也可以直接用就可以,不用管如何实现。 string getJson = HttpUitls.Get(url); Root rt = JsonConvert.DeserializeObject<Root>(getJson); equipnum.Text = rt.data; }
private void button4_Click(object sender, EventArgs e) { //删除人员 string createurl = eip.Text + ":8090/person/delete"; string id = personid.Text; Hashtable ht = new Hashtable(); ht.Add("pass", "12345678"); ht.Add("id", id); string aa = HttpUitls.DoPost(createurl, ht); //HttpRequest是自定义的一个类 MessageBox.Show(aa); }
private void button1_Click(object sender, EventArgs e) { //设置识别回调地址 string faceurl = equipurl.Text; string callbackUrl = callbackurl.Text; Hashtable ht = new Hashtable(); ht.Add("pass", "12345678"); ht.Add("callbackUrl", callbackUrl); string aa = HttpUitls.DoPost(faceurl, ht); //HttpRequest是自定义的一个类 MessageBox.Show(aa); }
private void button10_Click(object sender, EventArgs e) { //删除人脸 string faceurl = eip.Text + ":8090/face/delete"; string faceId = personid.Text; Hashtable ht = new Hashtable(); ht.Add("pass", "12345678"); ht.Add("faceId", faceId); string aa = HttpUitls.DoPost(faceurl, ht); //HttpRequest是自定义的一个类 MessageBox.Show(aa); }
private void button9_Click(object sender, EventArgs e) { //更新人脸 string faceurl = eip.Text + ":8090/face/update"; string personId = personid.Text; string faceId = personid.Text; string base64string = base64str; Hashtable ht = new Hashtable(); ht.Add("pass", "12345678"); ht.Add("personId", personId); ht.Add("faceId", faceId); ht.Add("imgBase64", base64string); string aa = HttpUitls.DoPost(faceurl, ht); //HttpRequest是自定义的一个类 MessageBox.Show(aa); }
private void button3_Click(object sender, EventArgs e) { //创建人员 string createurl = eip.Text + ":8090/person/create"; string id = personid.Text; string name = uname.Text; string idcardNum = idcardnum.Text; Person ps = new Person(); ps.id = id; ps.name = name; ps.idcardNum = idcardNum; string createperson = JsonConvert.SerializeObject(ps, new JsonSerializerSettings() { StringEscapeHandling = StringEscapeHandling.EscapeNonAscii }); Hashtable ht = new Hashtable(); ht.Add("pass", "12345678"); ht.Add("person", createperson); string aa = HttpUitls.DoPost(createurl, ht); //HttpRequest是自定义的一个类 MessageBox.Show(aa); }