void sport_ErrorReceived(object sender, SerialErrorReceivedEventArgs e) { SerialPort thisPort = (sender as SerialPort); SerialError err = e.EventType; BitacoraModel.addItem("Error de resepción de puerto", string.Format("Puerto {0}", thisPort.PortName), string.Format("{0}", err.ToString()), "ERROR"); }
protected void OnBtnconnectClicked(object sender, EventArgs e) { string port = lblPuerto.Text.ToString(); int baudRate = Convert.ToInt32(cmbBaudRate.ActiveText.ToString()); Parity parity = (Parity)Enum.Parse(typeof(Parity), cmbParity.ActiveText.ToString()); int databits = Convert.ToInt32(cmbDatabits.ActiveText.ToString()); StopBits stopbits = (StopBits)Enum.Parse(typeof(StopBits), cmbStopbits.ActiveText.ToString()); string messageResponse; if ( this.connectToPort(port, baudRate, parity, databits, stopbits, new SerialDataReceivedEventHandler(sport_DataReceived), new SerialErrorReceivedEventHandler(sport_ErrorReceived), out messageResponse) ) { PortsModel.editItem(iterSelected, new Gdk.Pixbuf(Directory.GetCurrentDirectory() + @"/Assets/Images/on.png"), "Conectado"); BitacoraModel.addItem("Abrir puerto", string.Format("Puerto {0}", port.ToString())); } else { PortsModel.editItem(iterSelected, new Gdk.Pixbuf(Directory.GetCurrentDirectory() + @"/Assets/Images/err.png"), "Error al intentar conectar"); BitacoraModel.addItem("Abrir puerto", string.Format("Puerto {0}", port.ToString()), string.Format("Error al intentar conectar [ {0} ]", messageResponse), "ERROR"); } tblPorts.SetCursor(PortsModel.getModel().GetPath(iterSelected), tblPorts.GetColumn(0), false); }
public CumplimientoLineasViewModel(BitacoraModel model) { Bitacora = model; apiService = new ApiService(); LoadLista(); CargarColores(); }
private void populateTablePorts() { PortsModel.clearModel(); string[] portList = SerialPort.GetPortNames(); if (portList.Length > 0) { foreach (string port in SerialPort.GetPortNames()) { CnnPort cnnPort; if (cnnPortList.TryGetValue(port, out cnnPort)) { PortsModel.addItem(port.ToString(), new Gdk.Pixbuf(Directory.GetCurrentDirectory() + @"/Assets/Images/on.png"), "Conectado"); } else { PortsModel.addItem(port.ToString(), new Gdk.Pixbuf(Directory.GetCurrentDirectory() + @"/Assets/Images/off.png"), "Desconectado"); } cnnPort = null; BitacoraModel.addItem("Detectar puerto", string.Format("Puerto {0}", port.ToString())); } GtkScrolledWindow.Visible = true; } else { lblPortsNotFound.Visible = true; GtkScrolledWindow.Visible = false; BitacoraModel.addItem("Detectar puerto", "No se detectaron puertos", "", "AVISO"); } }
protected void OnBtnlimpiarbitacoraClicked(object sender, EventArgs e) { if (dlg.show(this, DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.YesNo, "Confirmar limpiar la bitácora de salida") == ResponseType.Yes) { BitacoraModel.clearModel(); } }
private Boolean senDataToPort(string portName, string data) { Boolean response = false; CnnPort cnnPort; string port = portName; if (cnnPortList.TryGetValue(port, out cnnPort)) { if (!cnnPort.SendData(data)) { dlg.show(this, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, string.Format("Ocurrió un error al enviar el dato al puerto {0} [ {1} ]", port, data)); BitacoraModel.addItem("Enviar dato al puerto", string.Format("Puerto {0}", port.ToString()), string.Format("Ocurrió un error al enviar el dato [ {0} ] al puerto", data), "ERROR"); } else { BitacoraModel.addItem("Enviar dato al puerto", string.Format("Puerto {0}", port.ToString()), string.Format("Dato enviado al puerto [ {0} ]", data)); response = true; } } else { BitacoraModel.addItem("Enviar dato al puerto", string.Format("Puerto {0}", port.ToString()), string.Format("El puerto [ {0} ] no se encuentra abierto o la comunicación ha sido interrumpida. Dato [ {0} ] no enviado", port, data), "ERROR"); } return(response); }
private async void NuevaLinea() { try { var Orden = new BitacoraModel { Barco = Settings.Sucursal, NomBarco = Settings.NombreSucursal, Viaje = Settings.Viaje, NomViaje = Settings.NombreViaje, FechaArribo = DateTime.Now.Date, FechaZarpe = DateTime.Now.Date, Titulo = "Nueva obra" }; GetInstance().CreacionLinea = new CreacionLineaViewModel(Orden); await App.Navigator.PushAsync(new CreacionLineaPage()); } catch (System.Exception ex) { await Application.Current.MainPage.DisplayAlert( "Alerta", ex.Message, "Aceptar"); return; } }
public CreacionLineasViewModel(BitacoraModel model) { _lstBitacora = new List <BitacoraModel>(); apiService = new ApiService(); Barco = model.Barco; Viaje = model.Viaje; LoadLista(); CargarColores(); }
public JefeSupervisorBitacoraViewModel(BitacoraModel Model) { EsSupervisor = Settings.RolApro == "S" ? true : false; apiService = new ApiService(); Bitacora = new BitacoraModel(); Bitacora = Model; CargarTipos(); CargarBitacora(); TipoSelectedIndex = "Orden de trabajo"; }
private void tableBitacoraInit() { tblBitacora.AppendColumn("Acción", new CellRendererText(), "text", 0); tblBitacora.AppendColumn("Mensaje", new CellRendererText(), "text", 1); tblBitacora.AppendColumn("Hora", new CellRendererText(), "text", 2); tblBitacora.AppendColumn("Fecha", new CellRendererText(), "text", 3); tblBitacora.AppendColumn("Detalle", new CellRendererText(), "text", 4); tblBitacora.AppendColumn("Estado", new CellRendererText(), "text", 5); tblBitacora.Model = BitacoraModel.getModel(); }
void sport_DataReceived(object sender, SerialDataReceivedEventArgs e) { SerialPort thisPort = (sender as SerialPort); byte[] buf = new byte[thisPort.BytesToRead]; thisPort.Read(buf, 0, buf.Length); foreach (Byte b in buf) { BitacoraModel.addItem("Leer puerto", string.Format("Puerto {0}", thisPort.PortName), string.Format("Dato recibido [ {0} ] ", b)); } }
public CreacionBitacoraViewModel(BitacoraModel Model) { Orden = Model; Titulo = Orden.Titulo; FechaArribo = Orden.FechaArribo ?? DateTime.Now.Date; FechaZarpe = Orden.FechaZarpe ?? DateTime.Now.Date; NombreSucursal = Orden.NomBarco; NomViaje = Orden.NomViaje; IsEnabled = true; apiService = new ApiService(); }
public CreacionLineaViewModel(BitacoraModel Model) { Orden = new BitacoraDetModel { Id = Model.Id, Linea = Model.Linea }; EsEmpleado = Model.EsEmpleado == 1 ? true : false; Contratista = Model.Contratista; Descripcion = Model.Descripcion; IsEnabled = true; apiService = new ApiService(); }
public Boolean AutoConnectPorts(out string autoConnectPortsMessageResponse) { Boolean result = false; ListStore autoConnectPortsList = AutoConnectPrtsModel.getModel(); TreeIter autocnnportiter; autoConnectPortsMessageResponse = string.Empty; if (autoConnectPortsList.GetIterFirst(out autocnnportiter)) { do { string port = autoConnectPortsList.GetValue(autocnnportiter, 0).ToString(); int baudRate = Convert.ToInt32(autoConnectPortsList.GetValue(autocnnportiter, 3).ToString()); Parity parity = (Parity)Enum.Parse(typeof(Parity), autoConnectPortsList.GetValue(autocnnportiter, 4).ToString()); int databits = Convert.ToInt32(autoConnectPortsList.GetValue(autocnnportiter, 5).ToString()); StopBits stopbits = (StopBits)Enum.Parse(typeof(StopBits), autoConnectPortsList.GetValue(autocnnportiter, 6).ToString()); string messageResponse; if ( this.connectToPort(port, baudRate, parity, databits, stopbits, new SerialDataReceivedEventHandler(sport_DataReceived), new SerialErrorReceivedEventHandler(sport_ErrorReceived), out messageResponse) ) { BitacoraModel.addItem("Auto abrir puerto", string.Format("Puerto {0}", port.ToString())); } else { BitacoraModel.addItem("Auto abrir puerto", string.Format("Puerto {0}", port.ToString()), string.Format("Error al intentar conectar [ {0} ]", messageResponse), "ERROR"); autoConnectPortsMessageResponse += string.Format("{0}", messageResponse); } } while(autoConnectPortsList.IterNext(ref autocnnportiter)); if (string.IsNullOrEmpty(autoConnectPortsMessageResponse)) { result = true; } } else { autoConnectPortsMessageResponse = string.Format("No se encontraron puertos para auto conectar [ {0} ]", cnfg.Id_application); } return(result); }
public void POST([FromBody] BitacoraModel value) { try { var Entity = db.CAB_BITACORA.Where(q => q.BARCO == value.BARCO && q.VIAJE == value.VIAJE).FirstOrDefault(); if (Entity == null) { db.CAB_BITACORA.Add(new CAB_BITACORA { ID = Ot.GETID("BITACO", 1), VIAJE = value.VIAJE, DATA_VIAJE = "2", FECINGRESO = DateTime.Now.Date, BARCO = value.BARCO, EMPRESA = 1, ESTADO = "A", LOGIN = value.LOGIN, FECHA_ARRIBO = value.FECHA_ARRIBO, FECHA_ZARPE = value.FECHA_ZARPE, FECHA_ZARPE_REAL = value.FECHA_ZARPE_REAL }); } else { Entity.FECHA_ARRIBO = value.FECHA_ARRIBO; Entity.FECHA_ZARPE = value.FECHA_ZARPE; Entity.FECHA_ZARPE_REAL = value.FECHA_ZARPE_REAL; } db.SaveChanges(); } catch (Exception ex) { using (EntitiesGeneral Error = new EntitiesGeneral()) { long ID = Error.APP_LOGERROR.Count() > 0 ? (Error.APP_LOGERROR.Select(q => q.SECUENCIA).Max() + 1) : 1; Error.APP_LOGERROR.Add(new APP_LOGERROR { ERROR = ex == null ? string.Empty : (ex.Message.Length > 1000 ? ex.Message.Substring(0, 1000) : ex.Message), INNER = ex.InnerException == null ? string.Empty : (ex.InnerException.Message.Length > 1000 ? ex.InnerException.Message.Substring(0, 1000) : ex.InnerException.Message), FECHA = DateTime.Now, PROCESO = "CreacionBitacora/GET", SECUENCIA = ID }); Error.SaveChanges(); } } }
protected void OnBtnsendmsgClicked(object sender, EventArgs e) { CnnPort cnnPort; string port = lblPuerto.Text.ToString(); if (cnnPortList.TryGetValue(port, out cnnPort)) { String data = txtsendmsg.Text.ToString(); if (!cnnPort.SendData(data)) { dlg.show(this, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, string.Format("Ocurrió un error al enviar el dato al puerto {0} [ {1} ]", port, data)); BitacoraModel.addItem("Enviar dato al puerto", string.Format("Puerto {0}", port.ToString()), string.Format("Ocurrió un error al enviar el dato [ {0} ] al puerto", data), "ERROR"); } else { BitacoraModel.addItem("Enviar dato al puerto", string.Format("Puerto {0}", port.ToString()), string.Format("Dato enviado al puerto [ {0} ]", data)); txtsendmsg.Text = string.Empty; } } }
protected void OnBtndisconnectClicked(object sender, EventArgs e) { CnnPort cnnPort; string port = lblPuerto.Text.ToString(); if (cnnPortList.TryGetValue(port, out cnnPort)) { if (cnnPort.Close(sport_DataReceived, sport_ErrorReceived)) { PortsModel.editItem(iterSelected, new Gdk.Pixbuf(Directory.GetCurrentDirectory() + @"/Assets/Images/off.png"), "Desconectado"); tblPorts.SetCursor(PortsModel.getModel().GetPath(iterSelected), tblPorts.GetColumn(0), false); cnnPortList.Remove(port); BitacoraModel.addItem("Cerrar puerto", string.Format("Puerto {0}", port.ToString())); } else { BitacoraModel.addItem("Cerrar puerto", string.Format("Puerto {0}", port.ToString()), "Error al intentar cerrar puerto", "ERROR"); } } }
public string AddBitacora() { Data.HotelesEntities db = new HotelesEntities(); try { List <sproc_hoteles_GetBitacoraList_Result> agregarBitacora = db.sproc_hoteles_GetBitacoraList().ToList(); var responseModel = new BitacoraModel() { Success = true, Message = "Lista completa", Data = agregarBitacora }; return(JsonConvert.SerializeObject(responseModel)); } catch (DbEntityValidationException e) { return(JsonConvert.SerializeObject(manejoDeErrores.errorBaseDeDatos(e))); } catch (Exception ex) { return(JsonConvert.SerializeObject(manejoDeErrores.errorGeneral(ex))); } }
void sport_DataReceived(object sender, SerialDataReceivedEventArgs e) { SerialPort thisPort = (sender as SerialPort); byte[] buf = new byte[thisPort.BytesToRead]; thisPort.Read(buf, 0, buf.Length); string strData = string.Empty; foreach (Byte b in buf) { BitacoraModel.addItem("Leer puerto", string.Format("Puerto {0}", thisPort.PortName), string.Format("Dato recibido [ {0} ] ", b)); strData += ((char)b).ToString(); } BitacoraModel.addItem("Cadena recibida", string.Format("Puerto {0}", thisPort.PortName), string.Format("Cadena [ {0} ] ", strData)); /* * CODIGO DE ENVÍO AUTOMATICO DE PULSACIONES A OTRO PUERTO DE MANERA AUTOMÁTICA */ this.senDataToPort("COM1", //NOMBRE DEL PUERTO "p"); //DATO A ENVIAR }
public void Post([FromBody] BitacoraModel value) { try { var linea = db.DET_BITACORA.Where(q => q.ID == value.ID && q.LINEA == value.LINEA).FirstOrDefault(); if (linea == null) { return; } var usuario = db.USUARIOS.Where(q => q.USUARIO.ToLower() == value.LOGIN.ToLower()).FirstOrDefault(); if (usuario == null) { return; } if (usuario.ROL_APRO == "J") { if (linea.LINEA_STCUMPLI1 == value.ESTADOAPRO) { return; } linea.LINEA_FECCUMPLI1 = DateTime.Now; linea.LINEA_STCUMPLI1 = value.ESTADOAPRO; linea.LINEA_LOGINCUMPLI1 = usuario.USUARIO; } else { if (string.IsNullOrEmpty(value.ESTADOAPRO)) { linea.LINEA_FECCUMPLI1 = null; linea.LINEA_STCUMPLI1 = null; linea.LINEA_LOGINCUMPLI1 = null; linea.LINEA_FECCUMPLI2 = null; linea.LINEA_STCUMPLI2 = null; linea.LINEA_LOGINCUMPLI2 = null; } else { if (linea.LINEA_STCUMPLI2 == value.ESTADOAPRO) { return; } linea.LINEA_FECCUMPLI2 = DateTime.Now; linea.LINEA_STCUMPLI2 = value.ESTADOAPRO; linea.LINEA_LOGINCUMPLI2 = usuario.USUARIO; } } db.SaveChanges(); ActualizarOrdenes(value.ID, value.LINEA, usuario.ROL_APRO, usuario.USUARIO); } catch (Exception ex) { long SECUENCIAID = db.APP_LOGERROR.Count() > 0 ? (db.APP_LOGERROR.Select(q => q.SECUENCIA).Max() + 1) : 1; db.APP_LOGERROR.Add(new APP_LOGERROR { ERROR = ex == null ? string.Empty : (ex.Message.Length > 1000 ? ex.Message.Substring(0, 1000) : ex.Message), INNER = ex.InnerException == null ? string.Empty : (ex.InnerException.Message.Length > 1000 ? ex.InnerException.Message.Substring(0, 1000) : ex.InnerException.Message), FECHA = DateTime.Now, PROCESO = "BitacorasJefeSup/POST", SECUENCIA = SECUENCIAID }); db.SaveChanges(); } }
public ActionResult Bitacora() { ViewBag.Bitacora = BitacoraModel.CargarErrores(); ViewBag.listaUsers = Admin.ObtenerAdmin(); return(View()); }
public ActionResult Bitacora(BitacoraModel model) { ViewBag.Bitacora = BitacoraModel.FiltrarBitacora(model); ViewBag.listaUsers = Admin.ObtenerAdmin(); return(View("Bitacora")); }
private void AutoConnectPorts() { ListStore autoConnectPortsList = AutoConnectPrtsModel.getModel(); TreeIter autocnnportiter; if (autoConnectPortsList.GetIterFirst(out autocnnportiter)) { do { string autocnnport = autoConnectPortsList.GetValue(autocnnportiter, 0).ToString(); ListStore portsList = PortsModel.getModel(); TreeIter iter; Boolean portGetConnected = false; if (portsList.GetIterFirst(out iter)) { do { string port = portsList.GetValue(iter, 0).ToString(); if (port.Trim().Equals(autocnnport.Trim(), StringComparison.CurrentCultureIgnoreCase)) { string sport = lblPuerto.Text.ToString(); int baudRate = Convert.ToInt32(cmbBaudRate.ActiveText.ToString()); Parity parity = (Parity)Enum.Parse(typeof(Parity), cmbParity.ActiveText.ToString()); int databits = Convert.ToInt32(cmbDatabits.ActiveText.ToString()); StopBits stopbits = (StopBits)Enum.Parse(typeof(StopBits), cmbStopbits.ActiveText.ToString()); CnnPort cnnPort; if (!cnnPortList.TryGetValue(port, out cnnPort)) { string messageResponse; if ( this.connectToPort(port, baudRate, parity, databits, stopbits, new SerialDataReceivedEventHandler(sport_DataReceived), new SerialErrorReceivedEventHandler(sport_ErrorReceived), out messageResponse) ) { PortsModel.editItem(iter, new Gdk.Pixbuf(Directory.GetCurrentDirectory() + @"/Assets/Images/on.png"), "Conectado"); BitacoraModel.addItem("Auto abrir puerto", string.Format("Puerto {0}", port.ToString())); } else { PortsModel.editItem(iter, new Gdk.Pixbuf(Directory.GetCurrentDirectory() + @"/Assets/Images/err.png"), "Error al intentar conectar"); BitacoraModel.addItem("Auto abrir puerto", string.Format("Puerto {0}", port.ToString()), string.Format("Error al intentar conectar [ {0} ]", messageResponse), "ERROR"); } } cnnPort = null; portGetConnected = true; } } while (portsList.IterNext(ref iter)); } if (!portGetConnected) { BitacoraModel.addItem("Auto abrir puerto", string.Format("Puerto {0}", autocnnport), string.Format("No se encontró el puerto disponible"), "ERROR"); } } while(autoConnectPortsList.IterNext(ref autocnnportiter)); } }