Ejemplo n.º 1
0
        public void TestUpdateDataPointDB01()
        {
            OPCSampleGrpConfigStartModel oPCSampleGrpConfigStartModel = OPCSampleGrpConfigStartModelFactory.CreateOPCSampleGrpConfigStartModel01();
            double sampleGrpID = double.MinValue;

            oPCSampleGrpConfigStartModel.UpdateDataPointDB(sampleGrpID);

            //Test2---Valid input
            #region TestSetup
            //insert testing group
            EtyDataLogDPGroupTrend etySampleGrp = new EtyDataLogDPGroupTrend();
            etySampleGrp.NewData       = true;
            etySampleGrp.SampleGrpName = "DOTTestParasoftTesting123";
            etySampleGrp.Interval      = 1;
            etySampleGrp.IntervalType  = "M";
            etySampleGrp.Disabled      = false;
            oPCSampleGrpConfigStartModel.InsertOPCSampleGrp(etySampleGrp);
            //getSampleId from DB
            List <EtyDataLogDPGroupTrend> list = oPCSampleGrpConfigStartModel.GetAllOPCSampelGrp(OPCSampleGrpConfigStart.OPCSAMPLEGRPDESC_COL_NAME, OPCSampleGrpConfigStart.OPCSAMPLEGRP_SORT_ASC);
            foreach (var item in list)
            {
                if (item.SampleGrpName.Equals("DOTTestParasoftTesting123"))
                {
                    etySampleGrp = item;
                    break;
                }
            }

            //insert testing Datapoint
            EtyDataLogDPTrend etyOPCDP = new EtyDataLogDPTrend();
            etyOPCDP.OPCDataPointName = "DOTTestParasoftDP1.Value";
            etyOPCDP.EntityKey        = 20099999;
            etyOPCDP.OPCSampleGrpId   = etySampleGrp.SampleGrpID;
            etyOPCDP.Disabled         = false;
            DatalogDPTrendDAO.GetInstance().InsertOPCDataPoint(etyOPCDP);
            #endregion

            //Test Procedure Call
            oPCSampleGrpConfigStartModel.UpdateDataPointDB(etySampleGrp.SampleGrpID);
            //Post Condition Check
            #region PostConditionCheck
            bool   bDisable       = false;
            string sampleGrpIDstr = etySampleGrp.SampleGrpID.ToString();
            //Get DataPoint from DB
            double sampleid = DatalogDPTrendDAO.GetInstance().GetGrpIDByDPName("DOTTestParasoftDP1.Value");
            //Assert.IsTrue(bDisable);
            Assert.AreEqual(sampleid, -1);
            #endregion

            #region CleanUp
            //Clean up inserted test data in DB
            //Delete testing DP
            string localSQL = "Delete from OPC_DT_PT where DATA_PT_NAME = 'DOTTestParasoftDP1.Value'";
            SimpleDatabase.GetInstance().ExecuteNonQuery(localSQL);

            //Delete Testing sampleGrp
            DatalogDPGroupTrendDAO.GetInstance().DeleteOPCSampleGroupById(etySampleGrp.SampleGrpID.ToString());
            #endregion
        }
        /// <summary>
        /// Returns all the Sample Group in the Database in ID_Name map format
        /// </summary>
        /// <returns>Sample Group IdToName map</returns>
        public Dictionary <string, string> GetSampleGrps()
        {
            Dictionary <string, string> opcSampleGrpDic = new Dictionary <string, string>();
            Dictionary <string, string> opcDic          = DatalogDPGroupTrendDAO.GetInstance().GetAllOPCGrpIdAndName(false);

            foreach (KeyValuePair <string, string> pair in opcDic)
            {
                if (!opcSampleGrpDic.ContainsKey(pair.Key))
                {
                    opcSampleGrpDic.Add(pair.Key, pair.Value);
                }
            }
            return(opcSampleGrpDic);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="dataPoint"></param>
        /// <returns></returns>
        public bool CheckConfiguredByOcc(string dataPoint)
        {
            bool   bConfigured = false;
            double sampleGrpID = DatalogDPTrendDAO.GetInstance().GetGrpIDByDPName(dataPoint);

            if (sampleGrpID != -1)
            {
                EtyDataLogDPGroupTrend etySampleGrp = DatalogDPGroupTrendDAO.GetInstance().GetOPCGrpByID(sampleGrpID);
                if (etySampleGrp.LocationName.ToUpper() == DAOHelper.OCC_LOCATIONNAME)
                {
                    bConfigured = true;
                }
            }
            return(bConfigured);
        }
Ejemplo n.º 4
0
        public void TestUpdateOPCSampleGrp01()
        {
            OPCSampleGrpConfigStartModel oPCSampleGrpConfigStartModel = new OPCSampleGrpConfigStartModel();
            //insert temp grp
            EtyDataLogDPGroupTrend etySampleGrp = new EtyDataLogDPGroupTrend();

            etySampleGrp.SampleGrpName        = "ParasoftTesting123";
            etySampleGrp.SampleGrpDescription = "testing";
            etySampleGrp.IntervalType         = "S";
            etySampleGrp.Interval             = 23;
            etySampleGrp.DeltaValue           = 1;
            etySampleGrp.Disabled             = true;
            etySampleGrp.StartTime            = "09:44";
            etySampleGrp.NewData = true;
            oPCSampleGrpConfigStartModel.InsertOPCSampleGrp(etySampleGrp);
            //update the values
            etySampleGrp.IntervalType = "H";
            etySampleGrp.Interval     = 1;
            etySampleGrp.DeltaValue   = 4;
            etySampleGrp.Disabled     = false;
            etySampleGrp.StartTime    = "";
            //Test Procedure Call
            oPCSampleGrpConfigStartModel.UpdateOPCSampleGrp(etySampleGrp);

            //Post Condition Check
            #region PostConditionCheck
            //Check updation from DB
            try
            {
                string localSQL = "SELECT PKEY,NAME,DESCRIPTION,SAMPLE_INTERVAL,INTERVAL_TYPE,START_TIME,DELTA_VALUE,ENABLED FROM DATALOG_DP_GROUP_TREND where NAME ='" +
                                  etySampleGrp.SampleGrpName + "'";

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

                if (drReader != null && drReader.Read())
                {
                    if (!drReader.IsDBNull(0))
                    {
                        etySampleGrp.SampleGrpID = drReader.GetInt32(0);
                        double Interval = drReader.GetInt32(3);
                        Assert.AreEqual(Interval, etySampleGrp.Interval);
                        string IntervalType = drReader.GetString(4).ToString();
                        Assert.AreEqual(etySampleGrp.IntervalType, IntervalType);
                        string StartTime = drReader.GetString(5).ToString();
                        Assert.AreEqual(etySampleGrp.StartTime, StartTime);
                        double DeltaValue = drReader.GetDouble(6);
                        Assert.AreEqual(etySampleGrp.DeltaValue, DeltaValue);
                        string disabled = drReader.GetString(7).ToString();
                        bool   bdis     = DAOHelper.ChangeStrToBool(disabled);
                        Assert.AreEqual(etySampleGrp.Disabled, bdis);
                    }
                }

                if (drReader != null)
                {
                    drReader.Close();
                    drReader.Dispose();
                }
            }
            catch (Exception localException)
            {
                //failed test
            }

            #endregion

            #region Cleanup
            //delete inserted temp group
            DatalogDPGroupTrendDAO.GetInstance().DeleteOPCSampleGroupById(etySampleGrp.SampleGrpID.ToString());
            #endregion
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Deletes Sample Group from the Database based on the ID.
        /// </summary>
        /// <param name="opcSampelGrpId"> Sample Group Id</param>
        public bool DeleteOPCSampleGrp(string opcSampelGrpId)
        {
            bool result = DatalogDPGroupTrendDAO.GetInstance().DeleteOPCSampleGroupById(opcSampelGrpId);

            return(result);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Returns the total Count of the Sample Group in the Database.
 /// </summary>
 /// <returns>Total count</returns>
 public int GetOPCGrpCount()
 {
     return(DatalogDPGroupTrendDAO.GetInstance().GetRowCount());
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Updates the value of the existing Sample Group in Database.
 /// </summary>
 /// <param name="etyOPCSampleGroup">Sample group entity with updated values</param>
 public void UpdateOPCSampleGrp(EtyDataLogDPGroupTrend etyOPCSampleGroup)
 {
     DatalogDPGroupTrendDAO.GetInstance().UpdateOPCGrpData(etyOPCSampleGroup);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Returns all Sample Group Entity List which is sorted.
 /// </summary>
 /// <param name="sortCol"></param>
 /// <param name="sortingOrder"></param>
 /// <returns></returns>
 public List <EtyDataLogDPGroupTrend> GetAllOPCSampelGrp(string sortCol, string sortingOrder)
 {
     return(DatalogDPGroupTrendDAO.GetInstance().GetAllOPCGrpsBySort(sortCol, sortingOrder));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Returns the Sample Group Entity List which is sorted and indexed.
 /// </summary>
 /// <param name="sortCol">column used for sorting</param>
 /// <param name="sortingOrder">sorting order</param>
 /// <param name="lowerRecord">starting index</param>
 /// <param name="upperRecord">end index</param>
 /// <returns>Sample Groups Entity List</returns>
 public List <EtyDataLogDPGroupTrend> GetAllOPCSampelGrp(string sortCol, string sortingOrder, int lowerRecord, int upperRecord)
 {
     return(DatalogDPGroupTrendDAO.GetInstance().GetAllOPCGrpsBySortNPage(sortCol, sortingOrder, lowerRecord, upperRecord));
 }
Ejemplo n.º 10
0
 public void TestReleaseInstance01()
 {
     DatalogDPGroupTrendDAO.ReleaseInstance();
     datalogDPGroupTrendDAO = DatalogDPGroupTrendDAO.GetInstance();
 }
Ejemplo n.º 11
0
 public void TestGetInstance01()
 {
     datalogDPGroupTrendDAO = DatalogDPGroupTrendDAO.GetInstance();
 }