Esempio n. 1
0
        public ActionResult Edit([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;
                }

                db.Entry(frame).State   = EntityState.Modified;
                db.Entry(youtube).State = EntityState.Modified;
                db.SaveChanges();

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

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

            youtube.Frame = frame;

            return(View(youtube));
        }
Esempio n. 2
0
        public ActionResult Edit([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 : null;
            }

            if (ModelState.IsValid)
            {
                db.Entry(frame).State   = EntityState.Modified;
                db.Entry(outlook).State = EntityState.Modified;
                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));
        }
        public ActionResult Edit(Location location)
        {
            if (ModelState.IsValid)
            {
                // compute Woeid & GMT offset
                if (!location.Woeid.HasValue)
                {
                    location.Woeid = GetDefaultWoeid(location.Latitude, location.Longitude);
                }
                if (location.TimeZone == null)
                {
                    location.TimeZone = TimeZoneInfo.Local.Id; // GetDefaultTimeZone(location.Latitude, location.Longitude);
                }
                db.Entry(location).State = EntityState.Modified;
                db.Entry(location).Property(l => l.LevelId).IsModified = false;
                db.Entry(location).Property(l => l.AreaId).IsModified  = false;
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            //FillLevelsSelectList(location.LevelId);
            FillTemperatureUnitSelectList(location.TemperatureUnit);
            //FillAreaSelectList(location.LocationId, location.AreaId);
            FillCulturesSelectList(location.Culture);
            this.FillSystemTimeZoneSelectList(location.TimeZone);

            return(View(location));
        }
Esempio n. 4
0
 public ActionResult Edit(ReportServer reportserver)
 {
     if (ModelState.IsValid)
     {
         db.Entry(reportserver).State = EntityState.Modified;
         db.Entry(reportserver).Property(l => l.Password).IsModified = reportserver._passwordSet;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(reportserver));
 }
Esempio n. 5
0
        public ActionResult Edit(Canvas canvas)
        {
            if (ModelState.IsValid)
            {
                db.Entry(canvas).State = EntityState.Modified;
                db.SaveChanges();

                return(this.RestoreReferrer() ?? RedirectToAction("Index"));
            }
            fillSelectBackgroundImage(canvas.BackgroundImage);
            return(View(canvas));
        }
Esempio n. 6
0
        public ActionResult Edit(Panel panel)
        {
            if (ModelState.IsValid)
            {
                db.Entry(panel).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            return(View(panel));
        }
Esempio n. 7
0
        public ActionResult Edit(Outlook outlook)
        {
            if (!string.IsNullOrWhiteSpace(outlook.Mailbox))
            {
                Match lnk = _emailRgx.Match(outlook.Mailbox);
                outlook.Mailbox = lnk.Success ? lnk.Value : null;
            }

            if (ModelState.IsValid)
            {
                db.Entry(outlook).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index", "Frame"));
            }

            this.FillPanelsSelectList(db, outlook.Panel.CanvasId, outlook.PanelId);
            this.FillTemplatesSelectList(db, FrameTypes.Outlook, outlook.TemplateId);
            FillModesSelectList(outlook.Mode);
            FillAccountsSelectList(outlook.AccountId);
            FillPrivacySelectList(outlook.Privacy);


            return(View(outlook));
        }
        public ActionResult Edit(Youtube youtube)
        {
            if (ModelState.IsValid)
            {
                Match lnk = _youTubeLink.Match(youtube.YoutubeId);
                if (lnk.Success)
                {
                    youtube.YoutubeId = lnk.Value;
                }

                db.Entry(youtube).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index", "Frame"));
            }

            this.FillPanelsSelectList(db, youtube.Panel.CanvasId, youtube.PanelId);
            this.FillTemplatesSelectList(db, FrameTypes.YouTube, youtube.TemplateId);
            FillAspectsSelectList(youtube.Aspect);
            FillQualitySelectList();
            FillRatesSelectList();


            return(View(youtube));
        }
Esempio n. 9
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));
        }
Esempio n. 10
0
        public ActionResult Edit(Memo memo, Frame frame)
        {
            if (ModelState.IsValid)
            {
                db.Entry(frame).State = EntityState.Modified;
                db.Entry(memo).State  = EntityState.Modified;
                db.SaveChanges();

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

            memo.Frame = frame;

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

            return(View(memo));
        }
        public ActionResult Edit(Powerbi powerbi)
        {
            if (ModelState.IsValid)
            {
                db.Entry(powerbi).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index", "Frame"));
            }

            this.FillTemplatesSelectList(db, FrameTypes.Powerbi, powerbi.TemplateId);
            FillTypesSelectList(powerbi.Type);
            FillAccountsSelectList(powerbi.AccountId);


            return(View(powerbi));
        }
Esempio 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));
        }
        public ActionResult Edit(ReportServer reportserver)
        {
            if (!reportserver.PasswordSet)
            {
                ModelState.AddModelError("PasswordUnmasked", Resources.ProvideAccountPassword);
            }

            reportserver.UpdatePassword(db);

            if (ModelState.IsValid)
            {
                db.Entry(reportserver).State = EntityState.Modified;
                db.Entry(reportserver).Property(l => l.Password).IsModified = reportserver.PasswordSet;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(reportserver));
        }
Esempio n. 14
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));
        }
Esempio n. 15
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));
        }
Esempio n. 16
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));
        }
