Exemple #1
0
 private void ReportHandler_Thread()
 {
     while (true)
     {
         if (_ReportEvent.WaitOne(int.MaxValue))
         {
             ReportBase report = Dequeue();
             while (report != null)
             {
                 try
                 {
                     if (this.Reporting != null)
                     {
                         this.Reporting(this, report);
                     }
                 }
                 catch (Exception ex)
                 {
                     ExceptionPolicy.HandleException(ex);
                 }
                 report = Dequeue();
             }
         }
     }
 }
        public void ProcessReport(ReportBase report)
        {
            Action <ReportBase> action = delegate(ReportBase report1)
            {
                EntranceInfo entrance = ParkBuffer.Current.GetEntrance(report1.EntranceID);
                if (entrance != null && WorkStationInfo.CurrentStation.EntranceList.Exists(e => e == entrance.EntranceID))//是否是工作站要处理的事件
                {
                    if (report1 is CardEventReport)
                    {
                        CardEventReport eventInfo = report1 as CardEventReport;
                        ProcessCardEvent(eventInfo);
                    }
                    if (!(report1 is ParkVacantReport) && !(report1 is EntranceRemainTempCardReport) && !(report1 is EntranceStatusReport))
                    {
                        eventList.InsertReport(report1);
                    }
                }
            };

            if (this.InvokeRequired)
            {
                this.Invoke(action, report);
            }
            else
            {
                action(report);
            }
        }
Exemple #3
0
        protected override StringBuilder Render(ReportBase report)
        {
            //header
            var sb = new System.Text.StringBuilder();

            sb.AppendLine("  <table border=\"1\">");
            sb.AppendLine("   <thead>");
            sb.AppendLine("    <tr>");
            foreach (string headerName in report.HeaderNames)
            {
                sb.AppendLine($"     <th>{WebUtility.HtmlEncode(headerName)}</th>");
            }
            sb.AppendLine("    </tr>");
            sb.AppendLine("   </thead>");
            sb.AppendLine("   <tbody>");


            foreach (string[] row in report.Rows)
            {
                sb.AppendLine("    <tr>");
                foreach (string cell in row)
                {
                    var htmlCell = WebUtility.HtmlEncode(cell).Replace("\r\n", "<br/>");
                    sb.AppendLine($"     <td><pre>{htmlCell}</pre></td>");
                }
                sb.AppendLine("    </tr>");
            }
            sb.AppendLine("   </tbody>");
            sb.AppendLine("  </table>");

            return(sb);
        }
        private ReportBase Dequeue()
        {
            ReportBase report = null;

            lock (_ReportsLocker)
            {
                if (_Reports.Count > 0)
                {
                    report = _Reports.Dequeue();
                }
            }
            //2014-10-17 注销 Jan
            //if (AppSettings.CurrentSetting.Debug)
            //{
            //    if (report != null)
            //    {
            //        Ralid.GeneralLibrary.LOG.FileLog.Log("事件处理", "正在处理事件: " + report.Description);
            //    }
            //    //else
            //    //{
            //    //    Ralid.GeneralLibrary.LOG.FileLog.Log("事件处理", "未获取到事件");
            //    //}
            //}
            return(report);
        }
 private void ReportHandler_Thread()
 {
     try
     {
         while (true)
         {
             try
             {
                 if (_ReportEvent.WaitOne(int.MaxValue))
                 {
                     ReportBase report = Dequeue();
                     while (report != null)
                     {
                         if (this.Reporting != null)
                         {
                             this.Reporting(this, report);
                         }
                         report = Dequeue();
                     }
                 }
                 ////如果不使用_ReportEvent等待,直接用while(true),如果不Sleep1毫秒,会导致CPU占用率一直很高
                 //Thread.Sleep(1);
             }
             catch (Exception ex)
             {
                 ExceptionPolicy.HandleException(ex);
             }
         }
     }
     catch (Exception ex)
     {
         Ralid.GeneralLibrary.LOG.FileLog.Log("事件处理", "事件循环线程被终止");
         ExceptionPolicy.HandleException(ex);
     }
 }
        private void EnQueue(ReportBase report)
        {
            int count = 0;

            lock (_ReportsLocker)
            {
                _Reports.Enqueue(report);
                count = _Reports.Count;

                //如果处理队列中的消息超过最大数量,则丢弃最开始的一个事件
                if (count > 10000)
                {
                    _Reports.Dequeue();
                    count = _Reports.Count;
                }
            }
            _ReportEvent.Set();
            //2014-10-17 注销 Jan
            //if (AppSettings.CurrentSetting.Debug)
            //{
            //    string logmsg = "收到事件: " + report.Description + ";" + "事件列表内事件数量: " + count;
            //    if (count > 100)
            //    {
            //        //当事件个数大于100时,可认为处理线程出错了,记录下线程的状态
            //        if (_ReportHandleThread != null)
            //        {
            //            logmsg += "\r\n" + "处理进程状态: " + _ReportHandleThread.ThreadState;
            //        }
            //    }
            //    Ralid.GeneralLibrary.LOG.FileLog.Log("收到事件", logmsg);
            //}
        }
