Exemplo n.º 1
0
        public List <DataTable> LoadMultiPointTrendData(MultiPointConfiguration multiPointConf)
        {
            List <DataTable> dataList         = new List <DataTable>();
            BandpassConfig   selectedbandpass = multiPointConf.CommonBandpassList.Where(x => x.Active).FirstOrDefault() as BandpassConfig;

            if (selectedbandpass == null)
            {
                selectedbandpass = multiPointConf.CommonBandpassList.First();
            }
            string query = string.Empty;

            switch (multiPointConf.StatTermType)
            {
            case "week":
                foreach (var channel in multiPointConf.SelectedChannelList)
                {
                    query =
                        "SELECT DATEPART(yy, [DateTime]),DATEPART(ww, [DateTime])," + multiPointConf.ValueMeasureType + "([" + selectedbandpass.BandpassName + "]) " +
                        "FROM " + DataConnection.Database + ".[dbo].[VectorData_day_" + multiPointConf.ValueMeasureType + "] " +
                        "WHERE [ChannelId]=" + channel.Id + " AND [DateTime] BETWEEN '" + multiPointConf.StartDateStr + "' AND '" + multiPointConf.EndDateStr + "' " +
                        "GROUP BY DATEPART(yy, [DateTime]),DATEPART(ww, [DateTime]) " +
                        "ORDER BY DATEPART(yy, [DateTime]),DATEPART(ww, [DateTime])";
                    DataTable dt = GetResultByQuery(query, DataConnection);
                    dt.TableName = channel.PointName;
                    dataList.Add(dt);
                }
                break;

            case "day":
                foreach (var channel in multiPointConf.SelectedChannelList)
                {
                    query =
                        "SELECT DATEPART(yy, [DateTime]),DATEPART(mm, [DateTime]),DATEPART(dd, [DateTime])," + multiPointConf.ValueMeasureType + "([" + selectedbandpass.BandpassName + "]) " +
                        "FROM " + DataConnection.Database + ".[dbo].[VectorData_day_" + multiPointConf.ValueMeasureType + "] " +
                        "WHERE [ChannelId]=" + channel.Id + " AND [DateTime] BETWEEN '" + multiPointConf.StartDateStr + "' AND '" + multiPointConf.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 = channel.PointName;
                    dataList.Add(dt);
                }
                break;

            case "month":
                foreach (var channel in multiPointConf.SelectedChannelList)
                {
                    query =
                        "SELECT DATEPART(yy, [DateTime]),DATEPART(mm, [DateTime])," + multiPointConf.ValueMeasureType + "([" + selectedbandpass.BandpassName + "]) " +
                        "FROM " + DataConnection.Database + ".[dbo].[VectorData_month_" + multiPointConf.ValueMeasureType + "] " +
                        "WHERE [ChannelId]=" + channel.Id + " AND [DateTime] BETWEEN '" + multiPointConf.StartDateStr + "' AND '" + multiPointConf.EndDateStr + "' " +
                        "GROUP BY DATEPART(yy, [DateTime]),DATEPART(mm, [DateTime]) " +
                        "ORDER BY DATEPART(yy, [DateTime]),DATEPART(mm, [DateTime]) ";
                    DataTable dt = GetResultByQuery(query, DataConnection);
                    dt.TableName = channel.PointName;
                    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
            };
        }