Пример #1
0
 private void CreateFunctionalControls()
 {
     foreach (var func in ReportManagerContext.GetInstance().Functionals)
     {
         CreateBarItem(func);
     }
 }
        private void TFunctionalChartSubscribe()
        {
            this.SafeInvoke(() =>
            {
                var data = new TemperatureFrameDatabaseAdapter().Select();
                foreach (Series s in chartTemp.Series)
                {
                    s.DataSource = data;
                }
            });

            var functional = ReportManagerContext.GetInstance()
                             .Functionals
                             .Find(func => func.GetType() == typeof(TemperatureDbWriteFunctional));

            if (functional != null)
            {
                (functional as TemperatureDbWriteFunctional).OnInsert += (sender, args)
                                                                         => this.SafeInvoke(()
                                                                                            =>
                {
                    var data = new TemperatureFrameDatabaseAdapter().Select();
                    foreach (Series s in chartTemp.Series)
                    {
                        s.DataSource = data;
                    }
                });
            }
        }
Пример #3
0
        private XtraReport CreateReportInstance()
        {
            XtraReport report = (XtraReport)
                                Activator.CreateInstance((cbReports.SelectedItem as ReportTypeWrapper).ReportType);

            if (!(report is ISavingReport))
            {
                MessageBox.Show("Забыл унаследоваться от интерфейс ISavingReport");
                return(null);
            }
            ;

            if ((report as ISavingReport).IsExistTemplateFile())
            {
                report.LoadLayout((report as ISavingReport).GetTemplateFileName());
            }

            report.DataSource =
                new List <AggregatedFieldsModel> {
                new AggregatedFieldsModel(
                    ReportManagerContext.GetInstance().CurrentDeviceModel.SerialNumber[0],
                    ReportManagerContext.GetInstance().CurrentDeviceModel.InputData[0],
                    ReportManagerContext.GetInstance().CurrentDeviceModel.CalibrationResults[0],
                    ReportManagerContext.GetInstance().CurrentDeviceModel.DeviceTestResults[0])
            };

            return(report);
        }
Пример #4
0
        private XtraReport CreateReportInstance()
        {
            var report = (XtraReport)
                         Activator.CreateInstance((cbReports.SelectedItem as ReportTypeWrapper).ReportType);


            if (!(report is ISavingReport))
            {
                MessageBox.Show("Забыл унаследоваться от интерфейс ISavingReport");
                return(null);
            }
            ;

            if ((report as ISavingReport).IsExistTemplateFile())
            {
                report.LoadLayout((report as ISavingReport).GetTemplateFileName());
            }

            var input = ReportManagerContext.GetInstance().CurrentInput;

            report.DataSource = new List <object> {
                input,
                (new DeviceTestResultsDatabaseAdapter()).SelectBySerial(input.SERIAL_NO).FirstOrDefault() ?? new DeviceTestResults(),
                (new CalibrationResultsDatabaseAdapter()).SelectBySerial(input.SERIAL_NO).FirstOrDefault() ?? new CalibrationResults()
            }
            .PropertiesToDict()
            .ToExpando()
            .ToDynamicArray()
            .ToDataTable();

            report.PrintingSystem.PrintProgress += Report_PrintProgreses;

            return(report);
        }
 private void MaxigrafStageForm_Shown(object sender, EventArgs e)
 {
     ReportManagerContext.GetInstance().InputDataCreatedStatus += OnDeviceModelCreatedStatus;
     if (!FindPlate())
     {
         return;
     }
     SetDataSource();
     tbSerial.Text    = _inputData.INDEX_NO;
     tbPlateName.Text = _plate.PlateName;
 }
 private void OnDeviceModelCreatedStatus(object sender, Tuple <DeviceModelStatus, DeviceModel> data)
 {
     if (data.Item1 == DeviceModelStatus.CreatedSuccess)
     {
         tbSerial.Text = ReportManagerContext.GetInstance().CurrentDeviceModel.InputData[0].INDEX_NO;
     }
     else
     {
         _connection?.Dispose();
         Close();
     }
 }
        private void TFunctionalGridSubscribe()
        {
            this.SafeInvoke(() => grdTemp.DataSource = new TemperatureFrameDatabaseAdapter().Select());

            var functional = ReportManagerContext.GetInstance()
                             .Functionals
                             .Find(func => func.GetType() == typeof(TemperatureDbWriteFunctional));

            if (functional != null)
            {
                (functional as TemperatureDbWriteFunctional).OnInsert += (sender, args)
                                                                         => this.SafeInvoke(()
                                                                                            => grdTemp.DataSource = new TemperatureFrameDatabaseAdapter().Select());
            }
        }
 private void Report_PrintProgress(object sender, PrintProgressEventArgs e)
 {
     var(status, extra) = FolderUtility.CheckAndCreateCurrentPath("Transport List");
     if (status == FolderUtilityStatus.Success)
     {
         var path = $"{extra}" +
                    $"TransportList_{ReportManagerContext.GetInstance().CurrentInput.SERIAL_NO}.pdf";
         if (!Directory.Exists(path))
         {
             (sender as TransportListReport)?.ExportToPdf(path);
         }
     }
     else if (status == FolderUtilityStatus.Error)
     {
         XtraMessageBox.Show($"Не удалось сохранить отчет\n{extra}");
     }
 }
