Exemplo n.º 1
0
        public void TestExportHistoryDataToolStripMenuItem_Click01()
        {
            HistDataPointListModel model = new HistDataPointListModel();

            Accessor   ctlAccessor = ReflectionAccessor.Wrap(trendViewController);
            TrendCache cache       = (TrendCache)(ctlAccessor.GetField("m_trendCache"));

            cache.m_histDataPointList    = model.GetHistDListByGrp("");
            cache.m_histDatapointGrpName = "";
            trendViewController.ExportHistoryDataToolStripMenuItem_Click(null, null);

            cache.m_histDataPointList    = model.GetHistDListByGrp(TestConst.HIST_GROUP_NAME);
            cache.m_histDatapointGrpName = TestConst.HIST_GROUP_NAME;
            trendViewController.ExportHistoryDataToolStripMenuItem_Click(null, null);
        }
        public override void NotifyObserver(NotifyObject notifyObj)
        {
            //throw new Exception("The method or operation is not implemented.");
            //  notifyObj.Name = can be a view id
            //  notifyObj.Type==Notify data type which is defined in the DataNotificationCost.cs file

            if (notifyObj.Name != m_View.ViewID)
            {
                return;
            }

            //will only handle the notification when the ViewID is matching.
            if (notifyObj.Type == DataNotificaitonConst.SelectHistDPGroupToLoad)
            {
                FillHistDataPointTable(m_Model.GetHistDListByGrp((string)(notifyObj.Body)));
                m_grpName = (string)(notifyObj.Body);
                m_View.PopulateDataPointListDataGridView(1, m_DataPointTable);
            }
            if (notifyObj.Type == DataNotificaitonConst.SaveHistDataPointToGroup)
            {
                m_grpName = (string)(notifyObj.Body);
                SaveHistDataPointListToGroup((string)(notifyObj.Body));
            }
            if (notifyObj.Type == DataNotificaitonConst.AddHistDataPoint)
            {
                AddHistDataPointToList((EtyHistDataPoint)(notifyObj.Body));
            }
            if (notifyObj.Type == DataNotificaitonConst.ModifyHistDataPoint)
            {
                KeyValuePair <string, EtyHistDataPoint> pair = (KeyValuePair <string, EtyHistDataPoint>)(notifyObj.Body);
                ModifyHistDataPoint(pair.Key, pair.Value);
            }
        }
Exemplo n.º 3
0
        public void TestExportHistoryData01()
        {
            // m_Model.GetHistDPLogList has data
            Accessor               ctlAccessor = ReflectionAccessor.Wrap(trendViewController);
            TrendCache             cache       = (TrendCache)(ctlAccessor.GetField("m_trendCache"));
            HistDataPointListModel model       = new HistDataPointListModel();

            cache.m_histDataPointList           = model.GetHistDListByGrp(TestConst.HIST_GROUP_NAME);
            cache.m_histDataPointList[0].DPName = "NotEmpty";
            cache.m_histDatapointGrpName        = TestConst.HIST_GROUP_NAME;

            ctlAccessor.Call("ExportHistoryData", "a.csv");
        }
Exemplo n.º 4
0
        public void TestGetHistDPLogMap()
        {
            HistDataPointListModel model = new HistDataPointListModel();

            Accessor   ctlAccessor = ReflectionAccessor.Wrap(trendViewController);
            TrendCache cache       = (TrendCache)(ctlAccessor.GetField("m_trendCache"));

            cache.m_histDataPointList    = model.GetHistDListByGrp(TestConst.HIST_GROUP_NAME);
            cache.m_histDatapointGrpName = TestConst.HIST_GROUP_NAME;

            DateTime fromTime = new DateTime(2013, 1, 10);
            DateTime toTime   = new DateTime(2013, 1, 12);

            trendViewController.GetHistDPLogMap(fromTime, toTime);
        }
