Example #1
0
 public ActionResult Create([Bind(Include = "ID,Subject,Lang,Description,ProjectsViewModelID,ProjectDetailsViewModelID,EducationViewModelID,ExperiencesViewModelID,SkillsViewModelID,PicturesViewModelID")] DisplayViewModel displayViewModel, string selectedLang, string link_display_to)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var display = displayViewModel;
             addOrUpdateDisplayTable(display, selectedLang, link_display_to);
             db.Entry(display).State = EntityState.Added;
             db.SaveChanges();
         }
         catch (DbEntityValidationException dbEx)
         {
             ViewBag.ErrorMessage = retrievePropertiesErrors(dbEx);
             return(View("Error"));
         }
         catch (Exception ex)
         {
             Log.error(ex.Message);
             return(View("Error"));
         }
         return(RedirectToAction("Index"));
     }
     setSourceDropDownList(displayViewModel);
     return(View(displayViewModel));
 }
Example #2
0
        public async Task <IActionResult> Index(string slug)
        {
            if (slug == null)
            {
                return(Redirect("/tr/Giris"));
            }
            else
            {
                var model = new DisplayViewModel();

                // Getting the page with the slug that user entered
                var page = await _context.Pages
                           .Include(p => p.ParentPage).Include("Components.ComponentType").Include("Components.ChildComponents")
                           .Include(p => p.Components)
                           .ThenInclude(x => x.ParameterValues)
                           .ThenInclude(x => x.Parameter)
                           .FirstOrDefaultAsync(m => m.Slug.Equals(slug.ToLower()) && m.IsPublished == true);


                if (page == null)
                {
                    return(Content($"'{slug}' adresli bulunamadı!"));
                }
                else
                {
                    // Incrementing the ViewCount
                    page.ViewCount++;
                    _context.SaveChanges();
                    model.Page = page;
                    //ViewData["ComponentTypeId"] = new SelectList(_context.ComponentTypes, "Id", "DisplayName");
                    //ViewData["ParentComponentId"] = new SelectList(_context.Components, "Id", "DisplayName");
                    return(View(page.View, model));
                }
            }
        }
Example #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            DisplayViewModel display = db.Displays.Find(id);

            display.Education                 = null;
            display.EducationViewModelID      = null;
            display.ProjectDetail             = null;
            display.ProjectDetailsViewModelID = null;
            display.Experience                = null;
            display.ExperiencesViewModelID    = null;
            display.Skill               = null;
            display.SkillsViewModelID   = null;
            display.Project             = null;
            display.ProjectsViewModelID = null;

            try
            {
                db.Displays.Remove(display);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                Log.error(ex.Message);
                return(View("Error"));
            }

            return(RedirectToAction("Index"));
        }
        public IActionResult AssociatedTile(int?id, string imageName, int level, int col, int row)
        {
            logger.LogInformation("Getting tile of {slug} | lev: {level}, col: {col}, row: {row}", imageName, level, col, row);
            try
            {
                var slide = context.Slides.FirstOrDefault(m => m.Id == id);
                if (slide != null)
                {
                    using (var osr = new OpenSlide(slide.FilePath))
                    {
                        var associated = osr.AssociatedImages[imageName].ToImageSlide();
                        var viewModel  = new DisplayViewModel(slide.Name, slide.DziUrl, slide.Mpp, associated);
                        var tile       = viewModel.DeepZoomGenerator.GetTile(level, new SizeL(col, row));

                        using (var stream = new MemoryStream())
                        {
                            tile.Save(stream, ImageFormat.Jpeg);
                            tile.Dispose();
                            return(File(stream.ToArray(), "image/jpeg"));
                        }
                    }
                }
            }
            catch (OpenSlideException)
            {
                logger.LogError("Error while getting tile | lev: {level}, col: {col}, row: {row}", level, col, row);
                HttpContext.Session.SetString(SessionConstants.ALERT, SessionConstants.CANT_LOAD_DATA);
            }
            return(new FileContentResult(new byte[] { }, ""));
        }
        public virtual IActionResult Display(String id)
        {
            // Get the blog that is for this controller instance
            if (Current != null)
            {
                // Generate the view model to pass
                DisplayViewModel viewModel = new DisplayViewModel()
                {
                    Templates = Current.Templates.ContainsKey(BlogControllerView.Display) ?
                                Current.Templates[BlogControllerView.Display] : new BlogViewTemplates(),
                };
                viewModel.Item = Current.Get(
                    new BlogHeader()
                {
                    Id = Current.Parameters.Provider.DecodeId(id)
                }
                    );

                // Pass the view model back
                return(View(viewModel));
            }
            else
            {
                return(View(new DisplayViewModel()));
            }
        }
