예제 #1
0
        public async Task <IActionResult> Index([FromServices] IConfiguration configuration)
        {
            var model = new PanelViewModel
            {
                ClientRemoteIpv4 = _connection.RemoteIpAddress.MapToIPv4().ToString(),
                CurrentCases     = new int[12],
                NewCases         = new int[12],
                CurrentDeaths    = new int[12],
                NewDeaths        = new int[12],
                Cases            = new List <TableViewModel>(),
                Deaths           = new List <TableViewModel>()
            };

            try
            {
                using var httpClient = new HttpClient
                      {
                          BaseAddress = _backendUri
                      };

                var jsonAllCases = await httpClient.GetStringAsync("api/cases/month");

                var resultAllCases = JsonSerializer.Deserialize <List <BackendGroupedCasesResponse> >(jsonAllCases);

                foreach (var item in resultAllCases)
                {
                    model.CurrentCases[item.Month - 1]  = item.CurrentCases ?? 0;
                    model.NewCases[item.Month - 1]      = item.NewCases ?? 0;
                    model.CurrentDeaths[item.Month - 1] = item.CurrentDeaths ?? 0;
                    model.NewDeaths[item.Month - 1]     = item.NewDeaths ?? 0;
                }

                foreach (var regionCode in _regionCodes)
                {
                    var json = await httpClient.GetStringAsync($"api/cases/{regionCode}/month");

                    var result = JsonSerializer.Deserialize <List <BackendGroupedCasesResponse> >(json);
                    var info   = result.OrderByDescending(r => r.Month).FirstOrDefault();
                    model.Cases.Add(new TableViewModel
                    {
                        Estado = regionCode,
                        Atual  = info?.CurrentCases ?? 0,
                        Novos  = info?.NewCases ?? 0
                    });

                    model.Deaths.Add(new TableViewModel
                    {
                        Estado = regionCode,
                        Atual  = info?.CurrentDeaths ?? 0,
                        Novos  = info?.NewDeaths ?? 0
                    });
                }
            }
            catch (Exception e)
            {
                model.Message = e.Message;
            }

            return(View(model));
        }
예제 #2
0
        public void DropTest2()
        {
            ObservableCollection <WebPageBaseViewModel> properties = new ObservableCollection <WebPageBaseViewModel>();
            RootPanel      rootPanel = new RootPanel(properties);
            ModalViewModel control   = new ModalViewModel(rootPanel)
            {
                Type          = "varchar",
                FieldInDb     = "field2",
                RuDescription = "Комент",
                ControlIdView = "lb2"
            };

            rootPanel.Children.Add(control);
            PanelViewModel panelViewModel = new PanelViewModel(rootPanel)
            {
                ControlIdView = "clId1", RuDescription = "Комент"
            };

            rootPanel.Children.Add(panelViewModel);
            Assert.AreEqual(2, rootPanel.Children.Count);
            Assert.AreEqual(0, panelViewModel.Children.Count);
            //Перебрасываем контрол
            panelViewModel.Drop(control);
            Assert.AreEqual(1, panelViewModel.Children.Count);
            Assert.AreEqual(1, rootPanel.Children.Count);
            Assert.AreEqual(control.ParentCollection, panelViewModel.Children);
        }
        private void OnTargetPlatformChanged()
        {
            if (this.root == null)
            {
                return;
            }

            if (this.vm != null)
            {
                this.vm.PropertyChanged -= OnVmPropertyChanged;
            }

            PanelViewModel newVm = null;

            if (TargetPlatform != null)
            {
                newVm = new PanelViewModel(TargetPlatform);
            }

            this.root.DataContext = this.vm = newVm;

            if (this.vm != null)
            {
                this.vm.PropertyChanged += OnVmPropertyChanged;
            }
        }
