/// <summary> /// 开门 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void btnOpen_Click(object sender, EventArgs e) { GridButtonXEditControl btn = sender as GridButtonXEditControl; if (btn == null) { return; } CmcsCamareTemp camera = btn.EditorCell.GridRow.DataItem as CmcsCamareTemp; if (camera == null) { return; } if (IsLogin) { iPCer1.LoginOut(); } if (iPCer1.Login(camera.Ip, camera.Port, camera.UserName, camera.Password) && iPCer1.OpenDoor()) { IsLogin = true; MessageBoxEx.Show("开门成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); commonDAO.SaveOperationLog(camera.Name + "开门", GlobalVars.LoginUser.Name); } }
private void BindData() { string sqlWhere = "where Type='门禁' and IP is not null "; if (!string.IsNullOrEmpty(txtSearch.Text)) { sqlWhere += " and Name like '%" + txtSearch.Text + "%'"; } List <CmcsCamare> listCmcsCamare = CommonDAO.GetInstance().SelfDber.Entities <CmcsCamare>(sqlWhere + " order by Sort"); List <CmcsCamareTemp> list = new List <CmcsCamareTemp>(); foreach (var item in listCmcsCamare) { CmcsCamareTemp entity = new CmcsCamareTemp(); entity.Ip = item.Ip; entity.Port = item.Port; entity.UserName = item.UserName; entity.Password = item.Password; entity.Name = item.Name; entity.Status = CommonUtil.PingReplyTest(entity.Ip)?"关闭":"打开"; list.Add(entity); } superGridControl1.PrimaryGrid.DataSource = list; }