Пример #1
0
        public void AddHistDataPointData(object sender, EventArgs e)
        {
            string Function_Name = "AddHistDataPointData";

            if (m_View.GetStartDate() > m_View.GetEndDate())
            {
                MessageBoxDialog.Show(
                    StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_StartDateMoreThenEnd, LanguageHelper.TrendViewer_Msg_StartDateMoreThenEnd_EN),
                    StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_WarningTitle, LanguageHelper.TrendViewer_Msg_WarningTitle_EN),
                    MessageBoxButtons.OK, MessageBoxIcon.Warning
                    );
                return;
            }

            string dpName = m_View.GetHistDataPointName();

            if (dpName == "")
            {
                return;
            }

            if (!HistDataPointNameValid(dpName))  //means has duplicate names
            {
                MessageBoxDialog.Show(StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_DuplicateName, LanguageHelper.TrendViewer_Msg_DuplicateName_EN),
                                      StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_ErrTitle, LanguageHelper.TrendViewer_Msg_ErrTitle_EN), MessageBoxButtons.OK, MessageBoxIcon.Warning);

                return;
            }

            EtyHistDataPoint histDP = m_View.GetNewHistDataPoint();

            try
            {
                histDP.EntityKey = m_Model.GetEntityKeyByName(histDP.DPName); //update the entityKey
            }
            catch (DatabaseConnectionException ex)
            {
//                 MessageBoxDialog.Show(
//                     StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_NoDB, LanguageHelper.TrendViewer_Msg_NoDB_EN),
//                     StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_ErrTitle, LanguageHelper.TrendViewer_Msg_ErrTitle_EN),
//                     MessageBoxButtons.OK, MessageBoxIcon.Error);
                STEE.ISCS.Log.LogHelper.Error(CLASS_NAME, Function_Name, "Can't get entitykey for historical datapoint - " + histDP.DPName + ", due to DB error.");
            }

            NotifyManager.GetInstance().Send(DataNotificaitonConst.AddHistDataPoint, m_View.ViewID, histDP);

            m_View.DestroyView();
        }
Пример #2
0
        public void TestGetEntityKeyByName()
        {
            HistDataPointDataModel model = new HistDataPointDataModel();

            model.GetEntityKeyByName("name.Value");
        }