//Session _selectedSession = null; public LoginPersonDiscussionDlg(Session s) { InitializeComponent(); throw new NotSupportedException(); //_selectedSession = s; //DataContext = this; //lblVersion.Content = Utils2.VersionString(); ////SkinManager.ChangeSkin("GreenSkin.xaml", this.Assets); //SkinManager.ChangeSkin("Blue2Skin.xaml", this.Assets); ////load persons in session //_persons = new ObservableCollection<Person>(); //if (s == LoginSessionDlg.TestSession) //{ // //for Test Session add all persons // foreach (var p in DbCtx.Get().Person) // _persons.Add(p); //} //else //{ // //for all other sessions add users in selected session // foreach (var p in s.Person) // _persons.Add(p); //} }
StartReportingActivities(Topic topic, Discussion disc, Session session) { _topic = topic; _disc = disc; _session = session; var moder = DbCtx.Get().Person.Single(p => p.Name.StartsWith("moder")); _clienRt = new ClientRT(disc.Id, ConfigManager.ServiceServer, moder.Name, moder.Id, DeviceType.Wpf); _clienRt.onJoin += OnJoined; _hardReportTCS = new TaskCompletionSource<ReportCollector>(); _remoteScreenshotTCS = new TaskCompletionSource<Dictionary<int, byte[]>>(); Task.Factory.StartNew(async () => { while (_servicingPhotonClient) { _clienRt.Service(); await Utils.Delay(80); } }, TaskCreationOptions.LongRunning); return new Tuple<Task<Dictionary<int, byte[]>>, Task<ReportCollector>>( _remoteScreenshotTCS.Task, _hardReportTCS.Task); }
public ReportingActivitiesTasks StartReportingActivities(Topic topic, Discussion disc, Session session, DiscCtx ctx) { _topic = topic; _disc = disc; _session = session; var moder = ctx.Person.Single(p => p.Name.StartsWith("moder")); _clienRt = new ClientRT(disc.Id, ConfigManager.ServiceServer, moder.Name, moder.Id, DeviceType.Wpf); _clienRt.onJoin += OnJoined; _hardReportTCS = new TaskCompletionSource<ReportCollector>(); _remoteScreenshotTCS = new TaskCompletionSource<Dictionary<int, byte[]>>(); Task.Factory.StartNew(async () => { while (_servicingPhotonClient) { _clienRt.Service(); await Utils.Delay(40); } }); return new ReportingActivitiesTasks { ReportTask = _hardReportTCS.Task, ScreenshotsTask = _remoteScreenshotTCS.Task }; }
public ReportParameters(List<int> requiredUsers, Session session, Topic topic, Discussion discussion) { this.requiredUsers = requiredUsers; this.sessionTopicUsers = topic.Person.Select(pers => pers.Id).Intersect(requiredUsers); this.session = session; this.topic = topic; this.discussion = discussion; }
public static IEnumerable<Discussion> discussionsOfSession(Session s) { var sessionId = s.Id; var q = from d in DbCtx.Get().Discussion where d.GeneralSide.Any(gs0 => gs0.Person.Session.Id == sessionId) select d; return q; }
static List<Person> GetPersonsOfSession(Session session) { var persons = new List<Person>(); foreach (var person in session.Person) { if (persons.All(u => u.Id != person.Id)) persons.Add(person); } return persons; }
private void btnAdd_Click(object sender, RoutedEventArgs e) { var s = new Session(); s.Name = "<Session>"; s.EstimatedDateTime = DateTime.Now; s.EstimatedEndDateTime = DateTime.Now.Add(TimeSpan.FromHours(1)); s.EstimatedTimeSlot = (int) TimeSlot.Morning; Sessions.Add(s); PublicBoardCtx.Get().AddToSession(s); }
public void Run(Session session, Topic topic, Discussion discussion, Person person) { //tests //var ctx = new DiscCtx(ConfigManager.ConnStr); //var discussion = ctx.Discussion.First(); //var topic = discussion.Topic.First(); //var session = ctx.Session.FirstOrDefault(); //var pers = session.Person.First(); //start hard report var reportParameters = new ReportParameters(session.Person.Select(p => p.Id).ToList(), session, topic, discussion); var tcs = new TaskCompletionSource<ReportCollector>(); new ReportCollector(null, ReportGenerated, reportParameters, tcs, UISharedRTClient.Instance.clienRt); var pdfAsm = new Reporter.pdf.PdfAssembler2(discussion, topic, person, session, Utils.RandomFilePath(".pdf"), tcs.Task, RemoteFinalSceneScreenshot(topic.Id, discussion.Id)); pdfAsm.RunAsync().GetAwaiter().OnCompleted(() => { }); }
public PdfAssembler2(Discussion discussion, Topic topic, Person person, Session session, string PdfPathName, Task<ReportCollector> hardReportTask, Task<Dictionary<int, byte[]>> finalScene) { _discussion = discussion; _topic = topic; _PdfPathName = PdfPathName; _person = person; _session = session; _hardReportTask = hardReportTask; _finalScene = finalScene; if (topic == null) { MessageDlg.Show("Null topic"); } if (discussion == null) { MessageDlg.Show("Null discussion"); } }
public static IEnumerable<Tuple<Person,Person>> ParticipantsTuples(Topic topic, Session session) { var participants = Participants(topic, session); var res = new List<Tuple<Person, Person>>(); Person prev = null; foreach (var current in participants) { if (prev != null) { res.Add(new Tuple<Person, Person>(prev,current)); prev = null; } else prev = current; } if (prev != null) res.Add(new Tuple<Person, Person>(prev, null)); return res; }
private void btnOk_Click_1(object sender, RoutedEventArgs e) { if (lstSessions.SelectedItem == null || lstTopics.SelectedItem == null) { MessageDlg.Show("Please select session and topic to generate report"); return; } _session = lstSessions.SelectedItem as Session; _topic = lstTopics.SelectedItem as Topic; _users = new List<int>(); foreach (var pers in _session.Person) _users.Add(pers.Id); _reportParameters = new ReportParameters(Users, session, topic, lstDiscussions.SelectedItem as Discussion); Close(); }
public static IEnumerable<Person> Participants(Topic topic, Session session) { var topId = topic.Id; return session.Person.Where(p => p.Topic.Any(t => t.Id == topId)); }
//static bool NameUnique(string Name, Session session) //{ // var sessionId = session.Id; // DbCtx.DropContext(); // var outrunnerPerson = DbCtx.Get().Person.FirstOrDefault(p0=>p0.Name==Name && p0.Session != null && p0.Session.Id == sessionId); // return outrunnerPerson == null; //} private static bool placeAlreadyBusy(Session session, Seat seat) { var sessionId = session.Id; var seatId = seat.Id; DbCtx.DropContext(); var outrunnerPerson = DbCtx.Get().Person.FirstOrDefault(p0 => p0.Online && p0.Session != null && p0.Session.Id == sessionId && p0.Seat != null && p0.Seat.Id == seatId); //only if outrunner person exists and online, the place is busy return (outrunnerPerson != null); }
private static string SessionStr(Session s, Discussion d) { var tsConv = new TimeslotConverter(); return s.Name + " (" + s.EstimatedDateTime.ToString("D") + " " + (string) tsConv.Convert(s.EstimatedTimeSlot, null, null, null) + "), " + d.Subject; }
private void lstBxDiscussions_SelectionChanged(object sender, SelectionChangedEventArgs e) { SelectedSession = e.AddedItems[0] as Session; Close(); }
/// <summary> /// Create a new Session object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="estimatedDateTime">Initial value of the EstimatedDateTime property.</param> /// <param name="estimatedTimeSlot">Initial value of the EstimatedTimeSlot property.</param> /// <param name="estimatedEndDateTime">Initial value of the EstimatedEndDateTime property.</param> public static Session CreateSession(global::System.Int32 id, global::System.String name, global::System.DateTime estimatedDateTime, global::System.Int32 estimatedTimeSlot, global::System.DateTime estimatedEndDateTime) { Session session = new Session(); session.Id = id; session.Name = name; session.EstimatedDateTime = estimatedDateTime; session.EstimatedTimeSlot = estimatedTimeSlot; session.EstimatedEndDateTime = estimatedEndDateTime; return session; }
/// <summary> /// Deprecated Method for adding a new object to the Session EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSession(Session session) { base.AddObject("Session", session); }
//if given seat was not used in current session, and user takes the seat, new user is created in DB. //if user takes seat that was used in this session, then no new user is created. instead, the user //is recognized as the same user who took the seat in current session, though during second login user //enters name again (effectively changing name) private static Person RegisterOrLogin(string name, Discussion discussion, Session session, Seat seat) { //was the seat taken by some user? var sessionId = session.Id; var seatId = seat.Id; DbCtx.DropContext(); var outrunnerPerson = DbCtx.Get().Person.FirstOrDefault(p0 => p0.Session != null && p0.Session.Id == sessionId && p0.Seat != null && p0.Seat.Id == seatId); //the user already took the place, just change name if (outrunnerPerson != null) { outrunnerPerson.Name = name; //do we need general side ? var ctx = DbCtx.Get(); var previousGenSide = ctx.GeneralSide.FirstOrDefault(gs0 => gs0.Discussion.Id == discussion.Id && gs0.Person.Id == outrunnerPerson.Id); if (previousGenSide == null) { //the person takes part in this discussion first time, create general //side of the person in this discussion var disc = ctx.Discussion.FirstOrDefault(d0 => d0.Id == discussion.Id); outrunnerPerson.GeneralSide.Add( CreateGeneralSide( outrunnerPerson, disc, (int) SideCode.Neutral ) ); //assign person to all topics of selected discussion foreach (var topic in disc.Topic) outrunnerPerson.Topic.Add(topic); } DbCtx.Get().SaveChanges(); return outrunnerPerson; } else { //seat was not used in this session, create new user var ctx = DbCtx.Get(); var p = new Person(); p.Name = name; p.Session = ctx.Session.FirstOrDefault(s0 => s0.Id == session.Id); p.Seat = ctx.Seat.FirstOrDefault(s0 => s0.Id == seat.Id); var disc = ctx.Discussion.FirstOrDefault(d0 => d0.Id == discussion.Id); p.GeneralSide.Add(CreateGeneralSide(p, disc, (int) SideCode.Neutral)); //person inherits color of seat p.Color = p.Seat.Color; p.Email = "no-email"; //assign person to all topics of selected discussion foreach (var topic in disc.Topic) p.Topic.Add(topic); ctx.AddToPerson(p); DbCtx.Get().SaveChanges(); return p; } }