예제 #4
0
        private void UpdateViewModel()
        {
            FrameworkElement element = this;

            while (element != null && !(element is ItemsControl))
            {
                element = VisualTreeHelper.GetParent(element) as FrameworkElement;
            }

            if (element == null)
            {
                ClearValue(IsFilteredProperty);
                this.panelVm = null;
                return;
            }

            this.panelVm = element.DataContext as PanelViewModel;
            if (this.panelVm == null)
            {
                throw new InvalidOperationException("Couldn't find valid parent");
            }

            SetBinding(IsFilteredProperty, new Binding(nameof(PanelViewModel.IsFiltering))
            {
                Source = this.panelVm
            });
        }
        public void TestInitialize()
        {
            _panel1 = new PanelViewModel(new Panel())
            {
                Price      = 5,
                Time       = 5,
                TotalPrice = 5,
            };

            _panel2 = new PanelViewModel(new Panel())
            {
            };

            _quotationStatus = new QuotationStatus(new DateTime(), QuotationStatusType.Created);

            _quotation = new Quotation(_quotationStatus)
            {
                PriceDifference   = 50,
                HourPrice         = 200,
                BasePrice         = 50,
                ContributionRatio = 0.5,
            };

            _quotationViewModel = new QuotationViewModel(_quotation);
        }
예제 #6
0
        protected override void OnLoadPanel(LoadPanelMessage msg)
        {
            if (msg.PanelHolderId == PanelHolderId)
            {
                var center = GetPanelCenter(msg.Length, msg.Width, msg.Height);

                PanelViewModel = new PanelViewModel()
                {
                    SizeX   = msg.Length,
                    SizeY   = msg.Width,
                    SizeZ   = msg.Height,
                    CenterX = Position.X + center.X,
                    CenterY = Position.Y + center.Y,
                    CenterZ = Position.Z + center.Z
                };

                PanelViewModel.Initialize();

                _panel = new ModelVisual3D()
                {
                    Content = PanelViewModel.PanelModel
                };
                _getBounds = () => PanelViewModel.PanelModel.Bounds;

                Children.Add(_panel);
                msg?.NotifyExecution?.Invoke(true);
                if (msg.BackNotifyId > 0)
                {
                    Messenger.Default.Send(new BackNotificationMessage()
                    {
                        DestinationId = msg.BackNotifyId
                    });
                }
            }
        }
예제 #7
0
        private void OnProviderChanged()
        {
            if (this.root == null)
            {
                return;
            }

            if (this.vm != null)
            {
                this.vm.PropertyChanged -= OnVmPropertyChanged;
            }

            PanelViewModel newVm = null;

            if (EditorProvider != null)
            {
                newVm = new PanelViewModel(EditorProvider, TargetPlatform)
                {
                    ResourceProvider = ResourceProvider
                };
            }

            this.root.DataContext = this.vm = newVm;

            if (this.vm != null)
            {
                this.vm.PropertyChanged += OnVmPropertyChanged;
            }
        }
예제 #8
0
        public JsonResult TotalPracticasRefresh(DateTime fechaDesdePracticass, DateTime fechaHastaPracticass)
        {
            var   resultado = new BaseRespuesta();
            Int32 tempValue;

            PanelViewModel miVista = new PanelViewModel();

            miVista = EstablecimientoRepo.CargaDeDatosPanel(null, null, fechaDesdePracticass, fechaHastaPracticass);

            tempValue = miVista.practicasTotales;
            try
            {
                if (miVista.practicasTotales == 0)
                {
                    throw new ApplicationException("La cantidad de Practicas es igual a 0");
                }

                resultado.Mensaje = "creado correctamente";
                resultado.Ok      = true;
            }
            catch (Exception ex)
            {
                resultado.Ok      = false;
                resultado.Mensaje = ex.Message;
            }

            return(Json(tempValue));
        }
