private void INDbwCambioPrecio_DoWork(object sender, DoWorkEventArgs e) { try { var dtTramasManuales = claseMain.GetTramasManuales(); foreach (DataRow _row in dtTramasManuales.Rows) { //Obtener Id de xbee y trama string[] LineRecibida = _row[1].ToString().Split('|'); var _trama = LineRecibida[0]; var _idXbeeImprimir = LineRecibida[1]; NodosXbee nodeXbee = instancia.ListNodes.FindAll(x => x.IdXbee == Convert.ToInt32(_idXbeeImprimir)).FirstOrDefault(); if (nodeXbee != null) { string[] arrayTramaRecibida = UtilidadesTramas.ObtieneArrayTrama(_trama); claseMain.ProcesarTrama(arrayTramaRecibida, nodeXbee, true); //NodosXbee nodoImpresion = instancia.ListNodes.Find(item => item.Mac == nodeXbee.MacImpresion); //if (nodoImpresion != null) //{ // claseMain.ProcesarTrama(arrayTramaRecibida, nodoImpresion); //} } } string cambioPrecio = System.IO.File.ReadAllText(Path.GetDirectoryName(Application.ExecutablePath) + "/cambioPrecio.txt"); if (cambioPrecio.StartsWith("1")) { if (ListadoObjetosCaras != null) { List <int> ListaXbess = new List <int>(); foreach (ctrCara _cara in ListadoObjetosCaras) { if (ListaXbess.Find(item => item == _cara.idXbee) == 0) { ListaXbess.Add(_cara.idXbee); claseMain.CambioPrecioDispensador(_cara.idXbee); } } e.Result = true; } else { e.Result = false; } } } catch (Exception ex) { LocalLogManager.EscribeLog("Ocurrio Un Error Con Cambio de Precio o con tramas POS manuales" + ex.Message, LocalLogManager.TipoImagen.TipoError); e.Result = false; } }
void NodoAgregadoEventHandler(NodosXbee e) { if (e.TipoDispositivo == XbeeUtils.Enumeraciones.TipoDispositivo.Dispensador) { DataTable dtCaras; using (Generales modGEN = new Generales()) { dtCaras = modGEN.GetTable("select DISTINCT numPosicion FROM posicion WHERE idXbee = " + e.IdXbee); } if (dtCaras != null && dtCaras.Rows.Count > 0) { foreach (DataRow row in dtCaras.Rows) { if (ListadoObjetosCaras == null) { ListadoObjetosCaras = new List <ctrCara>(); } ctrCara newCara1 = new ctrCara(); newCara1.NumCara = Convert.ToInt32(row[0]); newCara1.EstadoCara = EnumEstadoCara.Normal; newCara1.NombreCara = "Cara " + newCara1.NumCara.ToString(); newCara1.idXbee = e.IdXbee; newCara1.NombreNodo = e.Nombre; FloatPanelDispositivos.Controls.Add(newCara1); ListadoObjetosCaras.Add(newCara1); } } } else if (e.TipoDispositivo == XbeeUtils.Enumeraciones.TipoDispositivo.moduloPOS) { using (Generales modGEN = new Generales()) { DataTable dtPOS = modGEN.GetTable("select nomXbee FROM xbee WHERE idXbee = " + e.IdXbee); if (dtPOS != null && dtPOS.Rows.Count > 0) { ctrPOS newPOS = new ctrPOS(); newPOS.NombrePOS = dtPOS.Rows[0][0].ToString(); newPOS.idXbee = e.IdXbee; FloatPanelDispositivos.Controls.Add(newPOS); newPOS.Dock = DockStyle.Fill; newPOS.EstableceColor(); } } } }