private void btnFind_Click(object sender, EventArgs e) { AMBaseDepartmentBLL AMBaseDepartmentBLL = new AMBaseDepartmentBLL(); SysUserBLL SysUserBLL = new SysUserBLL(); SysUser SysUser = new SysUser(); List <SysUser> user = new List <SysUser>(); user.Clear(); string tree = treeView1.SelectedNode.Text; var rows = AMBaseDepartmentBLL.GetList_F_ID(tree); if (rows == null || rows.Count < 1) { untCommon.InfoMsg("该部门暂无人员,请选择正确的部门!"); return; } for (int i = 0; i < rows.Count; i++) { MesDeviceBLL MesDeviceBLL = new MesDeviceBLL(); SysUser = SysUserBLL.getDetail_F_DepartmentId(rows[i].F_DepartmentId); if (SysUser != null && !string.IsNullOrEmpty(SysUser.ToString())) { var MesDeviceID = MesDeviceBLL.GetList_Deparemaent(tree, ""); string personId = ""; if (string.IsNullOrEmpty(txt_name.Text)) { personId = "-1"; } else { personId = txt_name.Text.Trim();//SysUser.F_EnCode } for (int j = 0; i < rows.Count; i++) { SysUser.K_Device = MesDeviceID[j].D_Name; string url = "http://" + MesDeviceID[j].D_IP + ":8090/findRecords"; string postData = "pass=12345678&personId=" + personId + "&length=-1&index=0&startTime=0&endTime=0"; string strtemp = FaceRecognition.Port(url, postData); if (FaceRecognition.json(strtemp)) { JObject joModel = (JObject)JsonConvert.DeserializeObject(strtemp); string strData; if (bool.Parse(joModel["success"].ToString())) { strData = joModel["result"].ToString(); } else { strData = joModel["msg"].ToString(); untCommon.InfoMsg(strData); } if (joModel["result"].ToString() == "1") { //this.dataGridView.Rows[i].Cells["状态"].Value = "在线"; SysUser.K_Status = "签到成功"; var data = joModel["data"]; var records = (JArray)data["records"]; var jObj = (JObject)records[0]; var strTime = (string)jObj["time"].ToString(); DateTime time = FaceRecognition.ConvertToDateTime(strTime); SysUser.K_Time = time.ToString(); } else { //this.dataGridView.Rows[i].Cells["状态"].Value = "离线"; SysUser.K_Status = "签到失败"; } } else { untCommon.InfoMsg("该IP地址不可用!"); //this.dataGridView.Rows[i].Cells["状态"].Value = "离线"; SysUser.K_Status = "签到失败"; } user.Add(SysUser); } } } if (user == null || user.Count < 1) { untCommon.InfoMsg("该部门暂无人员!"); return; } dataGridView.DataSource = user; }
/// <summary> /// 修改 /// </summary> private void updateUser() { try { if (checkInput()) { SysUser user = new SysUser(); AMBaseDepartmentBLL AMBaseDepartmentBLL = new AMBaseDepartmentBLL(); var rows = AMBaseDepartmentBLL.GetList_F_ID(D_Code.Text); user.F_Account = F_Account.Text; user.F_RealName = F_RealName.Text; //user.F_Password = U_Pwd.Text; user.F_Gender = F_Gender.Text == "男" ? 1 : 0; //user.D_Code = D_Code.SelectedValue.ToString(); user.D_Code = D_Code.Text; user.F_DepartmentId = rows[0].F_DepartmentId; user.R_CSCode = R_Code.SelectedValue.ToString(); user.F_TeamCode = cmbTeam.SelectedValue.ToString(); user.F_TeamName = cmbTeam.Text.ToString(); user.F_Mobile = F_Mobile.Text; user.F_Email = F_Email.Text; user.F_OICQ = F_OICQ.Text; user.F_WeChat = F_WeChat.Text; user.U_Address = U_Address.Text; user.F_Description = F_Description.Text; user.F_EnabledMark = F_EnabledMark.Checked; user.F_CreateUserName = F_CreateUserName.Text; user.F_CreateDate = F_CreateDate.Value; user.F_ModifyUserName = SysUser.F_RealName.ToString(); user.F_ModifyDate = DateTime.Now; switch (F_Kind.Text) { case "正式工": user.F_Kind = 1; break; case "临时工": user.F_Kind = 2; break; case "劳务工": user.F_Kind = 3; break; } user.F_RFIDCode = F_RFIDCode.Text; //user.F_Indate = F_Indate.Text; //user.F_Outdate = F_Outdate.Text; user.F_Cert = F_Cert.Text; user.F_Nation = F_Nation.Text; user.F_Record = F_Record.Text; user.F_Origin = F_Origin.Text; //user.F_Picture1 = F_RFIDCode.Text; SysUserBLL userbll = new SysUserBLL(); if (userbll.Edit(user) > 0) { untCommon.InfoMsg("修改成功!"); frmParent.loadData(); this.Close(); } else { untCommon.InfoMsg("修改失败!"); } } } catch (Exception ex) { untCommon.ErrorMsg("角色管理更新数据异常:" + ex.Message); } }