Exemplo n.º 5
0
        public void FixtureSetUp()
        {
            if (DBConnectionStrings.GetInstance().GetConnectionStrings().Count < 1)
            {
                DBConnectionStrings.GetInstance().AddConnectionString(TestConst.CONNECTION_STR);
                SimpleDatabase.GetInstance().OpenConnection();
            }
            ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory());
            IView view = ViewManager.GetInstance().GetView(TrendViewConst.HistDataPointList, TestConst.TEST_VIEW_ID);

            histDataPointListController = (HistDataPointListController)(view.getController());
            histDataPointListController.InitHistDataPointTableColumns();

            HistDataPointListModel  model = new HistDataPointListModel();
            List <EtyHistDataPoint> list  = model.GetHistDListByGrp(TestConst.HIST_GROUP_NAME);

            histDataPointListController.FillHistDataPointTable(list);
            histDataPointListController.SetGrpName(TestConst.HIST_GROUP_NAME);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="paramList"> arg[0]: "view-0/view-edit-0/..", arg[1] datapoint, arg[2] marker,arg[3] history, arg[4] formula
        /// </param>
        public void DrawTrendView(ref Form frm, string paramList)
        {
            //get trending data by model
            //call to view for drawing
            string[]  arg         = paramList.Split(new char[] { ',' }, StringSplitOptions.None);
            int       screenWidth = ConfigureFileHelper.GetInstance().ScreenWidth;
            const int OFFSET      = 200;

            if (arg.Length > 0)
            {
                if (arg[0].Trim().ToLower() == "view-edit-0")
                {
                    this.accessRight  = "Y";
                    this.leftLocation = 0 + OFFSET;
                }
                else if (arg[0].Trim().ToLower() == "view-edit-1")
                {
                    this.accessRight  = "Y";
                    this.leftLocation = screenWidth + OFFSET;
                }
                else if (arg[0].Trim().ToLower() == "view-edit-2")
                {
                    this.accessRight  = "Y";
                    this.leftLocation = screenWidth * 2 + OFFSET;
                }
                else if (arg[0].Trim().ToLower() == "view-0")
                {
                    this.accessRight  = "N";
                    this.leftLocation = 0;
                }
                else if (arg[0].Trim().ToLower() == "view-1")
                {
                    this.accessRight  = "N";
                    this.leftLocation = screenWidth + OFFSET;
                }
                else
                {
                    this.accessRight  = "N";
                    this.leftLocation = screenWidth * 2 + OFFSET;
                }
                frm.StartPosition = FormStartPosition.Manual;
                frm.Location      = new Point(leftLocation, 0x9b);
            }
            if (arg.Length > 1)
            {
                if (arg[1].ToString().Trim() != "")
                {
                    DataPointListModel model = new DataPointListModel();
                    m_trendCache.m_dataPointList    = model.GetDPListByGrp(arg[1].Trim());
                    m_trendCache.m_datapointGrpName = arg[1].Trim();
                }
            }
            if (arg.Length > 2)
            {
                if (arg[2].ToString().Trim() != "")
                {
                    MarkerListModel model = new MarkerListModel();
                    m_trendCache.m_markerList    = model.GetMarkerListByGrp(arg[2].Trim());
                    m_trendCache.m_markerGrpName = arg[2].Trim();
                }
            }
            if (arg.Length > 3)
            {
                if (arg[3].ToString().Trim() != "")
                {
                    HistDataPointListModel model = new HistDataPointListModel();
                    m_trendCache.m_histDataPointList    = model.GetHistDListByGrp(arg[3].Trim());
                    m_trendCache.m_histDatapointGrpName = arg[3].Trim();
                }
            }
            if (arg.Length > 4)
            {
                if (arg[4].ToString().Trim() != "")
                {
                    FormulaListModel model = new FormulaListModel();
                    m_trendCache.m_formulaList    = model.GetFormulaListByGrp(arg[4].Trim());
                    m_trendCache.m_formulaGrpName = arg[4].Trim();
                }
            }
            object    sender = null;
            EventArgs e      = null;

            if (arg.Length > 1)
            {
                RealTimeExecuteCmd_Click(sender, e);
            }
        }