コード例 #1
0
        public void TestNotifyObserver()
        {
            NotifyObject obj = new NotifyObject();

            obj.Name = "Another_ViewID";
            markerListController.NotifyObserver(obj);

            obj.Name = TestConst.TEST_VIEW_ID;
            obj.Type = DataNotificaitonConst.SelectMarkGroupToLoad;
            obj.Body = TestConst.MARK_GROUP_NAME;
            markerListController.NotifyObserver(obj);

            obj.Type = DataNotificaitonConst.SaveMarkerToGroup;
            markerListController.NotifyObserver(obj);

            obj.Type = DataNotificaitonConst.AddMarker;
            EtyMarker ety = new EtyMarker();

            ety.MarkerName = "tempMarker";
            obj.Body       = ety;
            markerListController.NotifyObserver(obj);

            obj.Type = DataNotificaitonConst.ModifyMarker;
            KeyValuePair <string, EtyMarker> pair = new KeyValuePair <string, EtyMarker>("tempName", ety);

            obj.Body = pair;
            markerListController.NotifyObserver(obj);

            markerListController.DeleteByMarkerName("tempMarker");
        }
コード例 #2
0
        private void MarkerData_Load(object sender, EventArgs e)
        {
            string Function_Name = "MarkerData_Load";

            try
            {
                if (m_formType == FormType.Add)
                {
                    fontColorPanel.BackColor = Color.Black;
                    backColorPanel.BackColor = Color.Orange;
                    this.Text = StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_MarkData_AddMarkerTitle, LanguageHelper.TrendViewer_MarkData_AddMarkerTitle_EN);
                }
                else //for "Edit"
                {
                    this.Text = StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_MarkData_EditMarkerTitle, LanguageHelper.TrendViewer_MarkData_EditMarkerTitle_EN);
                    fontColorPanel.BackColor = Color.Black;
                    backColorPanel.BackColor = Color.Orange;

                    MarkerDataController ctl    = (MarkerDataController)(getController());
                    EtyMarker            marker = ctl.GetMarker();
                    markerNameBox.Text = marker.MarkerName;

                    backColorPanel.BackColor = Color.FromArgb(Convert.ToInt32(marker.MarkerBColor));
                    fontColorPanel.BackColor = Color.FromArgb(Convert.ToInt32(marker.MarkerFColor));

                    markerEnabledCb.Checked = marker.MarkerEnabled;
                    lineWidthBox.Value      = (decimal)(marker.MarkerWidth);
                    valueBox.Value          = (decimal)(marker.MarkerValue);
                }
            }
            catch (Exception localException)
            {
                LogHelper.Error(CLASS_NAME, Function_Name, localException.ToString());
            }
        }
コード例 #3
0
        public void TestSetMarkerEtyByRow()
        {
            EtyMarker marker = new EtyMarker();

            DataTable table = new DataTable("TRENDVIEWER_MARKER");

            table.Columns.Add("CONFIG_NAME", System.Type.GetType("System.String"));
            table.Columns.Add("MARKER_NAME", System.Type.GetType("System.String"));
            table.Columns.Add("MARKER_WIDTH", System.Type.GetType("System.String"));
            table.Columns.Add("MARKER_VALUE", System.Type.GetType("System.String"));
            table.Columns.Add("MARKER_ENABLED", System.Type.GetType("System.String"));
            table.Columns.Add("MARKER_BCOLOR", System.Type.GetType("System.String"));
            table.Columns.Add("MARKER_FCOLOR", System.Type.GetType("System.String"));
            DataRow row = table.NewRow();

            row["MARKER_WIDTH"]   = 3;
            row["MARKER_VALUE"]   = 1;
            row["MARKER_BCOLOR"]  = "-23296";
            row["MARKER_FCOLOR"]  = "-23296";
            row["MARKER_ENABLED"] = "Y";

            markerListController.SetMarkerEtyByRow(ref marker, row);

            row["MARKER_ENABLED"] = "N";
            markerListController.SetMarkerEtyByRow(ref marker, row);
        }
コード例 #4
0
 public void TestGetNewMarker01()
 {
     using (MarkerData markerData = MarkerDataFactory.CreateMarkerData01())
     {
         EtyMarker etyMarker = markerData.GetNewMarker();
     }
 }
コード例 #5
0
        public void TestEtyMarker01()
        {
            EtyMarker etyMarker = new EtyMarker();

            string s = etyMarker.ConfigName;

            etyMarker.ConfigName = s;

            s = etyMarker.MarkerBColor;
            etyMarker.MarkerBColor = s;

            bool b = etyMarker.MarkerEnabled;

            etyMarker.MarkerEnabled = b;

            s = etyMarker.MarkerFColor;
            etyMarker.MarkerFColor = s;

            s = etyMarker.MarkerName;
            etyMarker.MarkerName = s;

            double d = etyMarker.MarkerValue;

            etyMarker.MarkerValue = d;

            d = etyMarker.MarkerWidth;
            etyMarker.MarkerWidth = d;

            ulong pkey = etyMarker.PKey;

            etyMarker.PKey = pkey;
        }
