public async Task <bool> ReaderSetMode(string panelID, string readerID, IReader.readerMode modeID, string path, string user, string pass) { try { ManagementScope readerScope = _dataConduITMgr.GetManagementScope(path, user, pass); ObjectQuery readerSearcher = new ObjectQuery("SELECT * FROM Lnl_Reader WHERE PanelID='" + panelID + "' " + "AND ReaderID='" + readerID + "'"); ManagementObjectSearcher getreader = new ManagementObjectSearcher(readerScope, readerSearcher); foreach (ManagementObject queryObj in getreader.Get()) { ManagementBaseObject inParams = queryObj.GetMethodParameters("SetMode"); inParams.Properties["Mode"].Value = modeID; queryObj.InvokeMethod("SetMode", inParams, null); return(true); } return(false); } catch (Exception ex) { throw new Exception("No fue posible enviar el evento " + ex.Message); } }
public async Task <object> CambioEstadoPuerta(ReaderPath_DTO readerPath, int estado) { IReader.readerMode readerMode = (IReader.readerMode)Enum.Parse(typeof(IReader.readerMode), estado.ToString()); try { return(await _reader_REP.ReaderSetMode(readerPath.panelID, readerPath.readerID, readerMode, _path, _user, _pass)); } catch (Exception ex) { throw new Exception(ex.Message); } }