Example #6
0
        // GET: Slides/Display/5
        public async Task <IActionResult> Display(int?id)
        {
            logger.LogInformation("Getting slide {ID} to display...", id);
            if (id == null)
            {
                logger.LogWarning("Slide id was null");
                return(NotFound());
            }

            var slide = await context.Slides.FindAsync(id.Value);

            if (slide == null)
            {
                logger.LogError("GetById({ID}) NOT FOUND", id);
                return(NotFound());
            }

            HttpContext.Session.Set(SessionConstants.CURRENT_SLIDE, slide);
            ViewData[SLIDE_ID] = slide.Id.ToString();
            HttpContext.Session.SetString(SLIDE_ID, slide.Id.ToString());
            ViewData[SLIDE_NAME]            = slide.Name;
            ViewData[HAS_ASSOCIATED_IMAGES] = slide.HasAssociatedImages;
            var comments = context.Comments.Where(c => c.SlideId == id);

            ViewData[HAS_COMMENTS] = comments.Any();

            var osr       = new OpenSlide(slide.FilePath);
            var viewModel = new DisplayViewModel(slide.Name, slide.DziUrl, slide.Mpp, osr);

            return(View(viewModel));
        }
        public IActionResult Tile(string slug, int level, int col, int row)
        {
            try
            {
                logger.LogInformation("Getting tile: {level}, col: {col}, row: {row}", level, col, row);

                var slide = HttpContext.Session.Get <Slide>(SessionConstants.CURRENT_SLIDE) ?? context.Slides.FirstOrDefault(m => m.Url == slug);

                if (slide != null)
                {
                    using (var osr = new OpenSlide(slide.FilePath))
                    {
                        var viewModel = new DisplayViewModel(slide.Name, slide.DziUrl, slide.Mpp, osr);
                        var tile      = viewModel.DeepZoomGenerator.GetTile(level, new SizeL(col, row));

                        using (var stream = new MemoryStream())
                        {
                            tile.Save(stream, ImageFormat.Jpeg);
                            tile.Dispose();
                            return(File(stream.ToArray(), "image/jpeg"));
                        }
                    }
                }
            }
            catch (OpenSlideException)
            {
                logger.LogError("Error while getting tile lev: {level}, col: {col}, row: {row}", level, col, row);
                HttpContext.Session.SetString(SessionConstants.ALERT, SessionConstants.CANT_LOAD_DATA);
            }
            return(new FileContentResult(new byte[] { }, ""));
        }