예제 #9
0
        public void ComplexTest3()
        {
            _helper.ResourceNamespace = "RefBook";
            PanelViewModel panelViewModel = new PanelViewModel(_rootPanel)
            {
                ControlIdView = "clId1", RuDescription = "Комент"
            };

            _rootPanel.Children.Add(panelViewModel);
            GridViewModel grid = new GridViewModel(panelViewModel);

            panelViewModel.Children.Add(grid);
            grid.Children.Add(new ModalViewModel(grid)
            {
                Type = "int", FieldInDb = "field1", RuDescription = "Комент", ControlIdView = "lb1"
            });
            _helper.Construct(_rootPanel.Children, false);
            string result =
                "<%--Комент--%>\n<gp:CollapsePanel ID=\"clId1\" runat=\"server\" Caption=\"<%$ Resources: RefBook, clId1 %>\" SkinID=\"CollapsePanel\">\n";

            result += "<%----%>\n";
            result += "<gp:GpGridView ID=\"gvObject\" Height=\"100%\" runat=\"server\" PageSize=\"10\" ShowWhenEmpty=\"False\" SkinID=\"gpGridView\" DataKeyNames=\"id\" PagerSettings-Visible=\"true\">\n";
            result += "<Columns>\n";
            result += "<%--Комент--%>\n";
            result += "<asp:TemplateField HeaderText=\"<%$ Resources: RefBook, field1 %>\" SortExpression=\"field1\" AccessibleHeaderText=\"field1\">\n";
            result += "<ItemTemplate>\n";
            result += "<asp:Label ID=\"lb1\" runat=\"server\"><%# Eval(\"field1\")%></asp:Label>\n";
            result += "</ItemTemplate>\n";
            result += "</asp:TemplateField>\n";
            result += "</Columns>\n";
            result += "</gp:GpGridView>\n";
            result += "</gp:CollapsePanel>\n";
            Assert.AreEqual(result, _helper.ToString());
        }
예제 #10
0
        public void ComplexTest1()
        {
            _rootPanel.Children.Add(new ModalViewModel(_rootPanel)
            {
                Type = "int", FieldInDb = "field1", RuDescription = "Комент", ControlIdView = "lb1"
            });
            PanelViewModel panelViewModel = new PanelViewModel(_rootPanel)
            {
                ControlIdView = "clId1", RuDescription = "Комент"
            };

            _rootPanel.Children.Add(panelViewModel);
            panelViewModel.Children.Add(new ModalViewModel(_rootPanel)
            {
                Type = "varchar", FieldInDb = "field2", RuDescription = "Комент", ControlIdView = "lb2"
            });
            string result = "<%--Комент--%>\n<gp:ValidatingLabel ID=\"lb1\" runat=\"server\" SkinID=\"ViewModeSkin\" Caption=\"<%$ Resources: , lb1 %>\" DataBoundField=\"field1\" EnableDate=\"true\" HistType=\"HISTORY_TYPE_UL\"/>\n";

            result +=
                "<%--Комент--%>\n<gp:CollapsePanel ID=\"clId1\" runat=\"server\" Caption=\"<%$ Resources: , clId1 %>\" SkinID=\"CollapsePanel\">\n";
            result +=
                "<%--Комент--%>\n<gp:ValidatingLabel ID=\"lb2\" runat=\"server\" SkinID=\"ViewModeSkin\" Caption=\"<%$ Resources: , lb2 %>\" DataBoundField=\"field2\" EnableDate=\"true\" HistType=\"HISTORY_TYPE_UL\"/>\n";
            result += "</gp:CollapsePanel>\n";
            _helper.Construct(_rootPanel.Children, false);
            Assert.AreEqual(result, _helper.ToString());
        }