Пример #9
0
        private void btnLoadDeviceModel_Click(object sender, EventArgs e)
        {
            var deviceModel =
                DataModelCreator.GetDeviceBySerial(new DataModel.SerialNumber {
                Serial = edtSerial.Text
            });

            if (deviceModel != null)
            {
                ReportManagerContext.GetInstance().SetDeviceModel(deviceModel);
                (new ReportForm()).ShowDialog();
            }
            else
            {
                MessageBox.Show("Серийный номер не найден", "Ошибка",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #10
0
        public TemperatureForm()
        {
            InitializeComponent();

            TFunctionalGridSubscribe();
            TFunctionalChartSubscribe();
            TFunctionalGaugesSubscribe();

            var functional = ReportManagerContext.GetInstance()
                             .Functionals
                             .Find(func => func.GetType() == typeof(TempteratureDeviceFunctional));

            if (functional == null)
            {
                Close();
            }
            functional.Start();
        }
Пример #11
0
        private void Report_PrintProgreses(object sender, PrintProgressEventArgs e)
        {
            var report = CreateReportInstance();
            var name   = CreateReportInstance().Report.Band.ToString();

            if (name == "Сертификат")
            {
                var(status, extra) = FolderUtility.CheckAndCreateCurrentPath("Certificate");
                if (status == FolderUtilityStatus.Success)
                {
                    var path = $"{extra}" +
                               $"Certificate_{ReportManagerContext.GetInstance().CurrentInput.SERIAL_NO}.pdf";
                    if (!Directory.Exists(path))
                    {
                        (report as CertificateReport)?.ExportToPdf(path);
                    }
                }
                else if (status == FolderUtilityStatus.Error)
                {
                    XtraMessageBox.Show($"Не удалось сохранить отчет\n{extra}");
                }
            }
        }
Пример #12
0
        public StagesForm()
        {
            InitializeComponent();

            FillData();

            var keyFilter = new KeyMessageFilter();

            keyFilter.EventKeyHandler += KeyFilter_EventKeyHandler;
            Application.AddMessageFilter(keyFilter);
            Application.ApplicationExit += Application_ApplicationExit;

            ReportManagerContext.GetInstance().Fill();
            ReportManagerContext.GetInstance().Start();

            UpdateStageButtons();

            SettingsContext.SettingsLoadingEvent += SettingsContextOnSettingsLoadingEvent;
            ReportManagerContext.GetInstance().InputDataCreatedStatus += StagesForm_DeviceModelCreatedStatus;
            ReportManagerContext.GetInstance().Device.OnChangeState += ModbusDevice_OnChangeState;
            FunctionalSubscribe();

            CreateFunctionalControls();
        }
Пример #13
0
 private void TemperatureForm_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
 {
     ReportManagerContext.GetInstance().Device.OnTemperatureRead -= Device_OnTemperatureRead;
     ReportManagerContext.GetInstance().Device.OnHumidityRead -= Device_OnHumidityRead;
     ReportManagerContext.GetInstance().Device.OnPressureRead -= Device_OnPressureRead;
 }
Пример #14
0
 private void TFunctionalGaugesSubscribe()
 {
     ReportManagerContext.GetInstance().Device.OnTemperatureRead += Device_OnTemperatureRead;
     ReportManagerContext.GetInstance().Device.OnHumidityRead += Device_OnHumidityRead;
     ReportManagerContext.GetInstance().Device.OnPressureRead += Device_OnPressureRead;
 }
 private void MaxigrafStageForm_Shown(object sender, EventArgs e)
 {
     ReportManagerContext.GetInstance().DeviceModelCreatedStatus += OnDeviceModelCreatedStatus;
     tbSerial.Text = ReportManagerContext.GetInstance().CurrentDeviceModel.InputData[0].INDEX_NO;
 }
 private void TransportListGenerateStageForm_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
 {
     ReportManagerContext.GetInstance().InputDataCreatedStatus -= OnDeviceModelCreatedStatus;
 }
 public MaxigrafStageForm()
 {
     InitializeComponent();
     _memo        = GetInnerTextBox(memoLog);
     _deviceModel = ReportManagerContext.GetInstance().CurrentDeviceModel;
 }
Пример #18
0
 public WaitForm(string msCode)
 {
     InitializeComponent();
     MsCode = msCode;
     ReportManagerContext.GetInstance().InputDataCreatedStatus += WaitForm_InputDataCreatedStatus;
 }
 private void MaxigrafStageForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     DestroyConnection();
     ReportManagerContext.GetInstance().DeviceModelCreatedStatus -= OnDeviceModelCreatedStatus;
 }
 public MaxigrafStageForm()
 {
     InitializeComponent();
     _memo      = GetInnerTextBox(memoLog);
     _inputData = ReportManagerContext.GetInstance().CurrentInput;
 }