public bool IsVariable(string _str, ref tblController _tblcontroller, ref tblVariable _tblvariable, ref tblFormalParameter _tblformalparameter, ref string _subpropertytxt, ref byte _subproperty, ref bool _isrefernce)
        {
            string str   = "";
            int    count = 0;

            _str = _str.ToLower();
            string[] varname = _str.Split(new Char[] { '.' });
            _subproperty = 0;
            count        = varname.Length;
            // count = varname.Count();
            if (varname != null)
            {
                if (IsFCSName(varname[0], ref _tblcontroller))
                {
                    for (int i = 1; i < count; i++)
                    {
                        str += varname[i] + ".";
                    }
                    if (str != "")
                    {
                        str = str.Remove(str.Length - 1, 1);
                        if (_tblcontroller.GetGlobalPOU().IsVariable(str, ref _tblvariable, ref _isrefernce, ref _tblformalparameter, ref _subpropertytxt, ref _subproperty))
                        {
                        }
                    }
                }
            }
            return(false);
        }
Example #2
0
        public VariableGrid(tblVariable tocopy)
        {
            try
            {
                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           = (VarOption)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;

                foreach (tblAlarm tblalarm in tocopy.m_tblAlarmCollection)
                {
                    AlarmObject alarmobject = new AlarmObject(tblalarm);
                    this.m_AlarmCollection.Add(alarmobject);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #3
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();
            }
            SQLiteTransaction tr        = Common.Conn.BeginTransaction();
            SQLiteDataReader  myReader  = null;
            SQLiteCommand     myCommand = new SQLiteCommand();

            try
            {
                myReader = null;
                myCommand.CommandText = @"SELECT * FROM [tblVariable]  WHERE [pouID]= " + m_pouID_tblPou.pouID + ";";
                myCommand.Connection  = Common.Conn;
                myReader = myCommand.ExecuteReader();
                while (myReader.Read())
                {
                    //idlist.Add(myReader.GetInt64(myReader.GetOrdinal("VarNameID")));
                    tblVariable tblvariable = new tblVariable();
                    tblvariable.m_pouID_tblPou = m_pouID_tblPou;
                    tblvariable.AddFromRecordSet(myReader);
#if OWSAPP
                    tblvariable.InitCANY();
#endif
                    this.Add(tblvariable);
                }

                myReader.Close();
                myCommand.Dispose();
                //_SqlConnectionConnection.Close();

                //foreach (long id in idlist)// (int i = 0; i < count ; i++)
                //{
                //    tblVariable tblvariable = new tblVariable();
                //    tblvariable.VarNameID = id;
                //    tblvariable.m_pouID_tblPou = m_pouID_tblPou;
                //    tblvariable.Select();
                //    this.Add(tblvariable);
                //}
                tr.Commit();
            }
            catch (SQLiteException ae)
            {
                MessageBox.Show(ae.Message.ToString());
                return(false);
                //
            }

            return(ret);
        }
Example #4
0
 public BoolVariableGrid(tblVariable tocopy)
     : base(tocopy)
 {
     try
     {
         tblBOOL tblbool = new tblBOOL();
         tblbool.VarNameID = this.VarNameID;
         tblbool.SelectVarID();
         this.Text0 = tblbool.Text0;
         this.Text1 = tblbool.Text1;
         Loaded     = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #5
0
        public bool LoadLinkedVariable()
        {
            bool ret = true;

            try
            {
                m_tblFInstanceVariableList.Clear();
                List <long> idlist = new List <long>();
                if (Common.Conn == null)
                {
                    Common.Conn = new SQLiteConnection(Common.ConnectionString);
                    Common.Conn.Open();
                }
                SQLiteDataReader myReader  = null;
                SQLiteCommand    myCommand = Common.Conn.CreateCommand();
                myReader = null;
                myCommand.CommandText = @"SELECT * FROM [tblVariable]  WHERE [ParentVarID]= " + this.VarNameID + ";";
                myCommand.Connection  = Common.Conn;
                myReader = myCommand.ExecuteReader();
                while (myReader.Read())
                {
                    idlist.Add(myReader.GetInt64(myReader.GetOrdinal("VarNameID")));
                }

                myReader.Close();
                myCommand.Dispose();

                foreach (long id in idlist)// (int i = 0; i < count ; i++)
                {
                    tblVariable tblvariable = new tblVariable();
                    tblvariable.VarNameID = id;
                    tblvariable.Select();
                    m_tblFInstanceVariableList.Add(tblvariable);
                }
            }
            catch (SQLiteException ae)
            {
                MessageBox.Show(ae.Message);
                return(false);
            }
            return(ret);
        }
Example #6
0
 public RealVariableGrid(tblVariable tocopy)
     : base(tocopy)
 {
     try
     {
         tblREAL tblreal = new tblREAL();
         tblreal.VarNameID = this.VarNameID;
         tblreal.SelectVarID();
         this.UNI = tblreal.UNI;
         this.FOR = tblreal.FOR;
         this.IRL = tblreal.IRL;
         this.IRH = tblreal.IRH;
         this.LL  = tblreal.LL;
         this.HH  = tblreal.HH;
         this.L   = tblreal.L;
         this.H   = tblreal.H;
         Loaded   = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #7
0
 public tblAlarmCollection(tblVariable _parent)
 {
     _VarNameID_tblVariable = _parent;
 }
Example #8
0
 public bool Contains(tblVariable item)
 {
     return(List.Contains(item));
 }
Example #9
0
 public int IndexOf(tblVariable item)
 {
     return(List.IndexOf(item));
 }
Example #10
0
 public void Insert(int index, tblVariable item)
 {
     List.Insert(index, item);
     this.OntblVariableChanged(EventArgs.Empty);
 }
Example #11
0
 public void Remove(tblVariable item)
 {
     List.Remove(item);
     this.OntblVariableChanged(EventArgs.Empty);
 }
Example #12
0
 public void Add(tblVariable item)
 {
     List.Add(item);
     this.OntblVariableChanged(EventArgs.Empty);
 }