Exemplo n.º 1
0
        public ActionResult Create([Bind(Include = "FrameId,Mode,Name,AccountId,Mailbox,ShowEvents")] Outlook outlook, Frame frame)
        {
            if (!string.IsNullOrWhiteSpace(outlook.Mailbox))
            {
                Match lnk = _emailRgx.Match(outlook.Mailbox);
                outlook.Mailbox = lnk.Success ? lnk.Value : "";
            }

            if (ModelState.IsValid)
            {
                outlook.Frame = frame;
                db.Outlooks.Add(outlook);
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
            }

            this.FillTemplatesSelectList(db, FrameTypes.Outlook, outlook.Frame.TemplateId);
            FillModesSelectList(outlook.Mode);
            FillAccountsSelectList(outlook.AccountId);

            outlook.Frame = frame;
            
            return View(outlook);
        }
Exemplo n.º 2
0
        public ActionResult Create(Video video, Frame frame)
        {
            video.Frame = frame;

            if (ModelState.IsValid)
            {
                if (video.SavedContentId.HasValue)
                {
                    Content content = db.Contents.Find(video.SavedContentId.Value);
                    video.Contents.Add(content);
                    db.Videos.Add(video);
                    db.SaveChanges();

                    return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
                }
                else
                {
                    TempData["_newVideo"] = video;
                    return RedirectToAction("Upload", "Video");
                }
            }

            this.FillTemplatesSelectList(db, FrameTypes.Video, video.Frame.TemplateId);
            FillVideosSelectList();

            return View(video);
        }
Exemplo n.º 3
0
        public ActionResult Create(Picture picture, Frame frame)
        {
            picture.Frame = frame;

            if (ModelState.IsValid)
            {
                if (picture.SavedContentId.HasValue)
                {
                    picture.ContentId = picture.SavedContentId.Value;
                    db.Pictures.Add(picture);
                    db.SaveChanges();

                    return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
                }
                else
                {
                    TempData["_newPicture"] = picture;
                    return RedirectToAction("Upload", "Picture");
                }
            }

            this.FillTemplatesSelectList(db, FrameTypes.Picture, picture.Frame.TemplateId);
            FillPicturesSelectList();
            FillModesSelectList();

            return View(picture);
        }
Exemplo n.º 4
0
 public Frame(Frame _fromFrame)
 {
     //this.FrameId = _fromFrame.FrameId;
     this.PanelId = _fromFrame.PanelId;
     this.Duration = _fromFrame.Duration;
     this.BeginsOn = _fromFrame.BeginsOn;
     this.EndsOn = _fromFrame.EndsOn;
     this.Sort = _fromFrame.Sort;
     //this.DateCreated = _fromFrame.DateCreated;
     //this.Version = _fromFrame.Version;
     this.TemplateId = _fromFrame.TemplateId;
     this.CacheInterval = _fromFrame.CacheInterval;
 }
Exemplo n.º 5
0
        public ActionResult Create([Bind(Include = "FrameId,Name,Content")] Html html, Frame frame)
        {
            if (ModelState.IsValid)
            {
                html.Frame = frame;
                db.Html.Add(html);
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
            }

            html.Frame = frame;

            this.FillTemplatesSelectList(db, FrameTypes.Html, frame.TemplateId);
            
            return View(html);
        }
Exemplo n.º 6
0
        public ActionResult Create(Memo memo, Frame frame)
        {
            if (ModelState.IsValid)
            {
                memo.Frame = frame;
                db.Memos.Add(memo);
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
            }

            memo.Frame = frame;

            this.FillTemplatesSelectList(db, FrameTypes.Memo, memo.Frame.TemplateId);

            return View(memo);
        }
Exemplo n.º 7
0
        public ActionResult Create(Weather weather, Frame frame)
        {
            if (ModelState.IsValid)
            {
                weather.Frame = frame;
                db.Weathers.Add(weather);
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
            }

            this.FillTemplatesSelectList(db, FrameTypes.Weather, weather.Frame.TemplateId);
            FillWeatherTypeSelectList();

            weather.Frame = frame;

            return View(weather);
        }
Exemplo n.º 8
0
        public ActionResult Create(Clock clock, Frame frame)
        {
            if (ModelState.IsValid)
            {
                clock.Frame = frame;
                db.Clocks.Add(clock);
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
            }

            this.FillTemplatesSelectList(db, FrameTypes.Clock, clock.Frame.TemplateId);
            this.FillSystemTimeZoneSelectList(clock.TimeZone);
            FillClockTypeSelectList();

            clock.Frame = frame;

            return View(clock);
        }
