Пример #1
0
        static void PopQueueAddTelepromptUpdateGraduate(QueueDbContext q, TelepromptDbContext t, GraduateDbContext g)
        {
            // remove the top of the queue
            var itemTopQueue = q.Queue.OrderBy(m => m.Created).FirstOrDefault();

            if (itemTopQueue != null)
            {
                q.Remove(itemTopQueue);
                // save don't wait
                q.SaveChanges();

                // add to teleprompt
                var respectedTime = DateTime.Now.ToString();

                var teleprompt = new Teleprompt()
                {
                    GraduateId = itemTopQueue.GraduateId, Created = itemTopQueue.Created
                };
                t.Add(teleprompt);
                t.SaveChanges();

                var graduate = g.Graduate.FirstOrDefault(m => m.GraduateId == itemTopQueue.GraduateId);

                if (graduate != null)
                {
                    graduate.Status = 1;

                    g.Update(graduate);
                    g.SaveChanges();
                }
            }
        }
Пример #2
0
        static void DisplayTeleprompt(TelepromptDbContext t, string searchGraduateId)
        {
            var teleprompt = new Teleprompt()
            {
                GraduateId = searchGraduateId, Created = DateTime.Now
            };

            t.Add(teleprompt);
            t.SaveChanges();
        }