Exemple #7
0
        public void ProcessReport(ReportBase report)
        {
            Action <ReportBase> action = delegate(ReportBase r)
            {
                if (r is EntranceStatusReport)
                {
                    ProcessReport(r as EntranceStatusReport);
                }
                else if (r is ParkVacantReport)
                {
                    ProcessReport(r as ParkVacantReport);
                }
                else if (r is EntranceRemainTempCardReport)
                {
                    ProcessReport(r as EntranceRemainTempCardReport);
                }
            };

            if (this.InvokeRequired)
            {
                this.BeginInvoke(action, report);
            }
            else
            {
                action(report);
            }
        }
 public void LoadBase(ReportBase report)
 {
     Timestamp    = DateTime.Now;
     Version      = report.Version;
     IsProduction = report.IsProduction;
     UGuid        = report.UGuid;
 }
 private void pad_CardEventReporting(object sender, ReportBase report)
 {
     try
     {
         if (report is CardEventReport)
         {
             CardEventReport cer = report as CardEventReport;
             if (cer.EventStatus == CardEventStatus.Valid)
             {
                 lock (_Locker)
                 {
                     if (_SendingEvents.Count >= 1000)
                     {
                         _SendingEvents.Clear();
                     }
                     _SendingEvents.Push(cer);
                     _AutoResetEvent.Set();
                 }
             }
         }
     }
     catch
     {
     }
 }
