Exemplo n.º 1
0
        public List <DataTable> LoadMultiBandpassTrendData(MultiMeasureConfiguration multiBandConf)
        {
            List <DataTable> dataList = new List <DataTable>();

            string query = string.Empty;

            switch (multiBandConf.StatTermType)
            {
            case "week":
                foreach (var bandpass in multiBandConf.Channel.BandpassArr)
                {
                    if (bandpass.Active)
                    {
                        query =
                            "SELECT DATEPART(yy, [DateTime]),DATEPART(ww, [DateTime])," + multiBandConf.ValueMeasureType + "([" + bandpass.BandpassName + "]) " +
                            "FROM " + DataConnection.Database + ".[dbo].[VectorData_day_" + multiBandConf.ValueMeasureType + "] " +
                            "WHERE [ChannelId]=" + multiBandConf.Channel.Id + " AND [DateTime] BETWEEN '" + multiBandConf.StartDateStr + "' AND '" + multiBandConf.EndDateStr + "' " +
                            "GROUP BY DATEPART(yy, [DateTime]),DATEPART(ww, [DateTime]) " +
                            "ORDER BY DATEPART(yy, [DateTime]),DATEPART(ww, [DateTime])";
                        DataTable dt = GetResultByQuery(query, DataConnection);
                        dt.TableName = bandpass.OverrideInfo.OverrideName;
                        dataList.Add(dt);
                    }
                }
                break;

            case "day":
                foreach (var bandpass in multiBandConf.Channel.BandpassArr)
                {
                    if (bandpass.Active)
                    {
                        query =
                            "SELECT DATEPART(yy, [DateTime]),DATEPART(mm, [DateTime]),DATEPART(dd, [DateTime])," + multiBandConf.ValueMeasureType + "([" + bandpass.BandpassName + "]) " +
                            "FROM " + DataConnection.Database + ".[dbo].[VectorData_day_" + multiBandConf.ValueMeasureType + "] " +
                            "WHERE [ChannelId]=" + multiBandConf.Channel.Id + " AND [DateTime] BETWEEN '" + multiBandConf.StartDateStr + "' AND '" + multiBandConf.EndDateStr + "' " +
                            "GROUP BY DATEPART(yy, [DateTime]),DATEPART(mm, [DateTime]),DATEPART(dd, [DateTime]) " +
                            "ORDER BY DATEPART(yy, [DateTime]),DATEPART(mm, [DateTime]),DATEPART(dd, [DateTime])";
                        DataTable dt = GetResultByQuery(query, DataConnection);
                        dt.TableName = bandpass.OverrideInfo.OverrideName;
                        dataList.Add(dt);
                    }
                }
                break;

            case "month":
                foreach (var bandpass in multiBandConf.Channel.BandpassArr)
                {
                    if (bandpass.Active)
                    {
                        query =
                            "SELECT DATEPART(yy, [DateTime]),DATEPART(mm, [DateTime])," + multiBandConf.ValueMeasureType + "([" + bandpass.BandpassName + "]) " +
                            "FROM " + DataConnection.Database + ".[dbo].[VectorData_month_" + multiBandConf.ValueMeasureType + "] " +
                            "WHERE [ChannelId]=" + multiBandConf.Channel.Id + " AND [DateTime] BETWEEN '" + multiBandConf.StartDateStr + "' AND '" + multiBandConf.EndDateStr + "' " +
                            "GROUP BY DATEPART(yy, [DateTime]),DATEPART(mm, [DateTime]) " +
                            "ORDER BY DATEPART(yy, [DateTime]),DATEPART(mm, [DateTime]) ";
                        DataTable dt = GetResultByQuery(query, DataConnection);
                        dt.TableName = bandpass.OverrideInfo.OverrideName;
                        dataList.Add(dt);
                    }
                }
                break;
            }
            return(dataList);
        }
Exemplo n.º 2
0
        public MainForm()
        {
            InitializeComponent();

            #region MultiLang
            BtnReport_BandpassTrend.Text = MultiLang.TrendOfMeasurements;
            BtnReport_PointTrend.Text    = MultiLang.TrendOfPoint;
            BtnReport_DayOfWeek.Text     = MultiLang.WeeklyComparison;
            BtnReport_Period.Text        = MultiLang.PeriodicComparison;
            BtnReport_Daily.Text         = MultiLang.Daily;
            BtnReport_Repair.Text        = MultiLang.MaintenanceTask;
            BtnReport_PeriodDays.Text    = MultiLang.PeriodDays;
            BtnReport_GeneralTrend.Text  = MultiLang.GenaralTrend;

            BtnConfig_BandpassTrend.Text = MultiLang.Configuration;
            BtnConfig_PointTrend.Text    = MultiLang.Configuration;
            BtnConfig_DayOfWeek.Text     = MultiLang.Configuration;
            BtnConfig_Period.Text        = MultiLang.Configuration;
            BtnConfig_Daily.Text         = MultiLang.Configuration;
            BtnConfig_Repair.Text        = MultiLang.Configuration;
            BtnConfig_PeriodDays.Text    = MultiLang.Configuration;
            BtnConfig_GeneralTrend.Text  = MultiLang.Configuration;

            BtnPreview_BandpassTrend.Text = MultiLang.Preview;
            BtnPreview_PointTrend.Text    = MultiLang.Preview;
            BtnPreview_DayOfWeek.Text     = MultiLang.Preview;
            BtnPreview_Period.Text        = MultiLang.Preview;
            BtnPreview_Daily.Text         = MultiLang.Preview;
            BtnPreview_Repair.Text        = MultiLang.Preview;
            BtnPreview_PeriodDays.Text    = MultiLang.Preview;
            BtnPreview_GeneralTrend.Text  = MultiLang.Preview;
            #endregion

            SQLRepository.Init();
            LogGenerator.CreateLogFile();
            CreatePreviewSample();
            DBConn           = new DBConnector();
            ExcelManager     = new ExcelIOManager();
            MultiBandConf    = new MultiMeasureConfiguration();
            MultiPointConf   = new MultiPointConfiguration();
            DayOfWeekConf    = new DayOfWeekConfiguration();
            PeriodConf       = new PeriodConfiguration();
            DailyConf        = new DailyConfiguration();
            RepairConf       = new RepairConfiguration();
            PeriodDaysConf   = new PeriodDaysConfiguration();
            GeneralTrendConf = new GeneralTrendConfiguration();


            PeriodDaysConfigDlg = new PeriodDaysDlg(PeriodDaysConf)
            {
                Owner = this
            };
            DailyConfDlg = new DailyConfigDlg(DailyConf)
            {
                Owner = this
            };
            MultiBandConfigDlg = new MultiMeasureConfigDlg(MultiBandConf)
            {
                Owner = this
            };
            MultiPointConfigDlg = new MultiPointConfigDlg(MultiPointConf)
            {
                Owner = this
            };
            DayOfWeekConfigDlg = new DayOfWeekConfigDlg(DayOfWeekConf)
            {
                Owner = this
            };
            PeriodConfigDlg = new PeriodConfigDlg(PeriodConf)
            {
                Owner = this
            };
            RepairConfigDlg = new RepairConfigDlg(RepairConf)
            {
                Owner = this
            };
            GeneralTrendConfigDlg = new GeneralConfigDlg(GeneralTrendConf)
            {
                Owner = this
            };
        }