Exemplo n.º 9
0
        public ActionResult Create(Report report, Frame frame)
        {
            if (ModelState.IsValid)
            {
                report.Frame = frame;
                db.Reports.Add(report);
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
            }

            this.FillTemplatesSelectList(db, FrameTypes.Report, report.Frame.TemplateId);
            FillServersSelectList();
            FillModesSelectList();
            
            report.Frame = frame;
            
            return View(report);
        }
Exemplo n.º 10
0
        public ActionResult Create([Bind(Include = "FrameId,Name,YoutubeId,Volume,AutoLoop,Aspect,Quality,Rate,Start")] Youtube youtube, Frame frame)
        {
            if (ModelState.IsValid)
            {
                Match lnk = _youTubeLink.Match(youtube.YoutubeId);
                if (lnk.Success) 
                    youtube.YoutubeId = lnk.Value;

                youtube.Frame = frame;
                db.Youtube.Add(youtube);
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
            }

            this.FillTemplatesSelectList(db, FrameTypes.YouTube, youtube.Frame.TemplateId);
            FillAspectsSelectList();
            FillQualitySelectList();
            FillRatesSelectList();

            youtube.Frame = frame;

            return View(youtube);
        }
Exemplo n.º 11
0
 public Outlook(Frame _fromFrame, DisplayMonkeyEntities db)
     : base(_fromFrame)
 {
     init(db);
 }
Exemplo n.º 12
0
        public ActionResult Edit(Weather weather, Frame frame)
        {
            if (ModelState.IsValid)
            {
                db.Entry(frame).State = EntityState.Modified;
                db.Entry(weather).State = EntityState.Modified;
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
            }

            this.FillTemplatesSelectList(db, FrameTypes.Weather, weather.Frame.TemplateId);
            FillWeatherTypeSelectList();

            weather.Frame = frame;

            return View(weather);
        }
Exemplo n.º 13
0
        public ActionResult Edit([Bind(Include="FrameId,Name,Content")] Html html, Frame frame)
        {
            if (ModelState.IsValid)
            {
                db.Entry(frame).State = EntityState.Modified;
                db.Entry(html).State = EntityState.Modified;
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
            }

            html.Frame = frame;

            this.FillTemplatesSelectList(db, FrameTypes.Html, html.Frame.TemplateId);
            
            return View(html);
        }
Exemplo n.º 14
0
 public Picture(Frame _fromFrame, DisplayMonkeyEntities db)
     : base(_fromFrame)
 {
     init(db);
 }
Exemplo n.º 15
0
        public ActionResult Edit(Video video, Frame frame)
        {
            if (ModelState.IsValid)
            {
                db.Entry(frame).State = EntityState.Modified;
                db.Entry(video).State = EntityState.Modified;
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
            }

            video.Frame = frame;

            this.FillTemplatesSelectList(db, FrameTypes.Video, video.Frame.TemplateId);

            return View(video);
        }
Exemplo n.º 16
0
        public ActionResult Upload(Video video, Frame frame, IEnumerable<HttpPostedFileBase> files)
        {
            video.Frame = frame;
            
            // TODO: EditorFor

            bool hasFiles = false, addedFiles = false;
            foreach (HttpPostedFileBase file in files)
            {
                if (file != null && file.ContentLength > 0)
                {
                    string ext = Path.GetExtension(file.FileName).Replace(".", "").ToUpper();
                    bool isVideo = Video.SupportedFormats.Contains(ext);

                    if (isVideo)
                    {
                        byte[] buffer = null;
                        using (BinaryReader reader = new BinaryReader(file.InputStream))
                        {
                            buffer = reader.ReadBytes(file.ContentLength);
                        }

                        Content content = new Content
                        {
                            Type = ContentTypes.ContentType_Video,
                            Name = Path.GetFileName(file.FileName),
                            Data = buffer,
                        };

                        video.Contents.Add(content);

                        addedFiles = true;
                    }

                    hasFiles = true;
                }
            }

            if (addedFiles)
            {
                db.Videos.Add(video);
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
            }

            else if (hasFiles)
            {
                // TODO: validator for wrong file types
            }

            this.FillTemplatesSelectList(db, FrameTypes.Video, video.Frame.TemplateId);
            FillVideosSelectList();
            ViewBag.MaxVideoSize = Setting.GetSetting(db, Setting.Keys.MaxVideoSize).IntValuePositive;

            return View(video);
        }
Exemplo n.º 17
0
 public Powerbi(Frame _fromFrame, DisplayMonkeyEntities db)
     : base(_fromFrame)
 {
     init(db);
 }