コード例 #6
0
        public void AddMarkerToList(EtyMarker marker)
        {
            DataRow newDataPointMarkerRow = m_markerTable.NewRow();

            setMarkRowByEty(ref newDataPointMarkerRow, marker);

            m_markerTable.Rows.Add(newDataPointMarkerRow);
            m_View.PopulateDataMarkerListDataGridView(1);
        }
コード例 #7
0
        public void TestGetEnabledMarkerList()
        {
            TrendCache trendCache = new TrendCache();

            trendCache.m_markerList = new List <EtyMarker>();
            EtyMarker marker = new EtyMarker();

            marker.MarkerEnabled = true;
            trendCache.m_markerList.Add(marker);
            trendCache.GetEnabledMarkerList();
        }
コード例 #8
0
        public List <EtyMarker> ConvertDataTableToList()
        {
            List <EtyMarker> markerList = new List <EtyMarker>();

            foreach (DataRow markerRow in m_markerTable.Rows)
            {
                EtyMarker marker = new EtyMarker();
                SetMarkerEtyByRow(ref marker, markerRow);
                markerList.Add(marker);
            }
            return(markerList);
        }
コード例 #9
0
        public EtyMarker GetNewMarker()
        {
            EtyMarker marker = new EtyMarker();

            marker.MarkerName    = markerNameBox.Text;
            marker.MarkerEnabled = markerEnabledCb.Checked;
            marker.MarkerValue   = (double)(valueBox.Value);
            marker.MarkerWidth   = (double)(lineWidthBox.Value);
            marker.MarkerBColor  = backColorPanel.BackColor.ToArgb().ToString();
            marker.MarkerFColor  = fontColorPanel.BackColor.ToArgb().ToString();
            return(marker);
        }
コード例 #10
0
        public void ModifyMarker(string markerName, EtyMarker marker)
        {
            foreach (DataRow markerRow in m_markerTable.Rows)  //will only have 1 record
            {
                if (markerName == markerRow["MARKER_NAME"].ToString())
                {
                    DataRow row = markerRow;
                    setMarkRowByEty(ref row, marker);
                }
            }

            m_View.PopulateDataMarkerListDataGridView(1);
        }
コード例 #11
0
        public void TestDrawDataMarker01()
        {
            List <EtyMarker> list   = new List <EtyMarker>();
            EtyMarker        marker = new EtyMarker();

            marker.MarkerName    = TestConst.MARKER_NAME;
            marker.MarkerValue   = 1;
            marker.MarkerWidth   = 2;
            marker.MarkerEnabled = true;
            marker.MarkerBColor  = "-32704";
            marker.MarkerFColor  = "-32704";
            list.Add(marker);

            viewAccessor.Call("DrawDataMarker", list);
        }
コード例 #12
0
 public void SetMarkerEtyByRow(ref EtyMarker marker, DataRow markerRow)
 {
     marker.MarkerName   = markerRow["MARKER_NAME"].ToString();
     marker.MarkerWidth  = System.Convert.ToDouble(markerRow["MARKER_WIDTH"]);
     marker.MarkerBColor = markerRow["MARKER_BCOLOR"].ToString();
     marker.MarkerFColor = markerRow["MARKER_FCOLOR"].ToString();
     marker.MarkerValue  = System.Convert.ToDouble(markerRow["MARKER_VALUE"]);
     if ("Y" == markerRow["MARKER_ENABLED"].ToString())
     {
         marker.MarkerEnabled = true;
     }
     else
     {
         marker.MarkerEnabled = false;
     }
 }
コード例 #13
0
        private void setMarkRowByEty(ref DataRow markerRow, EtyMarker marker)
        {
            markerRow["MARKER_NAME"]   = marker.MarkerName;
            markerRow["MARKER_WIDTH"]  = marker.MarkerWidth.ToString();
            markerRow["MARKER_BCOLOR"] = marker.MarkerBColor;
            markerRow["MARKER_VALUE"]  = marker.MarkerValue.ToString();
            if (marker.MarkerEnabled == true)
            {
                markerRow["MARKER_ENABLED"] = "Y";
            }
            else
            {
                markerRow["MARKER_ENABLED"] = "N";
            }

            markerRow["MARKER_FCOLOR"] = marker.MarkerFColor;
        }
