// Se llama en el destructor del Panel de la zona. public void deleteZone(int PanelID) { PoolGetConnStatus.GetInstance().subRefCount(); //PoolGetAlarm.GetInstance().subRefCount(); PoolGetAcceso.GetInstance().subRefCount(); System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); string orgID = Helpers.GetInstance().MainOrgID.ToString(); // El configurado en el registro try { //Helpers.GetInstance().mutexTCP.WaitOne(); try { string errDesc = ""; int errCode = (int)StatusCode.NOT_IMPLEMENTED; if (!WebServiceAPI.GetInstance().ExistePanelEnOnGuard(PanelID.ToString(), out errDesc, out errCode)) { WebServiceAPI.GetInstance().DeleteZone(PanelID.ToString(), orgID, out errDesc, out errCode); } } catch (Exception) { } } catch (Exception) { } }
void actualizarConnStatus() { Helpers.GetInstance().DoLog("Comienza Task de actualizacion de ConnStatus..."); while (!finalizarPoolStatus.WaitOne(5000)) { try { Dictionary <int, bool> listaStatus = WebServiceAPI.GetInstance().GetConnStatusMobileGeneral(); if (listaStatus != null) { lock (statusDevices) { foreach (KeyValuePair <int, bool> par in listaStatus) { setConnStatus(par.Key, par.Value); } } } } catch (Exception ex) { Helpers.GetInstance().DoLog("EXCEPCION en actualizarConnStatus:" + ex.Message); } } Helpers.GetInstance().DoLog("Finaliza Thread de actualizacion de ConnStatus."); }
// Devuelve: latitud,longitud,fechahora,HHID private string getLastPositionDateTime() { string res = ""; try { string errDesc = ""; int errCode = -1; string encodedGPS = WebServiceAPI.GetInstance().GetPosition(DEVICEID, ORGID.ToString(), out errDesc, out errCode); Match matchRespuesta = Pos_Data.Match(encodedGPS); // Si no hay match es porque se devolvio NO_LOCATION. Seguir de largo. if (matchRespuesta.Success) { string latitud = getMatchData(matchRespuesta, 1); string longitud = getMatchData(matchRespuesta, 2); string dateTime = getMatchData(matchRespuesta, 3); string HHID = getMatchData(matchRespuesta, 4); res = latitud + "," + longitud + "," + dateTime + "," + HHID; } } catch (Exception ex) { Tools.GetInstance().DoLog("Excepcion en getLastPositionDateTime: " + ex.Message); } return(res); }
private void btnSend_Click_1(object sender, EventArgs e) { string textToSend = txtToSend.Text.Replace("\r\n", "").Replace("\n", ""); if (!String.IsNullOrEmpty(textToSend.Trim())) { System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); try { // string comando = "TYPE:LNL_MSG,DEVICEID:" + DEVICEID + ",ORGANIZATION:" + ORGANIZATIONID + ",MSG:" + textToSend.Trim(); string errDesc = ""; int errCode = -1; WebServiceAPI.GetInstance().SendMSG(DEVICEID.ToString(), ORGANIZATIONID.ToString(), textToSend.Trim(), out errDesc, out errCode); addTextoToView(textToSend, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), true); } catch (Exception ex) { Tools.GetInstance().DoLog("Excepcion en boton Send: " + ex.Message); } } txtToSend.Text = ""; }
private string pollForNew(int v_deviceID, int v_orgID, DateTime v_lastReceived) { string res = ""; try { string errDesc = ""; int errCode = -1; string mensaje = WebServiceAPI.GetInstance().GetNewMessages(v_deviceID.ToString(), v_orgID.ToString(), v_lastReceived.ToString("yyyy-MM-dd HH:mm:ss"), out errDesc, out errCode); Match headerResp = msgReg.Match(mensaje); if (headerResp.Success) { res = getMatchData(headerResp, 1); string fecha = getMatchData(headerResp, 2); g_lastReceived = Convert.ToDateTime(fecha); // Actualiza la variable global con la fecha del mensaje recibido } } catch (Exception ex) { Tools.GetInstance().DoLog("Excepcion en PollForNew(): " + ex.Message); } return(res); }
/// <summary> /// Carga la Zona y actualiza las variables globales ZonaName y triggerMode, pasadas por parametro. /// espera la info y muestra la zona en el mapa. /// </summary> /// <param name="v_PanelID"></param> public void cargarDatosUnaZona(ref string zName, ref string zonaDef, ref int triggerMode, string v_PanelID, int orgID) { try { int errCode = -1; string errDesc = ""; DoLog("Va a cargar la zona " + zName); zonaDef = WebServiceAPI.GetInstance().GetOnlyZone(v_PanelID, orgID.ToString(), out errDesc, out errCode); DoLog("Zona Cargada. Datos: " + zonaDef); triggerMode = int.Parse(zonaDef.Substring(0, 1)); // El primer dato es el TriggerMode. // Le saco el triggerMode a los datos geometricos de la zona if (zonaDef.Length >= 2) { zonaDef = zonaDef.Substring(2, zonaDef.Length - 2); } else { zonaDef = ""; } } catch (Exception ex) { DoLog("EXCEPCION en cargarDatosUnaZona(): " + ex.Message); } }
private void updateLinkedUserView() { string errDesc = ""; int errCode = (int)StatusCode.OK; datosEmpleado = WebServiceAPI.GetInstance().GetLinkedEmployee(DEVICEID, ORGANIZATIONID, out errDesc, out errCode); if ((datosEmpleado.Key == null) || (datosEmpleado.Value == null)) { Tools.GetInstance().DoLog("GetLinkedEmployee devolvio null. errDesc=" + errDesc + " errCode=" + errCode); } else { lblFirstName.Text = datosEmpleado.Key.Nombre; lblLastName.Text = datosEmpleado.Key.Apellido; lblSSNO.Text = datosEmpleado.Key.NumeroDocumento; lblBadge.Text = datosEmpleado.Value.tarjeta; // Le carga los accessLevels de lenel ya que el addEmployee final, que lo va a mandar a AlutelMobility espera accesslevels de Lenel datosEmpleado.Value.accessLevels = WebServiceAPI.GetInstance().GetAccessLevelsLenel(datosEmpleado.Value.tarjeta, ORGANIZATIONID.ToString(), out errDesc, out errCode); linkedBadge = datosEmpleado.Value.tarjeta; Tools.GetInstance().DoLog("En updateLinkedUser(). Name=" + datosEmpleado.Key.Nombre + " Apellido=" + datosEmpleado.Key.Apellido + " tarjeta=" + datosEmpleado.Value.tarjeta + " AccessLevels=" + datosEmpleado.Value.accessLevels); if (datosEmpleado.Key.imageDataBytes != null) { picLinkedEmp.Image = Tools.GetInstance().ByteToImage(datosEmpleado.Key.imageDataBytes, datosEmpleado.Key.imageDataBytes.Length); } } }
public PanelType getDeviceType(int v_devid) { PanelType res = PanelType.NODEFINIDO; System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); try { string errDesc = ""; int errCode = -1; res = WebServiceAPI.GetInstance().GetDeviceType(v_devid.ToString(), Tools.GetInstance().MainOrgID.ToString(), out errDesc, out errCode); if (errCode != (int)StatusCode.OK) { Tools.GetInstance().DoLog("Error en GetDeviceType(): " + errDesc); } } catch (Exception ex) { Tools.GetInstance().DoLog("Excepcion en GetDeviceType: " + ex.Message); } return(res); }
public void cargarPropiedadesDevice(string v_DeviceID, string v_OrgID, ref string v_deviceName, ref string v_deviceType, ref string v_mode, ref string v_speedLimit, ref string v_gpsUpdateTime) { try { Regex datosProperties = new Regex(@"NAME:(.*),TYPE:(.*),UPDATETIME:(.*),SPEEDLIMIT:(.*),MODE:(.*),DEVICES:(.*)"); int errCode = -1; string errDesc = ""; string datosProp = WebServiceAPI.GetInstance().GetProperties(v_DeviceID, v_OrgID, out errDesc, out errCode); //Tools.GetInstance().DoLog("datosProp: " + datosProp); Match matchHeader = datosProperties.Match(datosProp); if (matchHeader.Success) { v_deviceName = getMatchData(matchHeader, 1); v_deviceType = getMatchData(matchHeader, 2); v_gpsUpdateTime = getMatchData(matchHeader, 3); v_speedLimit = getMatchData(matchHeader, 4); v_mode = getMatchData(matchHeader, 5); //v_listaDevices = getMatchData(matchHeader, 6); // No se usa mas.- //v_IMEI = getMatchData(matchHeader, 7); // No se usa mas.- } } catch (Exception ex) { Tools.GetInstance().DoLog("EXCEPCION en cargarPropiedadesDevice(): " + ex.Message); } }
/// <summary> /// Devuelve una lista de HH,HH,HH;movilID,GPSName,movilID,GPSName /// o sea: los IDs de los HH(que son iguales a sus nombres) y los movilID,GPSName de los GPSs /// </summary> /// <param name="v_OrgID"></param> /// <returns></returns> public string cargarHHGPS(string v_OrgID) { string res = ""; try { int errCode = -1; string errDesc = ""; string datosGPS = WebServiceAPI.GetInstance().GetHHGPS(v_OrgID, out errDesc, out errCode); Regex datosDevices = new Regex(@"HH:(.*);GPS:(.*)"); Match matchHeader = datosDevices.Match(datosGPS); if (matchHeader.Success) { string HH = getMatchData(matchHeader, 1); string GPS = getMatchData(matchHeader, 2); res = HH + ";" + GPS; } } catch (Exception ex) { DoLog("EXCEPCION en cargarHHGPS(): " + ex.Message); res = ""; } return(res); }
// Borrar todos los cardformats de la organizacion public void enviarBorrarCF(int panel_id) { string organizationID = Helpers.GetInstance().MainOrgID.ToString(); System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); try { //Helpers.GetInstance().mutexTCP_ACCESS.WaitOne(); try { string errDesc = ""; int errCode = -1; WebServiceAPI.GetInstance().DeleteCardFormats(organizationID, panel_id.ToString(), out errDesc, out errCode); } catch (Exception ex) { Helpers.GetInstance().DoLog("EXCEPCION en enviarBorrarCF: " + ex.Message); } } catch (Exception ex) { Helpers.GetInstance().DoLog("EXCEPCION en enviarBorrarCFMUTEX: " + ex.Message); } //finally //{ // Helpers.GetInstance().mutexTCP_ACCESS.ReleaseMutex(); //} }
private void btnForceLogout_Click(object sender, EventArgs e) { try { string res = ""; DialogResult ans = MessageBox.Show("This will log out the device: " + deviceName + ". Are you sure?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (ans == DialogResult.Yes) { string errDesc = ""; int errCode = (int)StatusCode.NOT_IMPLEMENTED; var respuesta = WebServiceAPI.GetInstance().UpdateLogInStatus(DEVICEID.ToString(), false, "7", out errDesc, out errCode); if (respuesta == 200) { MessageBox.Show("Successfully logged out."); } else { MessageBox.Show("Can´t log out the current device."); } } } catch (Exception ex) { Tools.GetInstance().DoLog("Excepcion en btnForceLogout_Click: " + ex.Message); } }
/// <summary> /// Mensaje para notificar la dada de baja de un Reader correspondiente a un Panel /// </summary> /// <param name="PanelID"></param> /// <param name="v_ReaderID"></param> public void deleteReader(int PanelID, int v_ReaderID) { //staticDatamanager.updateConfigurationVariables(); System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); string readerID = v_ReaderID.ToString(); string orgID = Helpers.GetInstance().MainOrgID.ToString(); // El configurado en el registro try { //Helpers.GetInstance().mutexTCP_ACCESS.WaitOne(); try { string errDesc = ""; int errCode = -1; WebServiceAPI.GetInstance().DeleteReader(PanelID.ToString(), readerID, orgID, out errDesc, out errCode); } catch (Exception ex) { Helpers.GetInstance().DoLog("EXCEPCION en deleteReader: " + ex.Message); } } catch (Exception ex) { Helpers.GetInstance().DoLog("EXCEPCION en deleteReader-MUTEX: " + ex.Message); } //finally //{ // Helpers.GetInstance().mutexTCP_ACCESS.ReleaseMutex(); //} }
internal void startActualizarListaDeviceUsers() { try { Tools.GetInstance().DoLog("Entro a StartActualizarListaDeviceUsers"); listaDeviceUsers = WebServiceAPI.GetInstance().CargarListaDeviceUsers(); if (listaDeviceUsers != null) { EmpInfoComparer comparer = new EmpInfoComparer(); listaDeviceUsers.Sort(comparer); actualizarListaDeviceUsers(listaDeviceUsers); } else { MessageBox.Show("Server not available. Retry in a few seconds."); Invoke((MethodInvoker) delegate { this.Close(); }); } } catch (Exception ex) { Tools.GetInstance().DoLog("Excepcion en StartActualizarListaDeviceUsers. Ex: " + ex.ToString()); } }
private void btnGeoCodeSearch_click(object sender, EventArgs e) { string latitud = ""; string longitud = ""; string errDesc = ""; int errCode = 1; string posDesc = txtPosition.Text; if (!String.IsNullOrEmpty(posDesc.Trim())) { WebServiceAPI.GetInstance().obtenerPosicion(posDesc, out latitud, out longitud, out errDesc, out errCode); if (!String.IsNullOrEmpty(latitud) && !String.IsNullOrEmpty(longitud)) { string jsArray = latitud + "," + longitud + ",15"; // Posicion y Zoom por defecto object[] args2 = { jsArray }; webBrowser.Document.InvokeScript("setPos", args2); } else { MessageBox.Show("Could not get the coordinates of " + posDesc); } } else { MessageBox.Show("You have to describe a place using the following syntax: City, Country"); } }
private void cargarDatosZonas() { try { foreach (KeyValuePair <long, string> zona in listaZonas) { int cantEmp = WebServiceAPI.GetInstance().ObtenerCantidadEmpleadosEnZona(zona.Value); Tools.GetInstance().DoLog("Cantidad empleados en la " + zona.Value + " " + cantEmp.ToString()); if (cantEmp >= 0) { Tools.GetInstance().DoLog("1"); if (!CantEmpZonas.ContainsKey(zona.Value)) { CantEmpZonas.Add(zona.Value, cantEmp); } else { CantEmpZonas[zona.Value] = cantEmp; } blinkLoading(); } Tools.GetInstance().DoLog("loop"); } actualizarListView(); Tools.GetInstance().DoLog("Fin"); updateLoadingVisible(false); } catch (Exception ex) { Tools.GetInstance().DoLog("Excepcion en cargarDatosZonas():" + ex.Message); } }
private void btnDelete_Click(object sender, EventArgs e) { string errDesc = ""; int errCode = -1; if (listViewDeviceUsers.SelectedIndices.Count == 0) { MessageBox.Show("Please select one user", "Warning"); return; } int cantSelected = listViewDeviceUsers.SelectedIndices.Count; bool okDelete = false; if (cantSelected == 1) { DialogResult res = MessageBox.Show("Delete Device User " + listViewDeviceUsers.SelectedItems[0].Text + "?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (res == DialogResult.Yes) { okDelete = true; } } else { DialogResult res = MessageBox.Show("Do you really want to delete " + cantSelected + " items?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (res == DialogResult.Yes) { okDelete = true; } } if (okDelete) { //somethingChanged = true; List <ListViewItem> listaItems = new List <ListViewItem>(); for (int i = 0; i < listViewDeviceUsers.SelectedIndices.Count; i++) { ListViewItem item = listViewDeviceUsers.Items[listViewDeviceUsers.SelectedIndices[i]]; listaItems.Add(item); } foreach (ListViewItem i in listaItems) { listViewDeviceUsers.Items.Remove(i); var respuesta = WebServiceAPI.GetInstance().DeleteDeviceUser(i.Text, out errDesc, out errCode); } listaDeviceUsers = WebServiceAPI.GetInstance().CargarListaDeviceUsers(); actualizarListaDeviceUsers(listaDeviceUsers); clearSelected(); } }
/// <summary> /// Devuelve la lista de AccessLevelID asociado a un PanelID /// </summary> /// <param name="v_panelID"></param> /// <returns></returns> public List <int> obtenerAccessLevelPanel(int v_panelID) { int errCode = -1; string errDesc = ""; List <int> res = WebServiceAPI.GetInstance().ObtenerAccessLevelsDeUnPanel(v_panelID, out errDesc, out errCode); return(res); }
public List <string> obtenerBadgesAlutelMobility(string orgID) { int errCode = -1; string errDesc = ""; List <string> res = WebServiceAPI.GetInstance().ObtenerBadgesAlutelmobility(orgID, out errDesc, out errCode); return(res); }
public bool updateIMEI() { try { return(WebServiceAPI.GetInstance().UpdateListaIMEI(listaIMEI, Tools.GetInstance().MainOrgID)); } catch (Exception) { return(false); } }
void actualizarConnStatus() { Helpers.GetInstance().DoLog("Comienza Thread de actualizacion de ConnStatus..."); while (!finalizarPoolStatus.WaitOne(5000)) { ConnStatusReturned = WebServiceAPI.GetInstance().GetConnStatusZoneGeneral(); // Si hay conectividad es TRUE para todas las zonas si no es FALSE para todas. } Helpers.GetInstance().DoLog("Finaliza Thread de actualizacion de ConnStatus."); }
private void updateDevices() { cmbDevice.Items.Clear(); string[] listaDevTypes = listaDevices.Split(';'); // Dos grupos : HH y GPS. Los carga antes de invocar a esta ventana string listaHH = listaDevTypes[0]; string listaGPS = listaDevTypes[1]; lstHH = new List <string>(listaHH.Split(',')); lstHH.Sort(); // Lista de nombres de devices ordenada. string[] arrGPS = listaGPS.Split(','); lstGPS = new List <string>(); if (arrGPS.Length >= 2) { for (int i = 0; i < arrGPS.Length; i = i + 2) { lstGPS.Add(arrGPS[i + 1] + "," + arrGPS[i]); // En cada elemento queda: NombreGPS,idMovil. En ese orden } } lstGPS.Sort(); // Lista de Nombre,idMovil ordenada por nombre. foreach (string s in lstHH) { if (!String.IsNullOrEmpty(s)) { cmbDevice.Items.Add(s); } } foreach (string s in lstGPS) { if (!String.IsNullOrEmpty(s)) { cmbDevice.Items.Add(s.Split(',')[0]); } } string errDesc = ""; int errCode = 0; if (!String.IsNullOrEmpty(DEVICEID)) { string deviceSeleccionado = WebServiceAPI.GetInstance().ObtenerNombrePanelID(int.Parse(DEVICEID), out errDesc, out errCode); if (!String.IsNullOrEmpty(deviceSeleccionado)) { cmbDevice.Text = deviceSeleccionado; } } }
/// <summary> /// Envia LNL_ERASEEMPLOYEE al server para que se envie directamente al HH /// </summary> private void enviarEraseEmployee(string v_badge, int v_panelID, string v_newAccesslevels, string v_fechaActivacion, string v_fechaDesactivacion) { try { int errCode = (int)StatusCode.NOT_IMPLEMENTED; string errDesc = ""; WebServiceAPI.GetInstance().EraseEmployee(v_badge, v_panelID.ToString(), Helpers.GetInstance().MainOrgID.ToString(), v_newAccesslevels, v_fechaActivacion, v_fechaDesactivacion, out errDesc, out errCode); } catch (Exception) { } }
// Envio de definicion de un cardFormat al Server. public void addCardFormat(int FormatID, int m_PanelID, int BitSize, int FC, int Offset, int BitsFC, int PositionStartFC, int BitsCardNum, int PositionStartCN, int BitsIssueCode, int PositionStartIC, int m_IsDownloadInProgress) { System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); string orgID = Helpers.GetInstance().MainOrgID.ToString(); //string nomCF = obtenerNombreCardFormat(FormatID); if (BitsFC == 0) { BitsFC++; } if (BitsCardNum == 0) { BitsCardNum++; } if (BitsIssueCode == 0) { BitsIssueCode++; } //Helpers.GetInstance().mutexTCP_ACCESS.WaitOne(); try { int errCode = -1; string errDesc = ""; string nombreCardformat = WebServiceAPI.GetInstance().ObtenerNombreCardformat(FormatID.ToString(), out errDesc, out errCode); if (String.IsNullOrEmpty(nombreCardformat)) { Helpers.GetInstance().DoLog("ERROR en addCardFormat: No pudo obtener el Nombre del Cardformat " + FormatID.ToString()); } errCode = -1; errDesc = ""; WebServiceAPI.GetInstance().AddCardFormat(m_PanelID.ToString(), orgID, FormatID.ToString(), nombreCardformat, FC.ToString(), Offset.ToString(), BitSize.ToString(), PositionStartFC.ToString(), (PositionStartFC + BitsFC - 1).ToString(), PositionStartCN.ToString(), (PositionStartCN + BitsCardNum - 1).ToString(), PositionStartIC.ToString(), (PositionStartIC + BitsIssueCode - 1).ToString(), out errDesc, out errCode); } catch (Exception ex) { Helpers.GetInstance().DoLog("EXCEPCION en addCardFormat: " + ex.Message); } //finally //{ // Helpers.GetInstance().mutexTCP_ACCESS.ReleaseMutex(); //} }
private string enviarAddEmployee(string v_badge, int v_panelID, string v_newAccesslevels, string v_fechaActivacion, string v_fechaDesactivacion, string v_PIN, int m_IsDownloadInProgress) { string res = "FAIL"; int errCode = (int)StatusCode.NOT_IMPLEMENTED; try { string errDesc = ""; KeyValuePair <Employee, Tarjeta> t = WebServiceAPI.GetInstance().ObtenerDatosEmpleadoYTarjeta(v_badge, out errDesc, out errCode); if (errCode != (int)StatusCode.OK) { Helpers.GetInstance().DoLog("ObtenerDatosEmpleadoYTarjeta devolvio el error: " + errDesc); } if ((t.Key != null) && (t.Value != null)) { t.Value.accessLevels = v_newAccesslevels; t.Value.PIN = v_PIN; //Helpers.GetInstance().DoLog("Va a llamar a AddEmployee con tarjeta=" + t.Value.tarjeta + " badgekey=" + t.Value.lnlbadgekey); WebServiceAPI.GetInstance().AddEmployee(t.Key, t.Value, v_panelID, out errDesc, out errCode); if (errCode != (int)StatusCode.OK) { Helpers.GetInstance().DoLog("ERROR en enviarAddEmployee: " + errDesc); } else { res = "OK"; } if (t.Key.isVisitor) { sendScheduledVisit(t.Key.PersonID.ToString(), t.Key.Nombre, t.Key.Apellido, t.Key.NumeroDocumento, v_badge, Helpers.GetInstance().MainOrgID.ToString()); } } else { Helpers.GetInstance().DoLog("No envia addEmployee por ser Empleado o tarjeta NULL" + errDesc); } } catch (Exception ex) { Helpers.GetInstance().DoLog("Excepcion en enviarAddEmployee: " + ex.Message); res = "FAIL"; } return(res); }
/// <summary> /// Mensaje para notificar la dada de baja de Panel. /// Solo se envia deletePanel si realmente se dio de baja y no existe en Lenel- /// Ademas usa DC para eliminar el usuario asociado al panel. /// </summary> public void deletePanel(int PanelID, string panelName) { PoolGetConnStatus.GetInstance().subRefCount(); // Para detener el thread y liberar memoria en caso de ser el ultimo panel que se da de baja. PoolGetAlarm.GetInstance().subRefCount(); PoolGetAcceso.GetInstance().subRefCount(); PoolSetAlarma.GetInstance().subRefCount(); PoolSetAcceso.GetInstance().subRefCount(); System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); string orgID = Helpers.GetInstance().MainOrgID.ToString(); // El configurado en el registro try { //Helpers.GetInstance().mutexTCP_ACCESS.WaitOne(); try { string errDesc = ""; int errCode = -1; if (!WebServiceAPI.GetInstance().ExistePanelEnOnGuard(PanelID.ToString(), out errDesc, out errCode)) { WebServiceAPI.GetInstance().DeleteDevice(PanelID.ToString(), orgID, out errDesc, out errCode); if (errCode == (int)StatusCode.OK) { Employee emp = WebServiceAPI.GetInstance().ObtenerEmpleadoAsociadoAHH(panelName, out errDesc, out errCode); if (emp != null) { Helpers.GetInstance().DoLog("Va a borrar el empleado " + emp.Nombre + " " + emp.Apellido + " con personid: " + emp.PersonID.ToString() + " asociado al panelID: " + PanelID.ToString() + " llamado:" + panelName); WebServiceAPI.GetInstance().EliminarEmpleado(emp.PersonID, out errDesc, out errCode); } else { Helpers.GetInstance().DoLog("emp es NULL en deletePanel. NO borró el empleado asociado al panel " + PanelID.ToString()); } } } } catch (Exception ex) { Helpers.GetInstance().DoLog("EXCEPCION en deletePanel: " + ex.Message); } } catch (Exception ex) { Helpers.GetInstance().DoLog("EXCEPCION en deletePanelMUTEX: " + ex.Message); } //finally //{ // Helpers.GetInstance().mutexTCP_ACCESS.ReleaseMutex(); //} }
private void enviarMensaje(string v_texto) { if (!String.IsNullOrEmpty(v_texto.Trim())) { try { int errCode = -1; string errDesc = ""; WebServiceAPI.GetInstance().SendMSG(DEVICEID.ToString(), ORGANIZATIONID.ToString(), v_texto.Trim(), out errDesc, out errCode); } catch (Exception ex) { Tools.GetInstance().DoLog("Excepcion en enviarMensaje: " + ex.Message); } } }
private void sendZoneToServer() { string listaPuntos = ""; foreach (KeyValuePair <string, Zone.GeoCoord> pair in markerPoints) { listaPuntos = listaPuntos + pair.Value.latitude + "," + pair.Value.longitude + ","; } string modeStr = chkTrigger.Checked ? "1" : "0"; int errCode = -1; string errDesc = ""; WebServiceAPI.GetInstance().DefineZone(DEVICEID, modeStr, listaPuntos, ORGANIZATIONID.ToString(), out errDesc, out errCode); }
private void btnOK_Click(object sender, EventArgs e) { try { HHMode = (chkTriggerEvents.Checked ? (int)ModosAcceso.Diferido : (int)ModosAcceso.Normal) + (chkBlockingMode.Checked ? (int)ModosAcceso.Diferido : (int)ModosAcceso.Normal); // OJO aca: enum ModosAcceso del server if (chkMasterCards.Checked) { HHMode = (int)ModosAcceso.TarjetasMaster; } if (chkMobileController.Checked) { HHMode = (int)ModosAcceso.Mobile; } string errDesc = ""; int errCode = -1; WebServiceAPI.GetInstance().SetMode(DEVICEID.ToString(), HHMode.ToString(), ORGANIZATIONID.ToString(), out errDesc, out errCode); //if ((IMEI.Trim() != txtIMEI.Text.Trim()) && (!String.IsNullOrEmpty(txtIMEI.Text.Trim()))) // WebServiceAPI.GetInstance().UpdateIMEI(DEVICEID.ToString(),ORGANIZATIONID.ToString(), txtIMEI.Text.Trim(), out errDesc, out errCode); // Da de alta el empleado en AlutelMobility antes de hacer el updateLinkedEmployee if ((datosEmpleado.Key != null) && (datosEmpleado.Value != null)) { WebServiceAPI.GetInstance().AddEmployee(datosEmpleado.Key, datosEmpleado.Value, DEVICEID, out errDesc, out errCode); } else { Tools.GetInstance().DoLog("No se envia AddEmployee al pulsar OK porque el empleado o la tarjeta son NULL"); } //if (chkMobileController.Checked) WebServiceAPI.GetInstance().UpdateLinkedEmployee(DEVICEID.ToString(), ORGANIZATIONID.ToString(), linkedBadge, out errDesc, out errCode); string HHData = deviceName + "," + txtSpeedLimit.Text + "," + txtGPSUpdateTime.Text; WebServiceAPI.GetInstance().UpdateDeviceConfig(HHData, ORGANIZATIONID.ToString(), out errDesc, out errCode); } catch (Exception ex) { Tools.GetInstance().DoLog("Excepcion en OK de ventana de Properties: " + ex.Message); } this.Close(); }
/// <summary> /// Recibe el alta de un reader a un Panel desde LENEL /// Contruye la expresion para mandarla al server y alli, en funcion del READERNAME, /// se actualiza el LNLREADERENTRANCEID o el LNLREADEREXITID /// </summary> public string addReader(string v_panelName, int v_panelID, string v_ReaderName, int v_ReaderID, int v_ReaderEntranceType, int v_OrgID, string v_cardFormats, int m_IsDownloadInProgress) { // staticDatamanager.updateConfigurationVariables(); string res = string.Empty; string deviceID = v_panelID.ToString(); string deviceName = v_panelName; string readerID = v_ReaderID.ToString(); string readerName = v_ReaderName; string readerEntranceType = v_ReaderEntranceType.ToString(); string orgID = Helpers.GetInstance().MainOrgID.ToString(); // No toma la de la llamada try { //Helpers.GetInstance().mutexTCP_ACCESS.WaitOne(); try { string errDesc = ""; int errCode = -1; string r = WebServiceAPI.GetInstance().AddReaderToPanel(deviceID, deviceName, readerID, readerName, readerEntranceType, orgID, v_cardFormats, out errDesc, out errCode); if (errCode != (int)StatusCode.OK) { res = "FAIL"; } } catch (Exception ex) { Helpers.GetInstance().DoLog("EXCEPCION en addReader: " + ex.Message); res = "FAIL"; // Notificar la falla del evento } } catch (Exception ex) { Helpers.GetInstance().DoLog("EXCEPCION en addReader-MUTEX: " + ex.Message); } //finally //{ // Helpers.GetInstance().mutexTCP_ACCESS.ReleaseMutex(); //} return(res); }