Exemplo n.º 18
0
        public ActionResult Edit(Picture picture, Frame frame)
        {
            if (ModelState.IsValid)
            {
                db.Entry(frame).State = EntityState.Modified;
                db.Entry(picture).State = EntityState.Modified;
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
            }

            this.FillTemplatesSelectList(db, FrameTypes.Picture, picture.Frame.TemplateId);
            FillPicturesSelectList(picture.ContentId);
            FillModesSelectList(picture.Mode);

            picture.Frame = frame;

            return View(picture);
        }
Exemplo n.º 19
0
        //
        // GET: /Frame/Create

        public ActionResult Create(int canvasId = 0, int panelId = 0, FrameTypes? frameType = null)
        {
            Panel panel = null;
            if (panelId != 0)
            {
                panel = db.Panels
                    .Include(p => p.Canvas)
                    .FirstOrDefault(p => p.PanelId == panelId)
                    ;

                if (panel == null)
                    panelId = 0;
            }
            
            if (frameType == null || panel == null)
            {
                if (canvasId == 0 && panel != null)
                    canvasId = panel.CanvasId;
                
                return RedirectToAction("ForFrameType", new { 
                    canvasId = canvasId, 
                    panelId = panelId, 
                    frameType = frameType
                });
            }

            TempData[SelectorFrameKey] = new Frame()
            {
                Panel = panel,
                PanelId = panelId,
                CacheInterval = 0,
            };

            return RedirectToAction("Create", frameType.ToString());
        }
Exemplo n.º 20
0
 public Memo(Frame _fromFrame, DisplayMonkeyEntities db)
     : base(_fromFrame)
 {
     init(db);
 }
Exemplo n.º 21
0
        public ActionResult Edit(Clock clock, Frame frame)
        {
            if (ModelState.IsValid)
            {
                db.Entry(frame).State = EntityState.Modified;
                db.Entry(clock).State = EntityState.Modified;
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
            }

            this.FillTemplatesSelectList(db, FrameTypes.Clock, clock.Frame.TemplateId);
            this.FillSystemTimeZoneSelectList(clock.TimeZone);
            FillClockTypeSelectList();

            clock.Frame = frame;

            return View(clock);
        }
Exemplo n.º 22
0
        public ActionResult Edit(Report report, Frame frame)
        {
            if (ModelState.IsValid)
            {
                db.Entry(frame).State = EntityState.Modified;
                db.Entry(report).State = EntityState.Modified;
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
            }

            this.FillTemplatesSelectList(db, FrameTypes.Report, report.Frame.TemplateId);
            FillServersSelectList(report.ServerId);
            FillModesSelectList(report.Mode);
            
            report.Frame = frame;
            
            return View(report);
        }
Exemplo n.º 23
0
 public Youtube(Frame _fromFrame, DisplayMonkeyEntities db)
     : base(_fromFrame)
 {
     init(db);
 }
Exemplo n.º 24
0
 public Weather(Frame _fromFrame, DisplayMonkeyEntities db)
     : base(_fromFrame)
 {
     init(db);
 }
Exemplo n.º 25
0
 private void FillTimingOptionsSelectList(Frame.TimingOptions? selected = null)
 {
     ViewBag.TimingOption = selected.TranslatedSelectList(valueAsText: false);
 }
Exemplo n.º 26
0
        public ActionResult Upload(Picture picture, Frame frame, HttpPostedFileBase file)
        {
            picture.Frame = frame;
            
            if (ModelState.IsValid && 
                file != null && 
                file.ContentLength > 0)
            {
                // TODO: EditorFor, validate file type

                string ext = Path.GetExtension(file.FileName).Replace(".", "").ToUpper();
                if (Picture.SupportedFormats.Contains(ext))
                {
                    byte[] buffer = null;
                    using (BinaryReader reader = new BinaryReader(file.InputStream))
                    {
                        buffer = reader.ReadBytes(file.ContentLength);
                    }

                    picture.Content = new Models.Content
                    {
                        Type = ContentTypes.ContentType_Picture,
                        Name = Path.GetFileName(file.FileName),
                        Data = buffer,
                    };

                    db.Pictures.Add(picture);
                    db.SaveChanges();

                    return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
                }
            }

            this.FillTemplatesSelectList(db, FrameTypes.Picture, picture.Frame.TemplateId);
            FillPicturesSelectList();
            FillModesSelectList();
            ViewBag.MaxImageSize = Setting.GetSetting(db, Setting.Keys.MaxImageSize).IntValuePositive;

            return View(picture);
        }