コード例 #1
0
        /// <summary>
        /// This method saves edited or new sample Group into the database.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void SaveCommand(object sender, EventArgs e)
        {
            string Function_Name = "SaveCommand";

            try
            {
                EtyDataLogDPGroupTrend etyDPGrpTrend = m_view.GetEditFields();
                if (etyDPGrpTrend == null)
                {
                    return;
                }
                if (etyDPGrpTrend.NewData && IsOPCSampleGrpExist(etyDPGrpTrend.SampleGrpName, etyDPGrpTrend.LocationKey))
                {
                    MessageBoxDialog.Show(StringHelper.GetInstance().getStringValue(FormCaptionHelper.OPCSAMPLECONFIG_GRPEXISTS_MSG, EnglishString.MSG_NAME_EXIST));
                    return;
                }
                if (!etyDPGrpTrend.NewData)
                {
                    m_model.UpdateOPCSampleGrp(etyDPGrpTrend);
                }
                else
                {
                    m_model.InsertOPCSampleGrp(etyDPGrpTrend);
                }
                MessageBoxDialog.Show(StringHelper.GetInstance().getStringValue(FormCaptionHelper.OPCDATASELECTOR_SAVE_MSG, EnglishString.SAVE_SUSSCCESSFUL_MSG));
                //load all sample group from database
                m_loadFromDB = true;
                m_view.PopulateIntervalConfigDataGridView(2);
                m_view.Clear();
            }
            catch (Exception localException)
            {
                LogHelper.Error(CLASS_NAME, Function_Name, localException.ToString());
            }
        }
コード例 #2
0
        public void TestClear01()
        {
            using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01())
            {
                Accessor oPCSampleGrpConfigStartAccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart);

                //Test Procedure Call
                oPCSampleGrpConfigStart.Clear();
                //Post condition Check
                Assert.AreEqual("", oPCSampleGrpConfigStartAccessor.GetProperty("intervalNameTextBox.Text"));
                Assert.AreEqual("", oPCSampleGrpConfigStartAccessor.GetProperty("intervalDescTextBox.Text"));
                Assert.AreEqual(1, oPCSampleGrpConfigStartAccessor.GetProperty(" intervalUnitBox.Value"));
                Assert.AreEqual(OPCSampleGrpConfigStart.INTERVALETYPE_MINUTE_INDEX, oPCSampleGrpConfigStartAccessor.GetProperty("intervalTypeBox.SelectedIndex"));
                Assert.AreEqual(1, oPCSampleGrpConfigStartAccessor.GetProperty("deltaValueBox.Value"));
                Assert.AreEqual(false, oPCSampleGrpConfigStartAccessor.GetProperty("dateTimePicker.Checked"));
                Assert.AreEqual(true, oPCSampleGrpConfigStartAccessor.GetProperty("disableCheckBox.Checked"));
                Assert.AreEqual(false, oPCSampleGrpConfigStartAccessor.GetProperty("intervalNameTextBox.Enabled"));
                Assert.AreEqual(true, oPCSampleGrpConfigStartAccessor.GetProperty("intervalNameTextBox.Enabled"));
                Assert.AreEqual("", oPCSampleGrpConfigStartAccessor.GetField("m_editIntervalGrpID"));
            }
        }