예제 #11
0
        public void GetCallToActionViewName(PanelViewModel <AccountDashboardViewModel> viewModel)
        {
            var rules = new Dictionary <int, EvalutateCallToActionRuleDelegate>
            {
                { 100, EvalutateSignAgreementCallToActionRule },
                { 101, vm => viewModel.Data.CallToActionViewModel == null }
            };

            if (viewModel.Data.ApprenticeshipEmployerType != ApprenticeshipEmployerType.Levy)
            {
                rules.Add(120, EvaluateSingleApprenticeshipCallToActionRule);
                rules.Add(121, EvaluateSingleApprenticeshipDraftStatusCallToActionRule);
                rules.Add(122, EvaluateSingleApprenticeshipsWithTrainingProviderStatusCallToActionRule);
                rules.Add(123, EvaluateSingleApprenticeshipsWithReadyToReviewStatusCallToActionRule);
                rules.Add(124, EvaluateContinueSetupForSingleApprenticeshipByProviderCallToActionRule);
                rules.Add(200, EvalutateSingleReservationCallToActionRule);
                rules.Add(201, EvalutateHasReservationsCallToActionRule);

                rules.Add(150, EvalutateDraftVacancyCallToActionRule);
                rules.Add(151, EvalutatePendingReviewVacancyCallToActionRule);
                rules.Add(152, EvalutateLiveVacancyCallToActionRule);
                rules.Add(153, EvalutateRejectedVacancyCallToActionRule);
                rules.Add(154, EvalutateClosedVacancyCallToActionRule);
            }

            foreach (var callToActionRuleFunc in rules.OrderBy(r => r.Key))
            {
                if (callToActionRuleFunc.Value(viewModel))
                {
                    return;
                }
            }
        }
예제 #12
0
        public async Task <IActionResult> Index(string order)
        {
            var viewModle = new PanelViewModel {
                Order = order
            };

            return(await Task.FromResult(View(viewModle)));;
        }
예제 #13
0
 public async Task <IActionResult> FilterWorkers(PanelViewModel viewModel, [FromQuery] int pageNumber = 1)
 => View("Index", viewModel.FilterWorkers(await panelManager.FilterWorkers(WorkerFiltersParams.Build
                                                                           (
                                                                               viewModel.UserName,
                                                                               viewModel.Email,
                                                                               viewModel.SortType,
                                                                               viewModel.IsAdmin
                                                                           ).CurrentPage(pageNumber) as WorkerFiltersParams)));
예제 #14
0
        protected override void OnInitialize()
        {
            base.OnInitialize();

            PanelViewModel = ContainerManager.GetInstance <PanelViewModel>();
            LoginViewModel = ContainerManager.GetInstance <LoginViewModel>();
            base.ActivatePage(LoginViewModel);
        }
예제 #15
0
        public Panel(string _name, string _album)
        {
            InitializeComponent();

            viewModel = new PanelViewModel(_name, _album);

            BindingContext = viewModel;
        }
예제 #16
0
        private void Save(PanelViewModel document, string filePath)
        {
            document.FilePath = filePath;
            fileSystem.WriteAllText(filePath, document.FileContent);
            document.Saved();

            AddRecentScript(filePath);
        }
예제 #17
0
        public ActionResult Panel()
        {
            PanelViewModel miVista = new PanelViewModel();

            miVista = EstablecimientoRepo.CargaDeDatosPanel();

            return(View(miVista));
        }
예제 #18
0
        internal PropertyTableDataSource(PanelViewModel panelVm)
        {
            if (panelVm == null)
            {
                throw new ArgumentNullException(nameof(panelVm));
            }

            this.vm = panelVm;
        }
예제 #19
0
        private bool EvalutateSignAgreementCallToActionRule(PanelViewModel <AccountDashboardViewModel> viewModel)
        {
            if (viewModel.Data.PendingAgreements?.Count() > 0)
            {
                viewModel.ViewName = "SignAgreement";
                return(true);
            }

            return(false);
        }
예제 #20
0
        private void CreateSidePanel(Panel panel, PanelViewModel viewModel, string header)
        {
            var tab = new TabItem()
            {
                Header  = header,
                Content = panel
            };

            _tabTracker.AddToSideTabs(tab, viewModel);
        }
예제 #21
0
        private void CreateContentPanel(Panel panel, PanelViewModel viewModel, string header)
        {
            var tab = new TabItem()
            {
                Header  = header,
                Content = panel
            };

            _tabTracker.AddToMainTabs(tab, viewModel);
            viewModel.IsActive = true;
        }