Example #8
0
 public DisplayView(DisplayViewModel viewModel)
 {
     InitializeComponent();
     viewModel.HeaderText   = UiResources.Users;
     viewModel.EditViewType = typeof(EditView);
     this.DataContext       = viewModel;
 }
        public async Task <IActionResult> Index()
        {
            var result = await this.stockService.GetLastPriceAndTime(GlobalConstants.StockTicker);

            var userId         = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            var pricesAndTimes = await this.stockService.GetPricesLast300Minutes(GlobalConstants.StockTicker);

            var balance = await this.userService.GetUserBalanceAsync(userId);

            var accountId = await this.userService.GetUserAccountIdAsync(userId);

            var position = await this.accountService.GetCurrentPositionAsync(accountId);

            var currentProfit = position.Direction
                ? (decimal.Parse(result.Price) - position.OpenPrice) * position.Quantity
                : (position.OpenPrice - decimal.Parse(result.Price)) * position.Quantity;

            var output = new DisplayViewModel()
            {
                Ticker         = GlobalConstants.StockTicker,
                PricesAndTimes = pricesAndTimes,
                LastPrice      = result.Price,
                LastDateTime   = result.DateTime,
                Balance        = balance,
                CurrentProfit  = currentProfit,
                AccountId      = accountId,
                Position       = position,
            };

            return(this.View(output));
        }
        public ActionResult DisplayFullHD(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Referee referee = refereeService.GetById((int)id);

            if (referee == null)
            {
                return(HttpNotFound());
            }

            var currentFights = fightService.GetWithFilter(x => x.Category.Timelines.Any(s => s.LevelId == x.LevelId && s.RefereeId == id) && x.Fighters.Where(y => y.IsWinner).Count() == 0);

            var currentFight     = currentFights.FirstOrDefault();
            var nextFight        = currentFights.Skip(1).FirstOrDefault();
            var displayViewModel = new DisplayViewModel()
            {
                CurrentFight = currentFight, NextFight = nextFight
            };

            if (Request.IsAjaxRequest())
            {
                return(PartialView("_Display", displayViewModel));
            }
            return(View(displayViewModel));
        }
Example #11
0
        private SettingsViewModel()
        {
            this.ScreenshotSettings     = new ScreenshotSettingsViewModel().AddTo(this);
            this.WindowSettings         = new WindowSettingsViewModel().AddTo(this);
            this.NetworkSettings        = new NetworkSettingsViewModel().AddTo(this);
            this.UserStyleSheetSettings = new UserStyleSheetSettingsViewModel().AddTo(this);
            this.OptimizeSettings       = new Settings.OptimizeSettingsViewModel().AddTo(this);

            this.BrowserZoomFactor = new BrowserZoomFactor {
                Current = GeneralSettings.BrowserZoomFactor
            };
            this.BrowserZoomFactor
            .Subscribe(nameof(this.BrowserZoomFactor.Current), () => GeneralSettings.BrowserZoomFactor.Value = this.BrowserZoomFactor.Current)
            .AddTo(this);
            GeneralSettings.BrowserZoomFactor.Subscribe(x => this.BrowserZoomFactor.Current = x).AddTo(this);

            this.FlashQualityCollection = new List <DisplayViewModel <FlashQuality> >
            {
                DisplayViewModel.Create(FlashQuality.Low, "낮음"),
                DisplayViewModel.Create(FlashQuality.Medium, "중간"),
                DisplayViewModel.Create(FlashQuality.High, "높음"),
            };

            this.Cultures = new[] { new CultureViewModel {
                                        DisplayName = "(auto)"
                                    } }
            .Concat(ResourceService.Current.SupportedCultures
                    .Select(x => new CultureViewModel {
                DisplayName = x.EnglishName, Name = x.Name
            })
                    .OrderBy(x => x.DisplayName))
            .ToList();

            this.Libraries = ProductInfo.Libraries.Aggregate(
                new List <BindableTextViewModel>(),
                (list, lib) =>
            {
                list.Add(new BindableTextViewModel {
                    Text = list.Count == 0 ? "Build with " : ", "
                });
                list.Add(new HyperlinkViewModel {
                    Text = lib.Name.Replace(' ', Convert.ToChar(160)), Uri = lib.Url
                });
                // ☝プロダクト名の途中で改行されないように、space を non-break space に置き換えてあげてるんだからねっっ
                return(list);
            });

            this.ViewRangeSettingsCollection = ViewRangeCalcLogic.Logics.ToList();
            this.SelectedViewRangeCalcType   = this.ViewRangeSettingsCollection
                                               .FirstOrDefault(x => x.Id == KanColleSettings.ViewRangeCalcType)
                                               ?? this.ViewRangeSettingsCollection.First();

            this.LoadedPlugins = new List <PluginViewModel>(
                PluginService.Current.Plugins.Select(x => new PluginViewModel(x)));

            this.FailedPlugins = new List <LoadFailedPluginViewModel>(
                PluginService.Current.FailedPlugins.Select(x => new LoadFailedPluginViewModel(x)));
        }
