Beispiel #1
0
 public void Read_type()
 {
     this.PLC.ReadClass(this, this.DB, this.DBB);
     try
     {
         valves valve = this.rte.valves.Find(this.DB, this.DBB);
         {
             valve.Opened   = this.bOpened;
             valve.Closed   = this.bClosed;
             valve.Opening  = this.bOpening;
             valve.Closing  = this.bClosing;
             valve.Blocked  = this.bBlocked;
             valve.Serviced = this.bServiced;
             valve_log vl = new valve_log
             {
                 name   = this.name,
                 opened = this.bOpened,
                 closed = this.bClosed,
                 block  = this.bBlocked,
                 TIME   = System.DateTime.Now
             };
             rte.valve_log.Add(vl);
             this.rte.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.InnerException.ToString());
     }
 }
Beispiel #2
0
        public udtValve(Plc plc, int DB, int DBB, Real_Tag_Entitys rte, string name)
        {
            this.PLC  = plc;
            this.DB   = DB;
            this.DBB  = DBB;
            this.name = name;
            this.rte  = rte;
            if (this.rte.valves.Find(this.DB, this.DBB) == null)
            {
                try
                {
                    valves vValve = new valves
                    {
                        name = this.name,
                        DB   = this.DB,
                        DBB  = this.DBB,
                    };

                    this.rte.valves.Add(vValve);
                    this.rte.SaveChanges();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.InnerException.ToString());
                }
            }
        }