コード例 #14
0
        public void TestPopulateDataMarkerListDataGridView_GetMarkNameByRowIndex()
        {
            markerList.PopulateDataMarkerListDataGridView(1);
            markerList.GetMarkNameByRowIndex(10);
            MarkerListController ctl = (MarkerListController)(markerList.getController());

            EtyMarker marker1 = new EtyMarker();

            marker1.MarkerName = "a1";
            ctl.AddMarkerToList(marker1);

            markerList.PopulateDataMarkerListDataGridView(1);
            markerList.GetMarkNameByRowIndex(0);

            EtyMarker marker2 = new EtyMarker();

            marker2.MarkerName = "a2";
            ctl.AddMarkerToList(marker2);
            EtyMarker marker3 = new EtyMarker();

            marker3.MarkerName = "a3";
            ctl.AddMarkerToList(marker3);
            EtyMarker marker4 = new EtyMarker();

            marker4.MarkerName = "a4";
            ctl.AddMarkerToList(marker4);
            EtyMarker marker5 = new EtyMarker();

            marker5.MarkerName = "a5";
            ctl.AddMarkerToList(marker5);
            EtyMarker marker6 = new EtyMarker();

            marker6.MarkerName = "a6";
            ctl.AddMarkerToList(marker6);
            EtyMarker marker7 = new EtyMarker();

            marker7.MarkerName = "a7";
            ctl.AddMarkerToList(marker7);
            EtyMarker marker8 = new EtyMarker();

            marker8.MarkerName = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
            ctl.AddMarkerToList(marker8);

            markerList.PopulateDataMarkerListDataGridView(1);
        }
コード例 #15
0
        public void TestAddMarkerToList_ModifyMarker_DeleteByMarkerName_ConvertDataTableToList_EditMarker()
        {
            string tempMarkerName = "tempName";

            EtyMarker marker = new EtyMarker();

            marker.MarkerName = tempMarkerName;
            markerListController.AddMarkerToList(marker);


            marker.MarkerEnabled = true;
            markerListController.ModifyMarker(tempMarkerName, marker);
            marker.MarkerEnabled = false;
            markerListController.ModifyMarker(tempMarkerName, marker);

            markerListController.ConvertDataTableToList();
            markerListController.EditMarker(tempMarkerName);

            markerListController.DeleteByMarkerName(tempMarkerName);
        }
コード例 #16
0
        public void TestMarkerData_Load01()
        {
            markerData.SetFormType(FormType.Add);
            Accessor markerDataAccessor = ReflectionAccessor.Wrap(markerData);

            markerDataAccessor.Call("MarkerData_Load", null, null);

            MarkerDataController ctl         = new MarkerDataController();
            Accessor             ctlAccessor = ReflectionAccessor.Wrap(ctl);
            EtyMarker            ety         = new EtyMarker();

            ety.MarkerBColor = "-32704";
            ety.MarkerFColor = "-32704";
            ety.MarkerValue  = 2;
            ety.MarkerWidth  = 2;
            ctlAccessor.SetField("m_marker", ety);
            markerDataAccessor.SetField("m_controller", ctl);
            markerData.SetFormType(FormType.Edit);
            markerDataAccessor.Call("MarkerData_Load", null, null);
        }
コード例 #17
0
        public void TestfirstdataMarkerListDataGridView_Click_nextdataMarkerListDataGridView_Click()
        {
            Accessor markerListAccessor = ReflectionAccessor.Wrap(markerList);

            markerListAccessor.Call("firstdataMarkerListDataGridView_Click", null, null);

            markerList.PopulateDataMarkerListDataGridView(1);
            MarkerListController ctl     = (MarkerListController)(markerList.getController());
            EtyMarker            marker9 = new EtyMarker();

            marker9.MarkerName = "a9";
            ctl.AddMarkerToList(marker9);
            markerList.PopulateDataMarkerListDataGridView(2);

            markerListAccessor.Call("nextdataMarkerListDataGridView_Click", null, null);
            markerListAccessor.Call("pageNumdataMarkerListDataGridView_ValueChanged", null, null);
            markerListAccessor.Call("prevdataMarkerListDataGridView_Click", null, null);
            markerListAccessor.Call("lastdataMarkerListDataGridView_Click", null, null);
            markerListAccessor.Call("dataMarkerListDataGridView_Sorted", null, null);
        }
コード例 #18
0
        public void SaveMarkerListToGroup(string grpName)
        {
            string Function_Name = "SaveMarkerListToGroup";

            List <EtyMarker> markList = new List <EtyMarker>();

            foreach (DataRow markerRow in m_markerTable.Rows)
            {
                EtyMarker marker = new EtyMarker();
                SetMarkerEtyByRow(ref marker, markerRow);
                markList.Add(marker);
            }

            try
            {
                m_Model.SaveMarkerListToGroup(markList, grpName);
            }
            catch (Exception ex)
            {
                TrendViewerHelper.HandleEx(ex);
            }
        }
