Ejemplo n.º 1
0
        public override bool Load()
        {
            bool ret = true;

            //List<long> idlist = new List<long>();
            if (Common.Conn == null)
            {
                Common.Conn = new SQLiteConnection(Common.ConnectionString);
                Common.Conn.Open();
            }
            SQLiteDataReader myReader  = null;
            SQLiteCommand    myCommand = new SQLiteCommand();

            try
            {
                myReader = null;
                myCommand.CommandText = @"SELECT * FROM [tblAlarm] where VarNameID = " + m_VarNameID_tblVariable.VarNameID + ";";
                myCommand.Connection  = Common.Conn;
                myReader = myCommand.ExecuteReader();
                while (myReader.Read())
                {
                    tblAlarm tblalarm = new tblAlarm();
                    tblalarm.m_VarNameID_tblVariable = this.m_VarNameID_tblVariable;
                    tblalarm.AddFromRecordSet(myReader);

                    this.Add(tblalarm);
                }

                myReader.Close();
                myCommand.Dispose();
                //int count = idlist.Count;
                //foreach (long id in idlist)// (int i = 0; i < count ; i++)
                //{
                //    tblAlarm tblalarm = new tblAlarm();
                //    tblalarm.ID = id;// idlist[i];
                //    tblalarm.m_VarNameID_tblVariable = this.m_VarNameID_tblVariable;
                //    tblalarm.Select();

                //    this.Add(tblalarm);
                //}
            }
            catch (SQLiteException ae)
            {
                MessageBox.Show(ae.Message.ToString());
                return(false);
                //
            }



            return(ret);
        }
Ejemplo n.º 2
0
        //public AlarmObject( )
        //{

        //}
        public AlarmObject(tblAlarm tocopy)
        {
            AlarmGroups = new List <IAlarmGroup>();
            FillAlarmGroups();
            ID        = tocopy.ID;
            VarNameID = tocopy.VarNameID;
            StatusBit = (AlarmStatusBit)tocopy.StatusBit;
            Type      = (AlarmGroupType)tocopy.Type;
            //AlarmGroupID = tocopy.AlarmGroupID;

            this._IAlarmGroup  = InitAlarmGroup(tocopy.AlarmGroupID);
            EnableTagID        = tocopy.EnableTagID;
            EnableTagDirection = tocopy.EnableTagDirection;
            EnableTagDelayOn   = tocopy.EnableTagDelayOn;
            EnableTagDirection = tocopy.EnableTagDirection;
            EnableTagDelayOn   = tocopy.EnableTagDelayOn;
            EnableTagDealyOff  = tocopy.EnableTagDealyOff;
            DelayOn            = tocopy.DelayOn;
            DelayOff           = tocopy.DelayOff;
            SourceAlarmTagID   = tocopy.SourceAlarmTagID;
            FirstOutGroupID    = tocopy.FirstOutGroupID;
            hysteresis         = tocopy.hysteresis;
            UpperLevelGroupID  = tocopy.UpperLevelGroupID;
        }
Ejemplo n.º 3
0
        public void CopyVariableGrid(VariableGrid tocopy)
        {
            this.VarName          = tocopy.VarName;
            this.VarNameID        = tocopy.VarNameID;
            this.pouID            = tocopy.pouID;
            this.Description      = tocopy.Description;
            this.InitialVal       = tocopy.InitialVal;
            this.Type             = tocopy.Type;
            this.Option           = (int)tocopy.Option;
            this.PlantStructureID = tocopy.PlantStructureID;
            this.DispalyID        = tocopy.DispalyID;
            this.AEB             = tocopy.AEB;
            this.ALB             = tocopy.ALB;
            this.SampleTime      = tocopy.SampleTime;
            this.RTT             = tocopy.RTT;
            this.Interval        = tocopy.Interval;
            this.Archive         = tocopy.Archive;
            this.ArchiveInterval = tocopy.ArchiveInterval;
            bool     found = false;
            tblAlarm tblaralm;
            int      count = m_tblAlarmCollection.Count;

            for (int i = count - 1; i >= 0; i--)
            {
                found    = false;
                tblaralm = m_tblAlarmCollection[i];
                foreach (AlarmObject alarmobject in tocopy.m_AlarmCollection)
                {
                    if (tblaralm.ID == alarmobject.ID)
                    {
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    tblaralm.Delete();
                    m_tblAlarmCollection.Remove(tblaralm);
                }
            }

            foreach (AlarmObject alarmobject in tocopy.m_AlarmCollection)
            {
                if (alarmobject.ID == -1)
                {
                    tblAlarm tblalarm = new tblAlarm();
                    tblalarm.AlarmObjectCopy(alarmobject);
                    tblalarm.Insert();
                    m_tblAlarmCollection.Add(tblalarm);
                }
                else
                {
                    foreach (tblAlarm tblalarm in m_tblAlarmCollection)
                    {
                        if (tblalarm.ID == alarmobject.ID)
                        {
                            tblalarm.AlarmObjectCopy(alarmobject);
                            tblalarm.Update();
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
 public bool Contains(tblAlarm item)
 {
     return(List.Contains(item));
 }
Ejemplo n.º 5
0
 public int IndexOf(tblAlarm item)
 {
     return(List.IndexOf(item));
 }
Ejemplo n.º 6
0
 public void Insert(int index, tblAlarm item)
 {
     List.Insert(index, item);
     this.OntblAlarmChanged(EventArgs.Empty);
 }
Ejemplo n.º 7
0
 public void Remove(tblAlarm item)
 {
     List.Remove(item);
     this.OntblAlarmChanged(EventArgs.Empty);
 }
Ejemplo n.º 8
0
 public void Add(tblAlarm item)
 {
     List.Add(item);
     this.OntblAlarmChanged(EventArgs.Empty);
 }