コード例 #1
0
        public static void SaveTimer(DB.Timer timer)
        {
            try
            {
                DB.Timer te;

                using (fsbDB FSBDB = new fsbDB())
                {
                    te = (from x in FSBDB.Timer
                          where x.ID == timer.ID
                          select x).FirstOrDefault();

                    foreach (PropertyInfo pi in timer.GetType().GetProperties())
                    {
                        if (pi.CanWrite)
                        {
                            pi.SetValue(te, pi.GetValue(timer, null), null);
                        }
                    }

                    FSBDB.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
        }
コード例 #2
0
        public ClsClock(DB.Timer Timer)
        {
            this.SetTimer(Timer);

            // Tickevent einrichten
            GlobalServerEvents.Timer_Tick += this.Timer_tick;
        }
コード例 #3
0
        public void ZeitReset()
        {
            if (!this.myStatus)
            {
                DB.Timer t = ClsTimerControler.Timer((int)this.myTimer.ID);
                this.SetTimer(t);

                this.myTimerValue = this.myTimer.StartSekunden;
                this.SetVariable(this.myTimerValue);

                // Zeitereignisse lesen
                this.ReadTimerEvents();
            }
        }
コード例 #4
0
        public void SetTimer(DB.Timer Timer)
        {
            this.myID            = Timer.Nr;
            this.myStatus        = false;
            this.myTimer         = Timer;
            this.myTimerValue    = Timer.StartSekunden;
            this.myDynVisibility = Timer.DisplayDynamisch;
            this.myVar           = Timer.Variable;
            this.myClockName     = Timer.Name;

            // Zeitereignisse lesen
            this.ReadTimerEvents();

            // set Variables
            this.SetVariable(this.myTimer.StartSekunden);
        }
コード例 #5
0
 public static int AddTimer(DB.Timer timer)
 {
     try
     {
         using (fsbDB FSBDB = new fsbDB())
         {
             long newID = (from x in FSBDB.Timer select x.ID).DefaultIfEmpty(0).Max() + 1;
             timer.ID = newID;
             FSBDB.Timer.Add(timer);
             FSBDB.SaveChanges();
             return((int)timer.ID);
         }
     }
     catch (Exception ex)
     {
         ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex);
         return(0);
     }
 }