public ScheduleCollection CollectScheduleForScreenGroup(ScreenGroups group, DateTime datetime) { InitDB(); ScheduleCollection scheduleCollection = new ScheduleCollection(); scheduleCollection.LoadAll(); return scheduleCollection; }
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) { } }
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; }
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; }