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);
            }
        }
Example #2
0
        public ClsClock(DB.Timer Timer)
        {
            this.SetTimer(Timer);

            // Tickevent einrichten
            GlobalServerEvents.Timer_Tick += this.Timer_tick;
        }
Example #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();
            }
        }
Example #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);
        }
 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);
     }
 }