コード例 #1
0
        public void ApplyFilters(SearchObject InputData, ref LogObject selectedLog)
        {
            if (!string.IsNullOrWhiteSpace(InputData.Teller))
            {
                if (selectedLog != null)
                {
                    if (InputData.Teller != selectedLog.LogDetails.Teller)
                    {
                        selectedLog = null;
                    }
                }
            }
            if (!string.IsNullOrWhiteSpace(InputData.Transaction))
            {
                if (selectedLog != null)
                {
                    if (InputData.Transaction != selectedLog.LogDetails.Transaction)
                    {
                        selectedLog = null;
                    }
                }
            }

            if (!string.IsNullOrWhiteSpace(InputData.Branch))
            {
                if (selectedLog != null)
                {
                    if (InputData.Branch != selectedLog.LogDetails.Branch)
                    {
                        selectedLog = null;
                    }
                }
            }
        }
コード例 #2
0
        public XmlDocument GetFormattedOutput(string actualMessage, string transactionNumber, string path, LogObject selectedObject)
        {
            SelectedObject = selectedObject;
            string      TXNFilePath    = string.Empty;
            XmlDocument transactionXML = null;

            //path = Path.Combine()
            TXNFilePath = Path.Combine(path, "xml", "Transactions", transactionNumber + ".xml");

            try
            {
                XmlDocument rxDoc = new XmlDocument();

                if (File.Exists(TXNFilePath))
                {
                    transactionXML = new XmlDocument();
                    transactionXML.Load(TXNFilePath);
                }
                else
                {
                    //Set the error model and return to main
                    throw new Exception("Settings model not found");
                }


                XmlDocument outputXml       = new XmlDocument();
                XmlElement  xmlOuterElement = outputXml.CreateElement("MessageGroup");
                outputXml.AppendChild(xmlOuterElement);


                //XmlDocument rxXMLDoc = null;
                if (selectedObject.LogDetails.MsgType == MessageType.TX)
                {
                    m_RXHostPosPointer = 78;
                }
                if (selectedObject.LogDetails.MsgType == MessageType.RX)
                {
                    m_RXHostPosPointer = 80;
                }

                //AddHeaderNodeToTXNxml(transactionXML);

                rxXMLDoc = ProcessRXXML(transactionXML, actualMessage, outputXml);
            }
            catch { }
            return(rxXMLDoc);
        }
コード例 #3
0
        public void UpdateUI(LogObject obj)
        {
            //toolStripStatusLabelCounter.Text = Convert.ToString(Convert.ToInt32(toolStripStatusLabelCounter.Text) + 1);
            var timeNow = DateTime.Now;

            //if ((DateTime.Now - previousTime).Milliseconds <= 50) return;
            synchronizationContext.Post(new SendOrPostCallback(o =>
            {
                if (obj.LogLevel == System.Diagnostics.EventLogEntryType.Information)
                {
                    listBoxLogs.Items.Add(obj.LogDetails.MsgType + " # " + obj.LogDetails.Transaction + " # " + obj.LogTime + " # " + obj.LogDetails.Teller);
                }

                if (obj.LogLevel == System.Diagnostics.EventLogEntryType.Error)
                {
                    listBoxLogs.Items.Add(obj.LogDetails.MsgType + " # Error Occured # " + obj.LogTime);
                }
            }), obj);

            previousTime = timeNow;
            //toolStripStatusLabelCounter.Text = Convert.ToString(Convert.ToInt32(toolStripStatusLabelCounter.Text) + 1);
        }
コード例 #4
0
        public async void GetLogs(SearchObject InputData)
        {
            try
            {
                EventLog log = new EventLog(InputData.LogName, InputData.LogComputer, InputData.LogSource);

                await Task.Run(() =>
                {
                    for (int i = log.Entries.Count; i > 0; i--)
                    {
                        EventLogEntry entry = log.Entries[--i];
                        if (entry.Message.Length > 50 && entry.Source == InputData.LogSource && DateTime.Compare(entry.TimeWritten, InputData.StartTime) >= 0 && DateTime.Compare(InputData.EndTime, entry.TimeWritten) >= 0)
                        {
                            LogObject newLog   = new LogObject();
                            newLog.LogName     = InputData.LogName;
                            newLog.LogMessage  = entry.Message;
                            newLog.LogSource   = entry.Source;
                            newLog.LogEventId  = entry.InstanceId;
                            newLog.LogIndexId  = entry.Index;
                            newLog.LogLevel    = entry.EntryType;
                            newLog.LogTime     = Convert.ToDateTime(entry.TimeGenerated);
                            newLog.LogComputer = entry.MachineName;
                            newLog.LogDetails  = new HeaderObject();
                            SetLogDetails(newLog);
                            ApplyFilters(InputData, ref newLog);
                            if (newLog != null)
                            {
                                if (newLog.LogLevel == System.Diagnostics.EventLogEntryType.Information || newLog.LogLevel == System.Diagnostics.EventLogEntryType.Information)
                                {
                                    Logs.Add(newLog);
                                    UpdateUI(newLog);
                                }
                            }
                        }
                    }
                });
            }
            catch (Exception ex) { }
        }
コード例 #5
0
        public static void SetLogDetails(LogObject InputObject)
        {
            InputObject.LogDetails = new HeaderObject();
            try
            {
                //Message
                if (InputObject.LogMessage.Length > 75)
                {
                    //TXorRX
                    if (InputObject.LogMessage.Contains("TX :"))
                    {
                        InputObject.LogDetails.MsgType = MessageType.TX;
                    }
                    else if (InputObject.LogMessage.Contains("RX :"))
                    {
                        InputObject.LogDetails.MsgType = MessageType.RX;
                    }
                    else
                    {
                        InputObject.LogDetails.MsgType = MessageType.NONE;
                    }

                    //Actual Message
                    int    sIndex    = InputObject.LogMessage.IndexOf(InputObject.LogDetails.MsgType.ToString());
                    int    mLength   = InputObject.LogMessage.Length - sIndex;
                    string actualMsg = InputObject.LogMessage.Substring(sIndex + 4, mLength - 4);
                    InputObject.LogDetails.Message = actualMsg;

                    //Branch
                    InputObject.LogDetails.Branch = actualMsg.Substring(42, 4);
                    //Teller
                    InputObject.LogDetails.Teller = actualMsg.Substring(49, 5);
                    //Transaction
                    InputObject.LogDetails.Transaction = actualMsg.Substring(54, 6);
                }
            }
            catch (Exception ex) { }
        }