Пример #1
0
 public ScheduleCollection CollectScheduleForScreenGroup(ScreenGroups group, DateTime datetime)
 {
     InitDB();
     ScheduleCollection scheduleCollection = new ScheduleCollection();
     scheduleCollection.LoadAll();
     return scheduleCollection;
 }
Пример #2
0
 public ScheduleCollection CollectScheduleForScreen()
 {
     InitDB();
     ScheduleCollection scheduleToReturn = new ScheduleCollection();
     scheduleToReturn.LoadAll();
     ScreenCollection sc = new ScreenCollection();
     sc.LoadAll();
     Console.WriteLine("LICENSING: " + sc.Count().ToString() + " OF 10 LICENSES ACTIVE");
     return scheduleToReturn;
 }
Пример #3
0
        public User VerifyLogin(string login, string passwd)
        {
            InitDB();

            //Purge Schedules older than 7 days from current day5
            try
            {
                DateTime dtNow = DateTime.Now;
                DateTime ts = dtNow.AddDays(-7);

                var sc = new ScheduleCollection();
                sc.Query.Where(sc.Query.Loopend.LessThan(ts));
                sc.LoadAll();
                sc.MarkAllAsDeleted();
                sc.Save();
            }
            catch (Exception ex)
            {
                Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+ex.Message);
            }

            //Purge all schedules on finding deleteschedule.txt
            if (File.Exists(@"c:\content\deleteschedule.txt") || File.Exists(@"c:\content\deleteschedule.txt.txt"))
            {
                CoreHost.Properties.Settings.Default.DefaultPort = "null";
                try
                {
                    File.Delete(@"c:\content\deleteschedule.txt");
                }
                catch (Exception ex)
                {
                }
                try
                {
                    File.Delete(@"c:\content\deleteschedule.txt.txt");
                }
                catch (Exception ex)
                {
                }
                Console.WriteLine(DateTime.Now.ToShortTimeString() + "  " + " -- Schedule Purge Requested --");
                ScheduleCollection sc = new ScheduleCollection();
                sc.LoadAll();
                sc.MarkAllAsDeleted();
                sc.Save();
                Console.WriteLine(DateTime.Now.ToShortTimeString() + "  " + " -- Schedules Purged OK --");
            }

            User _verifieduser = new User();
            Boolean Verified = false;
            UserCollection _usr = new UserCollection();
            _usr.LoadAll();
            foreach (User item in _usr)
            {
                if (!Verified) _verifieduser = item;
                if (item.Password == passwd && item.Loginid == login)
                {
                    Verified = true;
                }
            }
            if (Verified == true)
            {
                Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+DateTime.Now.ToString() + "Login OK");
                return _verifieduser;
            }
            else
            {
                Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+DateTime.Now.ToString()+" :Failed Login Attempt");
                try
                {
                    User _newuser = new User();
                    _newuser.Id = 99999;
                    _newuser.Fullname = "failed";
                    _newuser.Loginid = "sys";
                    _newuser.Password = "******";
                    _newuser.Groupid = "sys";
                    //_newuser.Save();
                    Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+DateTime.Now.ToString()+" :"+_newuser.Fullname + " - Failed Login Attempt");
                    return _newuser;
                }
                catch (Exception ex)
                {
                   // Console.Write(ex.Message);
                }
            }
            return null;
        }
Пример #4
0
        private void SerializeScheduleCollection()
        {
            string FileName = @"c:\content\media\xml\schedule.xml";
            ScheduleCollection sc = new ScheduleCollection();
            sc.LoadAll();
            Schedule[] arrayOfSchedule = sc.ToArray();

            try
            {
                using (FileStream fs = new FileStream(FileName, FileMode.Create))
                {
                    XmlSerializer ser = new XmlSerializer(typeof(Schedule[]));
                    ser.Serialize(fs, arrayOfSchedule);
                    fs.Flush();
                    fs.Close();
                }
            }
            catch (Exception ex)
            {
            }
        }
Пример #5
0
        public Boolean UpdateScheduleForScreens(ScheduleCollection scheduleCollection)
        {
            InitDB();
            try
            {
                ScheduleCollection currentSchedule = new ScheduleCollection();
                ScheduleCollection newSchedule = new ScheduleCollection();
                //currentSchedule.LoadAll();

                currentSchedule.Query.Where(currentSchedule.Query.Screenname.NotEqual(""));
                currentSchedule.Query.Load();

                if (scheduleCollection.Count > 0) currentSchedule.MarkAllAsDeleted();
                currentSchedule.Save();

                foreach (Schedule schedule in scheduleCollection)
                {
                    Schedule newSch = new Schedule();
                    newSch.Loopname = schedule.Loopname;
                    newSch.Screenname = schedule.Screenname;
                    newSch.Groupname = schedule.Groupname;
                    newSch.Loopstart = schedule.Loopstart;
                    newSch.Loopend = schedule.Loopend;
                    newSchedule.Add(newSch);
                }

                newSchedule.Save();
                SerializeScheduleCollection();
                SerializeLoopCollection();
                SerializeLoopContentCollection();
                SerializeContentCollection();
                SerializeTemplateCollection();
                AddUpdateDelta("schedule");
            }
            catch (Exception ex)
            {
            }

            return true;
        }