예제 #22
0
        public IActionResult Panel()
        {
            var model = new PanelViewModel()
            {
                Posts  = _postRepository.getAllPosts(),
                Animes = _animeRepository.GetAllAnimes(),
                Mangas = _mangaRepository.GetAllMangas(),
            };

            return(View(model));
        }
        public override ActionResult LayerPanel()
        {
            dynamic obj = CodecBaseController.GetJsonObject(Request.InputStream);

            string name  = JsonHelper.CastTo <string>(obj.name);
            int    layer = JsonHelper.CastTo <int>(obj.layer);

            var layersGroup = new List <PanelViewModel>();

            var CodecActionDic = (Dictionary <int, ICodecAction>)Session[ConstantCodecActionDic];

            _codecAction = CodecActionDic == null ? null : (CodecActionDic.ContainsKey(layer) ? CodecActionDic[layer] : null);

            if (_codecAction == null)
            {
                return(PartialView("_Layers", layersGroup));
            }

            if (name.Equals(Constants.DECODE_NAME_RECONSTRUCTEDFRAME))
            {
                return(DecodedImage(layer));
            }

            // gets the action with the same name as the argument
            var action = _codecAction.SubActions.SingleOrDefault(c => c.Name.Equals(name));

            if (action == null || action.Result == null)
            {
                return(PartialView("_Layers", layersGroup));
            }

            // create layers accroding to the given layer.
            // This is different with others
            string           idPrefix   = name.Replace(' ', '-').Replace('/', '-') + "-input-layer-" + layer;
            var              layerPanel = new PanelViewModel(idPrefix, "Layer " + layer);
            Tile             result     = action.Result.FirstOrDefault();
            Triplet <string> triplet    = result.GetStrings(TileSerializerFactory.GetDefaultSerizlizer());
            var              tabx       = new TabViewModel {
                Id = idPrefix + "-Y", Title = "Y", Content = triplet.X, Editable = false
            };
            var taby = new TabViewModel {
                Id = idPrefix + "-Cb", Title = "Cb", Content = triplet.Y, Editable = false
            };
            var tabz = new TabViewModel {
                Id = idPrefix + "-Cr", Title = "Cr", Content = triplet.Z, Editable = false
            };

            layerPanel.Tabs = new List <TabViewModel> {
                tabx, taby, tabz
            };
            layersGroup.Add(layerPanel);

            return(PartialView("_Layers", layersGroup));
        }
예제 #24
0
        private bool EvalutateHasReservationsCallToActionRule(PanelViewModel <AccountDashboardViewModel> viewModel)
        {
            if (!viewModel.Data.CallToActionViewModel.HasReservations)
            {
                viewModel.ViewName          = "CheckFunding";
                viewModel.PanelType         = PanelType.Action;
                viewModel.Data.HideTasksBar = true;
                return(true);
            }

            return(false);
        }
        public PanelViewModel CargaDeDatosPanel(DateTime?fechaDesdeEvoluciones = null, DateTime?fechaHastaEvoluciones = null,
                                                DateTime?fechaDesdePracticas   = null, DateTime?fechaHastaPracticas   = null)
        {
            PanelViewModel miVista = new PanelViewModel(NombreEstablecimiento(5),
                                                        CantidadTotalProfesionales(),
                                                        CantidadMedicosActivos(),
                                                        CantidadTotalEvoluciones(fechaDesdeEvoluciones, fechaHastaEvoluciones),
                                                        CantidadTotalPracticas(fechaDesdePracticas, fechaHastaPracticas),
                                                        ListarSectores());

            return(miVista);
        }