Exemple #10
0
 public void ProcessReport(ReportBase report)
 {
     try
     {
         if (report is CardEventReport)
         {
             CardEventReport r = report as CardEventReport;
             ReportHandle(r);
         }
         else if (report is ParkVacantReport)
         {
             ParkVacantReport r = report as ParkVacantReport;
             ReportHandle(r);
         }
         else if (report is CarSenseReport)
         {
             CarSenseReport r = report as CarSenseReport;
             //车到、车走时清空刷卡事件信息
             ReportHandle(r);
         }
         else if (report is UpdateSystemParamSettingReport)
         {
             UpdateSystemParamSettingReport r = report as UpdateSystemParamSettingReport;
             ReportHandle(r);
         }
     }
     catch (Exception ex)
     {
         Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
 }
Exemple #11
0
        public virtual void PostData(string url, ReportBase reportBase)
        {
            reportBase.UGuid        = EnvironmentProvider.UGuid;
            reportBase.Version      = _environmentProvider.Version.ToString();
            reportBase.IsProduction = EnvironmentProvider.IsProduction;

            PostData(url, reportBase as object);
        }
 private void ReportEnqueue(ReportBase report)
 {
     lock (_ReportSendingQueueLock)
     {
         _ReportSendingQueue.Enqueue(report);
         _ReportArriveEvent.Set();
     }
 }
Exemple #13
0
        public virtual void PostData(string url, ReportBase reportBase)
        {
            reportBase.UGuid = EnviromentProvider.UGuid;
            reportBase.Version = _enviromentProvider.Version.ToString();
            reportBase.IsProduction = EnviromentProvider.IsProduction;

            PostData(url, reportBase as object);
        }
Exemple #14
0
 private void ProcessReport(object sender, ReportBase report)
 {
     if (chkCardEvent.Checked)
     {
         InsertMessage(report.Description, Color.Black);
     }
     GlobalSettings.Current.Get <OpenCardMessageHandler>().HandleReport(report);
 }
Exemple #15
0
 private void EnQueue(ReportBase report)
 {
     lock (_ReportsLocker)
     {
         _Reports.Enqueue(report);
         _ReportEvent.Set();
     }
 }
Exemple #16
0
 public void DisplayTransactionsReportForCustomer(ReportBase transactionReport)
 {
     this.DateViewedLiteral.Text = transactionReport.DateViewed.ToDateTimeString();
     customerReportPanel.ConfigureGridColumns();
     customerReportPanel.ResetPaginationAndFocus();
     reportData.Visible = true;
     AllClientsReportHelpMessage.Visible = false;
     customerReportPanel.Display((CustomerTransactionReport)transactionReport);
 }
 public void ShowReport(ReportBase report)
 {
     if (report != null)
     {
         this.DateViewedLiteral.Text = report.DateViewed.ToDateTimeString();
     }
     Master.ShowReportViewer();
     ReportPanel.Display((PromptReport)report);
 }
Exemple #18
0
        public Byte[] PrintReportService(string reportID, InputArg parameter)
        {
            //try
            //{
            //    var reportParameters = new List<ReportParameter>
            //{
            //    new ReportParameter() { ParaName = "Operate", ParaValue = "Report" },
            //    new ReportParameter() { ParaName = "UserID", ParaValue = parameter.UserID },
            //    new ReportParameter() { ParaName = "SchoolYear", ParaValue =parameter.SchoolYear },
            //    new ReportParameter() { ParaName = "SchoolCode", ParaValue = parameter.SchoolCode },
            //    new ReportParameter() { ParaName = "PersonID", ParaValue = parameter.ObjID}
            //};



            var goPageparameter = new
            {
                Operate    = "",
                UserID     = "mif",
                UserRole   = "Admin",
                SchoolYear = "20202021",
                SchoolCode = "0205",
                Grade      = "",
                StudentID  = "00881172306",
                PageID     = reportID,
                Term       = "1"
            };
            var    myGoPageItem     = AppsPage.GoPageItemsList <GoPageItems>(goPageparameter)[0];
            string reportingService = myGoPageItem.PageSite;
            string reportPath       = myGoPageItem.PagePath;
            string reportName       = myGoPageItem.PageFile;
            string PagePara         = myGoPageItem.PagePara;

            var reportPara = new ReportBase
            {
                ReportService = myGoPageItem.PageSite,
                ReportPath    = myGoPageItem.PagePath,
                ReportName    = myGoPageItem.PageFile,
                ReportType    = "IEP",
                ReportFormat  = "PDF"
            };


            Byte[] myReport = null;
            try
            {
                myReport = GeneratePDFReport.GetOneReport(reportPara, parameter);

                return(myReport);
            }
            catch (Exception ex)
            {
                var em = ex.Message;
                return(null);
            }
        }
Exemple #19
0
 public void ReportToHtml(string outputPath)
 {
     if (this.result == null)
     {
         AddLog("Result is a null reference. Make sure tests were executed succesfully");
         return;
     }
     AddLog("Generating HTML report");
     System.Diagnostics.Process.Start(HtmlReport.RenderToHtml(this.result, ReportBase.GetAppDataPath(outputPath), GetReportName()));
 }
        public void InsertReport(ReportBase report)
        {
            Color color = Color.Empty;

            if (report is CardEventReport)
            {
                CardEventReport ce = report as CardEventReport;
                color = ce.ComparisonResult == CarPlateComparisonResult.Fail ? Color.Red : Color.Empty;
            }
            InsertMessage(report.Description, color);
        }
 private void ReportSending_Thread()
 {
     while (_ReportArriveEvent.WaitOne(int.MaxValue))
     {
         ReportBase report = ReportDequeue();
         while (report != null)
         {
             SendReport(report);
             report = ReportDequeue();
         }
     }
 }
Exemple #22
0
        public void SetupTest(CultureInfo culture)
        {
            Thread.CurrentThread.CurrentCulture   = culture;
            Thread.CurrentThread.CurrentUICulture = culture;

            treeViewCSSP = new TreeView();
            richTextBoxTreeViewSelectedStatus = new RichTextBox();
            reportTreeNodeRoot = new ReportTreeNode();

            reportBaseService = new ReportBaseService((culture.TwoLetterISOLanguageName == "fr" ? LanguageEnum.fr : LanguageEnum.en), treeViewCSSP);
            baseEnumService   = new BaseEnumService((culture.TwoLetterISOLanguageName == "fr" ? LanguageEnum.fr : LanguageEnum.en));
            reportBase        = new ReportBase();
        }
Exemple #23
0
 /// <summary>
 /// 把事件放入事件池中
 /// </summary>
 /// <param name="report"></param>
 public void AddToReportPool(ReportBase report)
 {
     lock (_PacketQueueLocker)
     {
         //如果处理队列中的消息超过最大数量,则丢弃最开始的一个事件,由于这里的事件都有实时性要求,队列中的事件积压的多,则表明前面的事件已经不用处理了
         if (_PacketQueue.Count == 10)
         {
             _PacketQueue.Dequeue();
         }
         _PacketQueue.Enqueue(report);
         _PacketRecieveEvent.Set();  //
     }
 }
Exemple #24
0
 private void reportPluginMenu_Click(object sender, EventArgs e)
 {
     try {
         ReportBase p = ReportBase.GetPluginByName((sender as ToolStripMenuItem).Tag.ToString());
         if (p != null)
         {
             p.MakeReport();
         }
     } catch (Exception exc) {
         _logger.Error(exc);
         MessageBox.Show(exc.Message);
     }
 }
Exemple #25
0
 private void checkPlugins()
 {
     if (ReportBase.CheckPlugins() != 0)
     {
         tsmiReports.DropDownItems.Add(new ToolStripSeparator());
         foreach (ReportBase p in ReportBase.Plugins)
         {
             ToolStripMenuItem menu = new ToolStripMenuItem(p.MenuText);
             menu.Tag    = p.UniqueName;
             menu.Click += new EventHandler(reportPluginMenu_Click);
             tsmiReports.DropDownItems.Add(menu);
         }
     }
 }
 private void SendReport(ReportBase report)
 {
     try
     {
         if (report is CardEventReport)
         {
             ReportSink(report as CardEventReport);
         }
         else if (report is CarSenseReport)
         {
             ReportSink(report as CarSenseReport);
         }
         else if (report is CardInvalidEventReport)
         {
             ReportSink(report as CardInvalidEventReport);
         }
         else if (report is DeviceResetReport)
         {
             ReportSink(report as DeviceResetReport);
         }
         else if (report is ParkVacantReport)
         {
             ReportSink(report as ParkVacantReport);
         }
         else if (report is CardCaptureReport)
         {
             ReportSink(report as CardCaptureReport);
         }
         else if (report is EntranceStatusReport)
         {
             ReportSink(report as EntranceStatusReport);
         }
         else if (report is EntranceRemainTempCardReport)
         {
             ReportSink(report as EntranceRemainTempCardReport);
         }
         else if (report is AlarmReport)
         {
             ReportSink(report as AlarmReport);
         }
         else if (report is UpdateSystemParamSettingReport)
         {
             ReportSink(report as UpdateSystemParamSettingReport);
         }
     }
     catch (Exception ex)
     {
         ExceptionPolicy.HandleException(ex);
     }
 }
Exemple #27
0
        public async Task <string> Render(string rptUid)
        {
            var        rptModel        = _dbContext.Get <RptSimpleTemplate>(rptUid);
            ReportBase report          = GetReport(rptModel);
            var        reportGenerator = new FapReportGenerator(_serviceProvider, report);
            string     outFilePath     = Path.Combine(Environment.CurrentDirectory, FapPlatformConstants.TemporaryFolder, $"{rptModel.ReportName}_Result.xlsx");
            await Task.Factory.StartNew(() =>
            {
                XLWorkbook result = reportGenerator.Render(GetReportTemplateWorkbook($"{rptModel.XlsFile}.xlsx"));
                result.SaveAs(outFilePath);
            });

            return(FapPlatformConstants.TemporaryFolder + Path.DirectorySeparatorChar + $"{rptModel.ReportName}_Result.xlsx");
        }
        private static bool TryGenerate(ReportBase r)
        {
            bool completed = false;

            try
            {
                r.Generate();
                completed = true;
            }
            catch (Exception e)
            {
                Global.WriteOutput(e.Message);
            }
            return(completed);
        }
Exemple #29
0
        protected void btnShowReport_Click(object sender, EventArgs e)
        {
            /*The report with two parameters. */
            // ParameterArrayList.Add(0);
            // ParameterArrayList.Add("1"); //Parameter 1 with input 1. This is actually dept id according to report parameter
            // ParameterArrayList.Add(1);
            // ParameterArrayList.Add("1"); //Parameter 2 with input 1. This is actually team id according to report parameter

            ReportBase objReportBase = new ReportBase();


            //ObjReportClientDocument.SetParameterValue("CITIZEN_ID", this.txt1.Text);
            GetReportDocument();
            ViewCystalReport();
        }
 public void ProcessReport(ReportBase report)
 {
     if (AppSettings.CurrentSetting.VehicleLedCOMPort > 0)
     {
         if (report is CardEventReport)
         {
             EntranceInfo entrance = ParkBuffer.Current.GetEntrance(report.EntranceID);
             if (entrance != null && WorkStationInfo.CurrentStation.EntranceList.Exists(e => e == entrance.EntranceID))
             {
                 CardEventReport r = report as CardEventReport;
                 ReportRender(r);
             }
         }
     }
 }
Exemple #31
0
        public void ProcessReport(ReportBase report)
        {
            Action <ReportBase> action = delegate(ReportBase report1)
            {
                eventList.InsertReport(report1);
            };

            if (this.InvokeRequired)
            {
                this.BeginInvoke(action, report);
            }
            else
            {
                action(report);
            }
        }
 private ReportBaseInfo GetReport(ReportCatalog rType, string id)
 {
     ReportBaseInfo rInfo = new ReportBaseInfo();
     switch (rType)
     {
         case ReportCatalog.Wuliao:
             rInfo = new ReportBase<WuliaoInputInfo>().GetReport(id);
             break;
         case ReportCatalog.Xiuli:
             rInfo = new ReportBase<XiuliInputInfo>().GetReport(id);
             break;
         case ReportCatalog.Jianyan:
             rInfo = new ReportBase<JianyanInputInfo>().GetReport(id);
             break;
         case ReportCatalog.Beijian:
             rInfo = new ReportBase<BeijianInputInfo>().GetReport(id);
             break;
         default:
             break;
     }
     return rInfo;
 }
 public void HandleReport(ReportBase reportPassed)
 {
     if (reportPassed != null)
     {
         Reports.Add(reportPassed);
     }
 }
        protected void rblReportType_SelectedIndexChanged(object sender, EventArgs e)
        {
            string id = this.ReportID;

            if (string.IsNullOrEmpty(id))
            {
                return;
            }
            WuliaoInputInfo wInfo = new WuliaoInput().GetByID(id);
            string selectValue = rblReportType.SelectedValue;
            if (selectValue == "1" && wInfo.ReportTypeID != "1")
            {
                WuliaoInputInfo preInfo = new ReportBase<WuliaoInputInfo>().GetPreestimateModel(wInfo.ID);
                SetPageValue(preInfo, selectValue);
            }
            else if (selectValue == "2" && wInfo.ReportTypeID == "3")
            {
                WuliaoInputInfo preInfo = new ReportBase<WuliaoInputInfo>().GetAmendModel(wInfo.ID);
                SetPageValue(preInfo, selectValue);
            }
            else
            {
                SetPageValue(wInfo, selectValue);
            }
        }