Esempio n. 17
0
        private async Task GetTokenAsync(AzureAccount az)
        {
            try
            {
                Match lnk = _emailRgx.Match(az.User);
                az.User = lnk.Success ? lnk.Value : "";

                if (!az.PasswordSet)
                {
                    throw new ApplicationException(Resources.ProvideAccountPassword);
                }

                az.UpdatePassword(db);

                TokenInfo ti = await Token.GetGrantTypePasswordAsync(
                    az.Resource,
                    az.ClientId,
                    az.ClientSecret,
                    az.User,
                    Setting.GetEncryptor(db).Decrypt(az.Password),
                    az.TenantId
                    );

                az.RefreshToken = ti.RefreshToken;
                az.AccessToken  = ti.AccessToken;
                az.ExpiresOn    = ti.ExpiresOn;
                az.IdToken      = ti.IdToken;

                db.Entry(az).State = EntityState.Modified;
                //var errors = ModelState.Values.SelectMany(v => v.Errors).ToArray();
            }

            catch (AzureTokenException ex)
            {
                ModelState.AddModelError("User", ex.Details);
            }

            catch (ApplicationException ex)
            {
                ModelState.AddModelError("PasswordUnmasked", ex.Message);
            }
        }
Esempio n. 18
0
        public ActionResult Edit(Level level)
        {
            if (ModelState.IsValid)
            {
                db.Entry(level).State = EntityState.Modified;
                db.SaveChanges();

                return(this.RestoreReferrer() ?? RedirectToAction("Index"));
            }
            return(View(level));
        }
        public ActionResult Edit([Bind(Include = "AccountId,Name,Account,PasswordUnmasked,Url,EwsVersion")] ExchangeAccount ews)
        {
            Match lnk = _emailRgx.Match(ews.Account);

            ews.Account = lnk.Success ? lnk.Value : "";

            resolveAccount(ews);

            if (ModelState.IsValid)
            {
                db.Entry(ews).State = EntityState.Modified;
                db.Entry(ews).Property(l => l.Password).IsModified = ews._passwordSet;
                //db.Entry(ews).Property(l => l.Url).IsModified = false;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            FillVersionsSelectList(ews.EwsVersion);
            return(View(ews));
        }
Esempio n. 20
0
        public ActionResult Edit([Bind(Include = "TemplateId,Name,Html,FrameType,Version")] Template template)
        {
            if (ModelState.IsValid)
            {
                db.Entry(template).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            FillFrameTypesSelectList(template.FrameType);
            return(View(template));
        }
        public ActionResult Edit([Bind(Include = "AccountId,Name,Provider,AppId,ClientId,ClientSecret")] OauthAccount account)
        {
            if (ModelState.IsValid)
            {
                db.Entry(account).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            FillProviders(account.Provider);
            return(View(account));
        }
        public ActionResult Edit(Setting setting)
        {
            if (ModelState.IsValid)
            {
                db.Settings.Attach(setting);
                db.Entry(setting).Property(p => p.RawValue).IsModified = true;
                db.SaveChanges();

                return(this.RestoreReferrer() ?? RedirectToAction("Index"));
            }
            return(View(setting));
        }
Esempio n. 23
0
        public ActionResult Edit(Content content)
        {
            if (ModelState.IsValid)
            {
                content.Data = new byte[] { 0 };    // trick EF, this is a required field
                db.Contents.Attach(content);
                db.Entry(content).Property(m => m.Name).IsModified = true;
                db.SaveChanges();

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

            return(View(content));
        }
        public ActionResult Edit(Html html)
        {
            if (ModelState.IsValid)
            {
                db.Entry(html).State = EntityState.Modified;
                db.SaveChanges();

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


            this.FillTemplatesSelectList(db, FrameTypes.Html, html.TemplateId);

            return(View(html));
        }
Esempio n. 25
0
        public ActionResult Edit(Memo memo)
        {
            if (ModelState.IsValid)
            {
                db.Entry(memo).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index", "Frame"));
            }

            this.FillPanelsSelectList(db, memo.Panel.CanvasId, memo.PanelId);
            this.FillTemplatesSelectList(db, FrameTypes.Memo, memo.TemplateId);

            return(View(memo));
        }
Esempio n. 26
0
        public ActionResult Edit(Display display)
        {
            if (ModelState.IsValid)
            {
                db.Entry(display).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            FillCanvasSelectList(display.CanvasId);
            FillLocationSelectList(display.LocationId);

            return(View(display));
        }
Esempio n. 27
0
        public ActionResult Edit(Video video)
        {
            if (ModelState.IsValid)
            {
                db.Entry(video).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index", "Frame"));
            }


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

            return(View(video));
        }
        public ActionResult Edit(Weather weather)
        {
            if (ModelState.IsValid)
            {
                db.Entry(weather).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index", "Frame"));
            }

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

            return(View(weather));
        }
Esempio n. 29
0
        public ActionResult Edit(Picture picture)
        {
            if (ModelState.IsValid)
            {
                db.Entry(picture).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index", "Frame"));
            }

            this.FillPanelsSelectList(db, picture.Panel.CanvasId, picture.PanelId);
            this.FillTemplatesSelectList(db, FrameTypes.Picture, picture.TemplateId);
            FillPicturesSelectList(picture.ContentId);
            FillModesSelectList(picture.Mode);


            return(View(picture));
        }
        public ActionResult Edit(Report report)
        {
            if (ModelState.IsValid)
            {
                db.Entry(report).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index", "Frame"));
            }

            this.FillPanelsSelectList(db, report.Panel.CanvasId, report.PanelId);
            this.FillTemplatesSelectList(db, FrameTypes.Report, report.TemplateId);
            FillServersSelectList(report.ServerId);
            FillModesSelectList(report.Mode);


            return(View(report));
        }