コード例 #19
0
        public void Test_Delete_Insert_GetMarkGrp()
        {
            string markGrpName = "UnitTest_MarkerGrp";

            markerDAO.DeleteAllMarkerInGrp(markGrpName);

            List <EtyMarker> markerList = new List <EtyMarker>();
            EtyMarker        marker1    = new EtyMarker();

            marker1.MarkerEnabled = true;
            EtyMarker marker2 = new EtyMarker();

            marker2.MarkerEnabled = false;
            marker1.MarkerName    = "unitTest_marker1";
            marker2.MarkerName    = "unitTest_marker2";
            markerList.Add(marker1);
            markerList.Add(marker2);

            //markerDAO.InsertMarkerListToGrp(markerList, markGrpName);
            markerDAO.SaveMarkerListToGrp(markerList, markGrpName);

            markerDAO.GetMarkersByCfgName(markGrpName);
            markerDAO.DeleteAllMarkerInGrp(markGrpName);
        }
コード例 #20
0
        /// <summary>
        /// get marker list by a group name
        /// </summary>
        /// <param name="configName">the marker group name</param>
        /// <returns>the marker list in the group</returns>
        public List <EtyMarker> GetMarkersByCfgName(string configName)
        {
            const string Function_Name = "GetMarkersByCfgName";

            LogHelper.Trace(CLASS_NAME, Function_Name, "Function_Entered");
            List <EtyMarker> markerList = new List <EtyMarker>();


            string localSQL = " SELECT CONFIG_NAME, MARKER_NAME,MARKER_WIDTH,MARKER_BCOLOR,MARKER_VALUE,MARKER_ENABLED,MARKER_FCOLOR" +
                              " FROM TRENDVIEWER_MARKER WHERE CONFIG_NAME = '" + DAOHelper.convertEscapeStringAndGB2312To8859P1(configName) + "'";

            System.Data.IDataReader drReader = SimpleDatabase.GetInstance().ExecuteQuery(localSQL);
            EtyMarker newEtyMarker           = null;

            try
            {
                while (drReader != null && drReader.Read())
                {
                    newEtyMarker = new EtyMarker();

                    if (!drReader.IsDBNull(drReader.GetOrdinal("CONFIG_NAME")))
                    {
                        newEtyMarker.ConfigName = DAOHelper.convert8859P1ToGB2312(drReader["CONFIG_NAME"].ToString());
                    }
                    if (!drReader.IsDBNull(drReader.GetOrdinal("MARKER_NAME")))
                    {
                        newEtyMarker.MarkerName = DAOHelper.convert8859P1ToGB2312(drReader["MARKER_NAME"].ToString());
                    }
                    if (!drReader.IsDBNull(drReader.GetOrdinal("MARKER_WIDTH")))
                    {
                        newEtyMarker.MarkerWidth = Convert.ToDouble(drReader["MARKER_WIDTH"]);  //need test
                    }
                    if (!drReader.IsDBNull(drReader.GetOrdinal("MARKER_BCOLOR")))
                    {
                        newEtyMarker.MarkerBColor = drReader["MARKER_BCOLOR"].ToString();
                    }
                    if (!drReader.IsDBNull(drReader.GetOrdinal("MARKER_VALUE")))
                    {
                        newEtyMarker.MarkerValue = Convert.ToDouble(drReader["MARKER_VALUE"]);
                    }
                    if (!drReader.IsDBNull(drReader.GetOrdinal("MARKER_ENABLED")))
                    {
                        string markerEnabled = drReader["MARKER_ENABLED"].ToString();
                        if (markerEnabled == "Y")
                        {
                            newEtyMarker.MarkerEnabled = true;
                        }
                        else
                        {
                            newEtyMarker.MarkerEnabled = false;
                        }
                    }

                    if (!drReader.IsDBNull(drReader.GetOrdinal("MARKER_FCOLOR")))
                    {
                        newEtyMarker.MarkerFColor = drReader["MARKER_FCOLOR"].ToString();
                    }

                    markerList.Add(newEtyMarker);
                }
            }
            catch (System.Exception ex)
            {
                LogHelper.Error(CLASS_NAME, Function_Name, ex.ToString());
            }

            if (drReader != null)
            {
                drReader.Close();
                drReader.Dispose();
                //SimpleDatabase.GetInstance().CloseCurrentSession();
            }

            LogHelper.Trace(CLASS_NAME, Function_Name, "Function_Exited");
            return(markerList);
        }