Example #12
0
        public ActionResult Index(DisplayViewModel dvm, string id)
        {
            string val = id;

            Thread.CurrentThread.CurrentCulture   = new System.Globalization.CultureInfo(id);
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(id);
            rvm.Data = dvm.Data;
            return(View(rvm));
        }
Example #13
0
        //===============================

        private void setSourceDropDownList(DisplayViewModel display)
        {
            ViewBag.EducationViewModelID      = new SelectList(db.Education, "ID", "SchoolName", display.EducationViewModelID);
            ViewBag.ExperiencesViewModelID    = new SelectList(db.Experiences, "ID", "Title", display.ExperiencesViewModelID);
            ViewBag.ProjectsViewModelID       = new SelectList(db.Projects, "ID", "Title", display.ProjectsViewModelID);
            ViewBag.ProjectDetailsViewModelID = new SelectList(db.DetailsProject, "ID", "Subject", display.ProjectDetailsViewModelID);
            ViewBag.SkillsViewModelID         = new SelectList(db.Skills, "ID", "Title", display.SkillsViewModelID);
            ViewBag.PicturesViewModelID       = new SelectList(db.PicturesApp, "ID", "Subject", display.PicturesViewModelID);
        }
        public IActionResult Display(int ID)
        {
            DisplayViewModel model = new DisplayViewModel();

            model.myTeam    = _context.teams.SingleOrDefault(t => t.Id == ID);
            model.myPlayers = _context.athletes.Where(a => a.teamId == ID).ToList();
            model.myLeague  = _context.leagues.SingleOrDefault(l => l.Id == model.myTeam.leagueId);
            return(View(model));
        }
 public WindowSettingsViewModel()
 {
     this.ExitConfirmationTypes = new List <DisplayViewModel <ExitConfirmationType> >
     {
         DisplayViewModel.Create(ExitConfirmationType.None, "確認しない"),
         DisplayViewModel.Create(ExitConfirmationType.InSortieOnly, "出撃中のみ確認する"),
         DisplayViewModel.Create(ExitConfirmationType.Always, "常に確認する"),
     };
 }
Example #16
0
        public Entry(Input input, Output output)
        {
            Id     = Guid.NewGuid();
            Input  = input;
            Output = output;

            InputVM  = new DisplayViewModel(Input.Label, Input.Display);
            OutputVM = new DisplayViewModel(Output.Label, Output.Display);
        }
Example #17
0
        public ActionResult Display()
        {
            var model = new DisplayViewModel();

            model.Claims = ExampleMapper.ToClaimViewModelList(UserService.Identity.Claims.AsEnumerable());//MappingEngine.Map<IEnumerable<ClaimViewModel>>(UserService.Identity.Claims.AsEnumerable());



            return(View(model));
        }
Example #18
0
        public IActionResult Display(int id, DisplayViewModel model)
        {
            Report report = _data.Get(id);

            byte[] bytes = report.Content;

            model.html = _reportOps.ConvertToHTML(bytes);

            return(View(model));
        }
        public IActionResult Display()
        {
            var displayViewModel = new DisplayViewModel
            {
                Reports = _reportRepository.AllReports
            };


            return(View(displayViewModel));
        }
