private void button1_Click(object sender, EventArgs e) { if (MessageBox.Show("是否要保存", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes) { MesDeviceBLL MesDeviceBLL = new MesDeviceBLL(); var rows = MesDeviceBLL.GetList(); if (rows.Count > 0) { for (int i = 0; i < rows.Count; i++) { string url = "http://" + rows[i].D_IP + ":8090/setIdentifyCallBack"; string postData = "pass="******"&" + "callbackUrl=" + txtUrl.Text; //http://192.168.1.140:8090/api/FaceRecording/GetUserInfo"; string strtemp = FaceRecognition.RequestWithHttps(url, postData); if (!FaceRecognition.json(strtemp)) { untCommon.InfoMsg("该IP地址不可用!"); return; } JObject joModel = (JObject)JsonConvert.DeserializeObject(strtemp); if (!bool.Parse(joModel["success"].ToString())) { untCommon.InfoMsg(joModel["msg"].ToString()); return; } else { untCommon.InfoMsg("人脸识别回调设置成功!"); } } } } }
private void button2_Click_1(object sender, EventArgs e) { MesDeviceBLL MesDeviceBLL = new MesDeviceBLL(); var MesDevice = MesDeviceBLL.GetList_Deparemaent(txtDepartment.Text, txtTeam.Text); SysUserBLL userbll = new SysUserBLL(); var user = userbll.getDetail_F_EnCode(F_Account); if (MesDevice.Count < 1 || MesDevice == null) { untCommon.InfoMsg("该部门暂无人脸识别设备!"); return; } for (int i = 0; i < MesDevice.Count; i++) { string url = "http://" + MesDevice[i].D_IP + ":8090/person/delete"; string postData = "pass="******"&id=" + user[i].F_Account + ""; string strtemp = FaceRecognition.RequestWithHttps(url, postData); if (!FaceRecognition.json(strtemp)) { untCommon.InfoMsg("该IP地址不可用!"); return; } JObject joModel = (JObject)JsonConvert.DeserializeObject(strtemp); if (!bool.Parse(joModel["success"].ToString())) { untCommon.InfoMsg(joModel["msg"].ToString()); return; } else { label3.Text = "未注册"; pictureBox1.Image = null; untCommon.InfoMsg("人脸识别用户删除成功!"); } } }
/// <summary> /// 注册人员到设备 /// </summary> private void RegFace() { #region MesDeviceBLL MesDeviceBLL = new MesDeviceBLL(); var MesDevice = MesDeviceBLL.GetList_Deparemaent(txtDepartment.Text, txtTeam.Text); SysUserBLL userbll = new SysUserBLL(); var user = userbll.getDetail_F_EnCode(F_Account); if (MesDevice.Count < 1 || MesDevice == null) { untCommon.InfoMsg("该部门暂无人脸识别设备!"); return; } for (int i = 0; i < MesDevice.Count; i++) { string url = "http://" + MesDevice[i].D_IP + ":8090/person/create"; string postData = "pass="******"&person={\"id\":" + "\"" + user[i].F_Account + "\"," + "\"idcardNum\":" + "\"" + null + "\"," + "\"name\":" + "\"" + txtUserName.Text + "\"" + "}"; string strtemp = FaceRecognition.RequestWithHttps(url, postData); if (!FaceRecognition.json(strtemp)) { untCommon.InfoMsg("该IP地址不可用!"); return; } JObject joModel = (JObject)JsonConvert.DeserializeObject(strtemp); if (!bool.Parse(joModel["success"].ToString())) { untCommon.InfoMsg(joModel["msg"].ToString()); return; } else { untCommon.InfoMsg("人脸识别用户注册成功!"); } } #endregion }