예제 #26
0
        public MainWindow()
        {
            InitializeComponent();

            var mervalViewModel = new PanelViewModel(Properties.Settings.Default.Merval, Properties.Settings.Default.MervalMarket);

            MervalTab.DataContext = mervalViewModel;

            var adrsViewModel = new PanelViewModel(Properties.Settings.Default.ADRS, Properties.Settings.Default.ADRSMarket);

            AdrsTab.DataContext = adrsViewModel;
        }
        public override ActionResult LayerPanel([FromBody] LayerPanelRequest request)
        {
            var layersGroup = new List <PanelViewModel>();

            try
            {
                var CodecActionDic = this.HttpContext.Session.Get <Dictionary <int, ICodecAction> >(ConstantCodecActionDic);
                _codecAction = CodecActionDic == null ? null : (CodecActionDic.ContainsKey(request.layer) ? CodecActionDic[request.layer] : null);

                if (_codecAction == null)
                {
                    return(PartialView("_Layers", layersGroup));
                }

                if (request.name.Equals(Constants.DECODE_NAME_RECONSTRUCTEDFRAME))
                {
                    return(DecodedImage(request.layer));
                }

                // gets the action with the same name as the argument
                var action = _codecAction.SubActions.SingleOrDefault(c => c.Name.Equals(request.name));
                if (action == null || action.Result == null)
                {
                    return(PartialView("_Layers", layersGroup));
                }

                // create layers accroding to the given layer.
                // This is different with others
                string           idPrefix   = request.name.Replace(' ', '-').Replace('/', '-') + "-input-layer-" + request.layer;
                var              layerPanel = new PanelViewModel(idPrefix, "Layer " + request.layer);
                Tile             result     = action.Result.FirstOrDefault();
                Triplet <string> triplet    = result.GetStrings(TileSerializerFactory.GetDefaultSerizlizer());
                var              tabx       = new TabViewModel {
                    Id = idPrefix + "-Y", Title = "Y", Content = triplet.X, Editable = false
                };
                var taby = new TabViewModel {
                    Id = idPrefix + "-Cb", Title = "Cb", Content = triplet.Y, Editable = false
                };
                var tabz = new TabViewModel {
                    Id = idPrefix + "-Cr", Title = "Cr", Content = triplet.Z, Editable = false
                };
                layerPanel.Tabs = new List <TabViewModel> {
                    tabx, taby, tabz
                };
                layersGroup.Add(layerPanel);
            }
            catch (Exception ex)
            {
                return(Json(ReturnResult <string> .Fail(ex.Message)));
            }

            return(PartialView("_Layers", layersGroup));
        }
예제 #28
0
        private bool EvaluateSingleApprenticeshipCallToActionRule(PanelViewModel <AccountDashboardViewModel> viewModel)
        {
            if (viewModel.Data.CallToActionViewModel.ReservationsCount == 1 &&
                viewModel.Data.CallToActionViewModel?.ApprenticeshipsCount == 1)
            {
                viewModel.ViewName          = "SingleApprenticeshipApproved";
                viewModel.PanelType         = PanelType.Summary;
                viewModel.Data.HideTasksBar = true;
                return(true);
            }

            return(false);
        }
예제 #29
0
        // GET: Admin/Dashboard
        public ActionResult Index()
        {
            var userId = User.Identity.GetUserId();
            var pvm    = new PanelViewModel()
            {
                QuantityArticles   = db.Articles.Where(x => x.ApplicationUserId == userId).ToList().Count,
                QuantityCategories = db.Articles.Where(x => x.ApplicationUserId == userId).GroupBy(y => y.Category.CategoryName).ToList().Count,
                QuantityTags       = db.Articles.Where(x => x.ApplicationUserId == userId).GroupBy(y => y.Tags.FirstOrDefault().Id).ToList().Count,
                QuantityComments   = db.Articles.Where(x => x.ApplicationUserId == userId).Sum(y => y.Comments.Count)
            };

            return(View(pvm));
        }
예제 #30
0
        private void Save(PanelViewModel document, string filePath)
        {
            var mdoc = document as MonitorViewModel;

            document.FilePath = filePath;

            if (mdoc.IsDirty)
            {
                fileSystem.WriteAllText(filePath, mdoc.Xmlfile);
                mdoc.Saved();
            }
            AddRecentScript(filePath);
        }