Example #20
0
        public IActionResult Display(string imageId)
        {
            ViewData["Message"] = "Uploaded Image";
            var actionModel = new DisplayViewModel
            {
                ImageUrl = _imageStore.ImageLink(imageId)
            };

            return(View(actionModel));
        }
Example #21
0
        public static DisplayViewModel Parse(site results)
        {
            if (results == null) return null;

            var viewModel = new DisplayViewModel();
            viewModel.DataObtainedAt = DateTime.Now;
            var test = results.observed.OrderByDescending(x => x.valid.Value).First();

            viewModel.WaterLevel = test.primary.Value;
            viewModel.WaterLevelUnit = test.primary.units;
            viewModel.WaterLevelWhen = TimeZoneInfo.ConvertTime(test.valid.Value, TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"));
            viewModel.WaterLevelWhenUtc = test.valid.Value;

            if (viewModel.WaterLevel >= 5 && viewModel.WaterLevel < 9)
            {
                viewModel.ActionLevel = WaterLevelAction.LifeJacket;
            }
            else if (viewModel.WaterLevel >= 9)
            {
                viewModel.ActionLevel = WaterLevelAction.Permit;
            }

            viewModel.Future = results.forecast.datum.ToDictionary(x => x.valid.Value, x => x.primary.Value);
            viewModel.Observed = results.observed.OrderBy(x => x.valid.Value).Where(x => x.valid.Value > DateTime.UtcNow.AddHours(-24)).ToDictionary(x => TimeZoneInfo.ConvertTime(x.valid.Value, TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")), x => x.primary.Value);

            if (results.forecast.datum.Any(x => results.sigstages.record.Value <= x.primary.Value))
                viewModel.FloodingCategoryForecast = FloodingCategoryForecast.Record;

            else if (results.forecast.datum.Any(x => results.sigstages.major.Value <= x.primary.Value))
                viewModel.FloodingCategoryForecast = FloodingCategoryForecast.Major;

            else if (results.forecast.datum.Any(x => results.sigstages.moderate.Value <= x.primary.Value))
                viewModel.FloodingCategoryForecast = FloodingCategoryForecast.Moderate;

            else if (results.forecast.datum.Any(x => results.sigstages.flood.Value <= x.primary.Value))
                viewModel.FloodingCategoryForecast = FloodingCategoryForecast.Flood;

            else if (results.forecast.datum.Any(x => results.sigstages.bankfull.Value <= x.primary.Value))
                viewModel.FloodingCategoryForecast = FloodingCategoryForecast.Bankful;

            else if (results.forecast.datum.Any(x => results.sigstages.action.Value <= x.primary.Value))
                viewModel.FloodingCategoryForecast = FloodingCategoryForecast.Action;

            //var p = Fit.Line(Array.ConvertAll(Enumerable.Range(0, results.observed.Count()).ToArray(), x => (double)x), results.observed.Select(x => (double)x.primary.Value).ToArray());

            var f = new Statistics().CalculateLinearRegression(results.observed.OrderBy(x => x.valid.Value).Where(x => x.valid.Value > DateTime.UtcNow.AddHours(-15)).Select(x => x.primary.Value).ToArray());
            if (f.Slope > .25)
                viewModel.Trend = WaterTrend.Rising;
            else if (f.Slope < -.25)
                viewModel.Trend = WaterTrend.Falling;
            else
                viewModel.Trend = WaterTrend.Steady;

            return viewModel;
        }
Example #22
0
 public JsonResult Edit(DisplayViewModel displayModel)
 {
     try
     {
         _genericService.Update(_mapper.Map <DisplayViewModel, DisplayDTO>(displayModel));
         return(Json(new { Result = "OK", Record = displayModel }));
     }
     catch (Exception ex)
     {
         return(Json(new { Result = "ERROR", Message = ex.Message }));
     }
 }
Example #23
0
 public JsonResult Delete(DisplayViewModel displayModel)
 {
     try
     {
         _genericService.Delete(displayModel.ID);
         return(Json(new { Result = "OK" }));
     }
     catch (Exception ex)
     {
         return(Json(new { Result = "ERROR", Message = ex.Message }));
     }
 }
        public IActionResult DisplayUser()
        {
            var displayViewModel = new DisplayViewModel
            {
                User        = User,
                UserManager = _userManager,

                Reports = _reportRepository.AllReports
            };


            return(View(displayViewModel));
        }
Example #25
0
 public JsonResult Create(DisplayViewModel displayModel)
 {
     try
     {
         var id = _genericService.Save(_mapper.Map <DisplayViewModel, DisplayDTO>(displayModel));
         displayModel.ID = id;
         return(Json(new { Result = "OK", Record = displayModel }));
     }
     catch (Exception ex)
     {
         return(Json(new { Result = "ERROR", Message = ex.Message }));
     }
 }
Example #26
0
 public WindowSettingsViewModel()
 {
     this.ExitConfirmationTypes = new List <DisplayViewModel <ExitConfirmationType> >
     {
         DisplayViewModel.Create(ExitConfirmationType.None, Resources.Settings_Window_ConfirmExit_Never),
         DisplayViewModel.Create(ExitConfirmationType.InSortieOnly, Resources.Settings_Window_ConfirmExit_InSortieOnly),
         DisplayViewModel.Create(ExitConfirmationType.Always, Resources.Settings_Window_ConfirmExit_Always),
     };
     this.TaskbarProgressFeatures = EnumerableEx
                                    .Return(GeneralSettings.TaskbarProgressSource.ToDefaultDisplay(Resources.TaskbarIndicator_DoNotUse))
                                    .Concat(TaskbarProgress.Features.ToDisplay(x => x.Id, x => x.DisplayName))
                                    .ToList();
 }
 public WindowSettingsViewModel()
 {
     this.ExitConfirmationTypes = new List <DisplayViewModel <ExitConfirmationType> >
     {
         DisplayViewModel.Create(ExitConfirmationType.None, "確認しない"),
         DisplayViewModel.Create(ExitConfirmationType.InSortieOnly, "出撃中のみ確認する"),
         DisplayViewModel.Create(ExitConfirmationType.Always, "常に確認する"),
     };
     this.TaskbarProgressFeatures = EnumerableEx
                                    .Return(GeneralSettings.TaskbarProgressSource.ToDefaultDisplay("使用しない"))
                                    .Concat(TaskbarProgress.Features.ToDisplay(x => x.Id, x => x.DisplayName))
                                    .ToList();
 }
Example #28
0
        // GET: Displays/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DisplayViewModel displayViewModel = db.Displays.Find(id);

            if (displayViewModel == null)
            {
                return(HttpNotFound());
            }
            return(View(displayViewModel));
        }
Example #29
0
        // GET: Displays/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DisplayViewModel displayViewModel = db.Displays.Find(id);

            if (displayViewModel == null)
            {
                return(HttpNotFound());
            }
            setSourceDropDownList(displayViewModel);
            return(View(displayViewModel));
        }
        public IActionResult FinalReport(int reportid)
        {
            Reports report           = _reportRepository.GetReportById(reportid);
            var     displayVeiwModel = new DisplayViewModel {
                Report    = report,
                Principal = report.Subject
            };

            if (report == null)
            {
                return(NotFound());
            }

            return(View(report));
        }
Example #31
0
        public IActionResult SearchResults(Reports report)
        {
            if (!String.IsNullOrEmpty(report.PRN_Medication))
            {
                var displayViewModel = new DisplayViewModel
                {
                    Reports   = _reportRepository.AllReports,
                    search    = report.PRN_Medication,
                    firstName = report.Principal.FirstName
                };
                return(View(displayViewModel));
            }

            return(View("Search"));
        }
 public ActionResult Display()
 {
     var model = new DisplayViewModel();
     return View(model);
 }