Esempio n. 1
0
        public void done()
        {
            IReportRender render = null;

            try
            {
                IReportSource repSource = new ImplReportSource(_environment, _location);
                for (int i = 0; i < _params.Length; ++i)
                {
                    if (_params[i] != string.Empty && _cols[i] != string.Empty)
                    {
                        IFilter filter = new ImplFilter(_environment, repSource, FilterInfo.getConstFilterInfo(_params[i], _valSource.get()[_cols[i]]));
                        repSource.addFilter(filter);
                    }
                }
                repSource.getReports()[0].setDataSource(repSource.get());
                render = new MobFormShowDataStub(_environment);
                render.setReport(repSource.getReports()[0]);
                render.done();
            }
            catch (Exception exc)
            {
                _environment.getExceptionHandler().setException(exc);
            }
            finally
            {
                if (render != null)
                {
                    render.Dispose();
                }
            }
        }
Esempio n. 2
0
 public ChartWorker(
     IRepository <Report> reportRepository,
     IReportRender reportRender)
 {
     _reportRepository = reportRepository;
     _reportRender     = reportRender;
 }
Esempio n. 3
0
 public ConsoleEngine(IReportRender reportRender)
 {
     _invocationContext = new SystemConsole();
     _consoleRenderer   = new ConsoleRenderer(_invocationContext, resetAfterRender: true);
     _reportRender      = reportRender;
     _reportRender.Init(_invocationContext, _consoleRenderer);
 }
Esempio n. 4
0
 public TestWorker(
     IBuilder <Report> reportBuilder,
     IConfigurationService configurationService,
     IConductor conductor,
     IReportRender reportRender,
     IRepository <Report> reportRepository)
 {
     _reportBuilder        = reportBuilder;
     _configurationService = configurationService;
     _conductor            = conductor;
     _reportRender         = reportRender;
     _reportRepository     = reportRepository;
 }
Esempio n. 5
0
        public void ShowSortedCallInfo(IReportRender render, Billing.BL.Classes.Billing billing, ITerminal terminal)
        {
            bool        flag        = true;
            SortingType sortingType = SortingType.ByCost;

            while (flag)
            {
                Console.WriteLine("Select the sort type:\n " +
                                  "ByDateOfCall (enter {0}),\n " +
                                  "ByCost (enter {1}),\n " +
                                  "ByNumber (enter {2}),\n " +
                                  "ByCallType (enter {3}),\n"
                                  , 1, 2, 3, 4);
                var key = Console.ReadKey().Key;
                if (key == ConsoleKey.NumPad1 || key == ConsoleKey.D1)
                {
                    flag        = false;
                    sortingType = SortingType.ByDateOfCall;
                }
                else if (key == ConsoleKey.NumPad2 || key == ConsoleKey.D2)
                {
                    flag        = false;
                    sortingType = SortingType.ByCost;
                }
                else if (key == ConsoleKey.NumPad3 || key == ConsoleKey.D3)
                {
                    flag        = false;
                    sortingType = SortingType.ByNumber;
                }
                else if (key == ConsoleKey.NumPad4 || key == ConsoleKey.D4)
                {
                    flag        = false;
                    sortingType = SortingType.ByCallType;
                }
                else
                {
                    Console.WriteLine();
                }
            }

            foreach (var item in render.SortCalls(billing.GetReport(terminal.TelephonNumber), sortingType))
            {
                Console.WriteLine("\nCalls:\n Type {0} |\n Date: {1} |\n Duration: {2} | Cost: {3} | Telephone number: {4}",
                                  item.CallType, item.Date, item.CallDuration.ToString("mm:ss"), item.Cost, item.Number);
            }
        }
Esempio n. 6
0
            public object done()
            {
                object result_ = null;

                try
                {
                    switch (_type)
                    {
                    case ConstObjectNamePrefix.prefAdapter:
                        //IAdapterObject adp_ = _environment.getFactoryAdapter().get(_cmd, _environment);
                        //IAdapterObjectExecuteResult res_ = adp_.execute(_cmd, null, false);
                        //if (res_ != null)
                        //{
                        //    try
                        //    {
                        //        res_.done(false);
                        //        result_ = res_.getExecResult();
                        //    }
                        //    catch (Exception exc)
                        //    {
                        //        res_.failed();
                        //        throw exc;
                        //    }
                        //}

                        var _editor = _environment.getAdapter(_cmd);
                        if (_editor != null)
                        {
                            _editor.adapter.add();
                            _editor.edit();
                        }

                        break;

                    case ConstObjectNamePrefix.prefReference:
                        //if (_ref == null)
                        //{
                        //    _ref = _environment.getFactoryReference().get(_cmd, _environment);
                        //    if (_ref != null)
                        //        _ref.getFlagStore().flagDisable(ReferenceFlags.dialog);
                        //}

                        //if (_ref != null)
                        //    _ref.begin();



                        if (_ref == null)
                        {
                            _ref = _environment.getReference(_cmd);
                        }

                        if (_ref != null)
                        {
                            _ref.begin(null, null, true, (_args != null && _args.Length > 0 ? _args[0] : null) as EventHandler);
                        }


                        break;

                    case ConstObjectNamePrefix.prefReport:
                    {
                        try
                        {
                            FilterInfo[] filters_ = _args != null && _args.Length > 0 ? _args[0] as FilterInfo[] : null;

                            string _location = ToolObjectName.getArgValue(_cmd, ConstCmdLine.loc);

                            IReportSource repSource = new ImplReportSource(_environment, _location);

                            if (filters_ != null)
                            {
                                foreach (FilterInfo f in filters_)
                                {
                                    IFilter filter = new ImplFilter(_environment, repSource, f);
                                    repSource.addFilter(filter);
                                }
                            }


                            repSource.getReports()[0].setDataSource(repSource.get());
                            IReportRender render = _environment.gerReportRender();
                            render.setReport(repSource.getReports()[0]);
                            render.done();
                        }
                        catch (Exception exc)
                        {
                            _environment.getExceptionHandler().setException(exc);
                        }
                    }
                    break;

                    case ConstObjectNamePrefix.prefReportServer:
                    {
                        var act = new ToolReportServer(_environment, _cmd);
                        act.done();
                    }
                    break;

                    case ConstObjectNamePrefix.prefTool:
                    {
                        try
                        {
                        }
                        catch (Exception exc)
                        {
                            _environment.getExceptionHandler().setException(exc);
                        }
                    }
                    break;
                    }
                }
                catch (Exception exc)
                {
                    _environment.getExceptionHandler().setException(exc);
                }

                return(result_);
            }