Beispiel #1
0
        public async Task <IActionResult> Puttemplates([FromRoute] int id, [FromBody] templates templates)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != templates.id)
            {
                return(BadRequest());
            }

            _context.Entry(templates).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!templatesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("TemplateID,PicID")] templates templates)
        {
            if (id != templates.TemplateID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(templates);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!templatesExists(templates.TemplateID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PicID"] = new SelectList(_context.pictures, "PicID", "StoragePath", templates.PicID);
            return(View(templates));
        }
Beispiel #3
0
 public ActionResult Edit([Bind(Include = "ID,title,isdefault,admin,address")] templates template)
 {
     //TODO: This action need to be deeply reviewed
     if (ModelState.IsValid)
     {
         db.Entry(template).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(template));
 }
Beispiel #4
0
        public async Task <IActionResult> Posttemplates([FromBody] templates templates)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.templates.Add(templates);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Gettemplates", new { id = templates.id }, templates));
        }
Beispiel #5
0
        public async Task <IActionResult> Create([Bind("TemplateID,PicID")] templates templates)
        {
            if (ModelState.IsValid)
            {
                _context.Add(templates);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PicID"] = new SelectList(_context.pictures, "PicID", "StoragePath", templates.PicID);
            return(View(templates));
        }
Beispiel #6
0
        public ActionResult Create([Bind(Include = "ID,title,isdefault,admin,address")] templates template)
        {
            //1. Convert the entry to Db Model
            if (ModelState.IsValid == true)
            {
                //TODO: This action need to be deeply reviewed
                db.templates.Add(template);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(template));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["event_id"] != null)
            {
                settings _settings = new settings();
                schedInterface.terminals _terminals = new terminals();
                schedInterface.templates _templates = new templates();

                fnsignUrl = _settings.site_url();

                Terminal t = _terminals.single(Convert.ToInt32(Session["event_id"]),
                                               Convert.ToInt32(Page.RouteData.Values["id"]));

                if (t.template_id > 0)
                {
                    Template temp = _templates.single(Convert.ToInt32(t.template_id));

                    bgimage = temp.bgimage;
                    video   = bgimage;

                    if (temp.video)
                    {
                        video_bg.Visible = true;

                        bgimage = null;
                    }

                    template_id.Value = temp.id.ToString();
                    terminal_id.Value = t.id.ToString();
                }
            }
            else
            {
                Response.Redirect("/login");
            }
        }
Beispiel #8
0
        // REV 1 - COMPLETE 10.19.15 @ 12:26AM

        static void Main(string[] args)
        {
            events    _events    = new events();
            twitter   _twitter   = new twitter();
            templates _templates = new templates();
            terminals _terminals = new terminals();

            Console.WriteLine("######### BEGIN FNSIGN UPDATER v.1.0 #########");

            Console.WriteLine("");

            Console.WriteLine("######### GETTING EVENTS THAT NEED TO BE UPDATED #########");

            Console.WriteLine("");

            List <Event> evs = _events.need_updating();

            Console.WriteLine(evs.Count.ToString() + " need updating....");

            Console.WriteLine("");

            sessions _sessions = new sessions();

            foreach (Event e in evs)
            {
                Console.WriteLine("Finding Sessions for " + e.title);
                Console.WriteLine("");

                if (!string.IsNullOrEmpty(e.url))
                {
                    List <Session> sess = _sessions.all(e.url, e.api_key);

                    Console.WriteLine(sess.Count.ToString() + " Sessions Found...");

                    Console.WriteLine("");

                    // look for deletions
                    List <Session> dbsess = _sessions.by_event(e.id);

                    foreach (Session d in dbsess)
                    {
                        List <Session> found = sess.Where(x => x.event_key == d.event_key).ToList();

                        if (found.Count == 0)
                        {
                            // remove the session
                            Console.WriteLine("Session ID: " + d.id + " NOT FOUND");

                            Console.WriteLine("Removing Session: " + d.name + "...");


                            _sessions.delete(d.internal_id);
                        }
                        else
                        {
                            Console.WriteLine("Session ID: " + d.id + " FOUND");
                        }
                    }

                    foreach (Session s in sess)
                    {
                        // now we loop through the sessions and insert or update them
                        if (s.event_type != "Japanese Language")
                        {
                            _sessions.add(s, e.id);
                        }
                    }

                    _sessions.clean_summit();
                }

                Console.WriteLine("");

                Console.WriteLine("Finding Tweets for Global Event Tag...");

                Console.WriteLine("");

                if (!string.IsNullOrEmpty(e.t_username))
                {
                    Console.WriteLine("Finding Tweets for @" + e.t_username);
                    Console.WriteLine("");

                    _twitter.fetch(e.t_username, 50, true, e.id, 0);
                }

                if (e.hashtags != null)
                {
                    foreach (string h in e.hashtags)
                    {
                        Console.WriteLine("Finding Tweets for #" + h);
                        Console.WriteLine("");

                        _twitter.fetch(h, 50, e.id, 0);
                    }
                }

                Console.WriteLine("Now let's check for the templates associated with " + e.title);
                Console.WriteLine("");

                foreach (Template t in _templates.all_by_event(e.id))
                {
                    if (!string.IsNullOrEmpty(t.t_username))
                    {
                        Console.WriteLine("Fetching Twitter records for @" + t.t_username);
                        Console.WriteLine("");

                        _twitter.fetch(t.t_username, 50, true, e.id, t.id);
                    }

                    if (t.hashtags != null)
                    {
                        Console.WriteLine("Fetching Records for Hashtags...");
                        Console.WriteLine("");

                        foreach (string h in t.hashtags)
                        {
                            Console.WriteLine("Fetching tweets for #" + h);
                            Console.WriteLine("");

                            _twitter.fetch(h, 50, e.id, t.id);
                        }
                    }
                }

                Console.WriteLine("");

                Console.WriteLine("Updating Event Last Updated Time...");

                _events.update(e);

                Console.WriteLine("Complete...");

                Console.WriteLine("Moving to next event...");
                Console.WriteLine("");

                // here we need to update the last update time
            }

            Console.WriteLine("Check for Offline Terminals...");
            Console.WriteLine("");

            List <Terminal> terms = _terminals.offline_terminals();

            if (terms.Count() > 0)
            {
                Console.WriteLine(terms.Count() + " Offline, updating their status...");
                Console.WriteLine("");

                foreach (Terminal t in terms)
                {
                    Console.WriteLine("Taking " + t.title + " Offline");
                    Console.WriteLine("");

                    _terminals.offline(t.id);
                }
            }
            else
            {
                Console.WriteLine("All Terminals are Online...");
                Console.WriteLine("");
            }

            Console.WriteLine("######### FNSIGN v.1.0 UPDATER COMPLETE #########");
        }
Beispiel #9
0
        private static void Main(string[] args)
        {
            events    events    = new events();
            twitter   twitter   = new twitter();
            templates templates = new templates();
            terminals terminals = new terminals();

            Console.WriteLine("######### BEGIN FNSIGN UPDATER v.1.0 #########");
            Console.WriteLine("");
            Console.WriteLine("######### GETTING EVENTS THAT NEED TO BE UPDATED #########");
            Console.WriteLine("");
            List <Event> eventList = events.need_updating()
                                     .Where <Event>((Func <Event, bool>)(x => !string.IsNullOrEmpty(x.api_key) && !string.IsNullOrEmpty(x.url)))
                                     .ToList <Event>();

            Console.WriteLine(eventList.Count.ToString() + " need updating....");
            Console.WriteLine("");
            sessions sessions = new sessions();

            foreach (Event ev in eventList)
            {
                Console.WriteLine("Finding Sessions for " + ev.title);
                Console.WriteLine("");
                List <Session> sessionList = sessions.getSessionsFromAPI(ev.url, ev.api_key, ev.api_type);
                Console.WriteLine(sessionList.Count.ToString() + " Sessions Found...");
                Console.WriteLine("");
                foreach (Session s in sessionList)
                {
                    sessions.add(s, ev.id);
                }

                //Remove those sessions which stopped coming from api
                IList <string> incomingSessionIds       = sessionList.Select(x => x.event_key).ToList();
                List <Session> notComingAnymoreSessions = sessions.by_event(ev.id).Where(x => !incomingSessionIds.Contains(x.event_key)).ToList <Session>();
                foreach (var item in notComingAnymoreSessions)
                {
                    sessions.delete(int.Parse(item.id));
                }

                Console.WriteLine("");
                Console.WriteLine("Finding Tweets for Global Event Tag...");
                Console.WriteLine("");
                if (!string.IsNullOrEmpty(ev.t_username))
                {
                    Console.WriteLine("Finding Tweets for @" + ev.t_username);
                    Console.WriteLine("");
                    twitter.fetch(ev.t_username, 50, true, ev.id, 0);
                }
                if (ev.hashtags != null)
                {
                    foreach (string hashtag in ev.hashtags)
                    {
                        Console.WriteLine("Finding Tweets for #" + hashtag);
                        Console.WriteLine("");
                        twitter.fetch(hashtag, 50, ev.id, 0);
                    }
                }
                Console.WriteLine("Now let's check for the templates associated with " + ev.title);
                Console.WriteLine("");
                foreach (Template template in templates.all_by_event(ev.id))
                {
                    if (!string.IsNullOrEmpty(template.t_username))
                    {
                        Console.WriteLine("Fetching Twitter records for @" + template.t_username);
                        Console.WriteLine("");
                        twitter.fetch(template.t_username, 50, true, ev.id, template.id);
                    }
                    if (template.hashtags != null)
                    {
                        Console.WriteLine("Fetching Records for Hashtags...");
                        Console.WriteLine("");
                        foreach (string hashtag in template.hashtags)
                        {
                            Console.WriteLine("Fetching tweets for #" + hashtag);
                            Console.WriteLine("");
                            twitter.fetch(hashtag, 50, ev.id, template.id);
                        }
                    }
                }
                Console.WriteLine("");
                Console.WriteLine("Updating Event Last Updated Time...");
                events.update(ev);
                Console.WriteLine("Complete...");
                Console.WriteLine("Moving to next event...");
                Console.WriteLine("");
            }
            Console.WriteLine("Check for Offline Terminals...");
            Console.WriteLine("");
            List <Terminal> source = terminals.offline_terminals();

            if (source.Count <Terminal>() > 0)
            {
                Console.WriteLine(source.Count <Terminal>().ToString() + " Offline, updating their status...");
                Console.WriteLine("");
                foreach (Terminal terminal in source)
                {
                    Console.WriteLine("Taking " + terminal.title + " Offline");
                    Console.WriteLine("");
                    terminals.offline(terminal.id);
                }
            }
            else
            {
                Console.WriteLine("All Terminals are Online...");
                Console.WriteLine("");
            }
            Console.WriteLine("######### FNSIGN v.1.0 UPDATER COMPLETE #########");
        }