コード例 #1
0
 public Components()
 {
     InitializeComponent();
     Loaded += (s, e) =>
     {
         DataContext = new ComponentsViewModel();
     };
 }
コード例 #2
0
        public async Task <ActionResult> UpdateFee(string id, string feeStatus)
        {
            var fees = await _feeService.Get(x => x.Id == id.AsObjectId());

            var fee   = fees.FirstOrDefault();
            var model = new FeeCollectionComponentViewModel();

            model.OnlinePayment = false;
            foreach (var tran in fee.Transactions)
            {
                var transcaions = await _transactionService.Get(x => x.Id == tran.TransactionId);

                var transcaion = transcaions.FirstOrDefault();
                if (transcaion != null)
                {
                    if (transcaion.AmountMode == AmountMode.OnlinePayement)
                    {
                        model.OnlinePayment = true;
                    }
                }
            }

            var school = await _schoolService.GetSchoolById(fee.SchoolId.ToString());

            var schoolComponent = school.SchoolFeeComponents;

            var allPaidComponents = fee.Transactions.SelectMany(x => x.Components);
            var dict = allPaidComponents.GroupBy(x => x.ComponetId)
                       .ToDictionary(x => x.Key, x => x.Sum(p => p.Value));

            foreach (var comp in fee.Components)
            {
                var feeComp = new ComponentsViewModel
                {
                    ComponetId = comp.ComponetId.ToString(),
                    Value      = comp.Value
                };
                var schoolCompSingle = schoolComponent.FirstOrDefault(x => x.Id == comp.ComponetId);
                if (schoolCompSingle != null)
                {
                    feeComp.Name = schoolCompSingle.Name;
                }
                var paidVal = 0.0;
                if (dict.ContainsKey(comp.ComponetId))
                {
                    paidVal = paidVal + dict[comp.ComponetId];
                }
                feeComp.Paid = paidVal;
                model.Components.Add(feeComp);
            }

            model.FeeId = id;

            model.Remark = fee.Remark;

            model.FeeStatus = feeStatus;
            return(Ok(model));
        }
        public static FakeTestComponent GetByName(string componentName, ComponentsViewModel componentsViewModel)
        {
            var testComponentViewModel = componentsViewModel
                                         .TestComponents
                                         .First(c => c.Name.StartsWith(componentName));
            var fakeTestComponent = new FakeTestComponent(testComponentViewModel);

            return(fakeTestComponent);
        }
コード例 #4
0
ファイル: Components.xaml.cs プロジェクト: sofluf/Osmo
        public void RegisterParent(MainWindow window)
        {
            this.window = window;
            vm          = (ComponentsViewModel)DataContext;
            vm.Components.Add(new Component(txt_application, true, 10092.24, ComponentType.APPLICATION, false));
            vm.Components.Add(new Component(txt_desktopIcon, false, 179, ComponentType.SHORTCUT));
            vm.Components.Add(new Component(txt_startmenu, false, 0, ComponentType.STARTMENU));
            CalculateSpace();

            window.ViewModel = vm;
        }
        private static void Configure(
            ComponentLocation componentLocation,
            ApplicationBootstrap bootstrap,
            ApplicationContext applicationContext,
            BackgroundTasks backgroundTasks)
        {
            var operationsOutputViewModel        = new OperationsOutputViewModel();
            var operationPropertiesViewModel     = new OperationPropertiesViewModel();
            var scriptOperationsViewModel        = new ScriptOperationsViewModel(operationPropertiesViewModel);
            var operationsViewModel              = new OperationsViewModel(operationPropertiesViewModel);
            var operationViewsViewModel          = new OperationViewsViewModel(new OperationsViewInitialization[] { operationsViewModel, scriptOperationsViewModel });
            var componentInstancesViewModel      = new ComponentInstancesViewModel(operationsViewModel, operationViewsViewModel);
            var operationMachinesByControlObject = new OperationMachinesByControlObject();
            var outputFactory = new OutputFactory(operationsOutputViewModel);
            var testComponentViewModelFactory =
                new TestComponentViewModelFactory(
                    componentInstancesViewModel,
                    outputFactory,
                    new WpfOperationViewModelFactory(applicationContext, scriptOperationsViewModel, new PropertySetBuilderFactory()),
                    backgroundTasks,
                    operationMachinesByControlObject,
                    bootstrap);
            var componentsViewModel = new ComponentsViewModel(testComponentViewModelFactory);

            var topMenuBarViewModel = new TopMenuBarViewModel(
                componentInstancesViewModel,
                operationsOutputViewModel, new PersistentModelContentBuilderFactory(operationsOutputViewModel, operationMachinesByControlObject));

            var factoryRepositories = componentLocation.LoadComponentRoots();

            AddAllInstanceFactories(factoryRepositories, componentsViewModel);

            bootstrap.SetOperationPropertiesViewDataContext(operationPropertiesViewModel);
            bootstrap.SetTopMenuBarContext(topMenuBarViewModel);
            bootstrap.SetOperationsViewDataContext(operationsViewModel);
            bootstrap.SetScriptOperationsViewDataContext(scriptOperationsViewModel);
            bootstrap.SetOperationsOutputViewDataContext(operationsOutputViewModel);
            bootstrap.SetComponentsViewDataContext(componentsViewModel);
            bootstrap.SetComponentInstancesViewDataContext(componentInstancesViewModel);
            bootstrap.SetOperationsViewsViewDataContext(operationViewsViewModel);
            return;
        }
コード例 #6
0
 public ComponentsPage(ComponentsViewModel viewModel)
 {
     InitializeComponent();
     ViewModel      = viewModel;
     BindingContext = ViewModel;
 }
コード例 #7
0
 public OpenDataDownloaderCommand(ComponentsViewModel viewModel)
 {
     _viewModel = viewModel;
 }
 public FakeComponentsView(ComponentsViewModel componentsViewModel)
 {
     _componentsViewModel = componentsViewModel;
 }
コード例 #9
0
 public ComponentsView()
 {
     InitializeComponent();
     _viewModel       = new ComponentsViewModel();
     this.DataContext = _viewModel;
 }
コード例 #10
0
ファイル: AdminController.cs プロジェクト: MateoRook/WebStore
        public async Task <IActionResult> EditComponent(ComponentsViewModel details)
        {
            if (ModelState.IsValid)
            {
                var component = orderRepo.GetBody(details.Symbol);

                if (component != null)
                {
                    component.Name            = details.Name;
                    component.Price           = details.Price;
                    component.QuantityInStock = details.Quantity;

                    await orderRepo.UpdateBody(component);

                    return(Redirect("Components"));
                }
                var component2 = orderRepo.GetCompressor(details.Symbol);

                if (component2 != null)
                {
                    component2.Name            = details.Name;
                    component2.Price           = details.Price;
                    component2.QuantityInStock = details.Quantity;

                    await orderRepo.UpdateCompressor(component2);

                    return(Redirect("Components"));
                }

                var component3 = orderRepo.GetHandle(details.Symbol);

                if (component3 != null)
                {
                    component3.Name            = details.Name;
                    component3.Price           = details.Price;
                    component3.QuantityInStock = details.Quantity;

                    await orderRepo.UpdateHandle(component3);

                    return(Redirect("Components"));
                }

                var component4 = orderRepo.GetShelf(details.Symbol);

                if (component != null)
                {
                    component4.Name            = details.Name;
                    component4.Price           = details.Price;
                    component4.QuantityInStock = details.Quantity;

                    await orderRepo.UpdateShelf(component4);

                    return(Redirect("Components"));
                }

                var component5 = orderRepo.GetBalcony(details.Symbol);

                if (component5 != null)
                {
                    component5.Name            = details.Name;
                    component5.Price           = details.Price;
                    component5.QuantityInStock = details.Quantity;

                    await orderRepo.UpdateBalcony(component5);

                    return(Redirect("Components"));
                }

                var component6 = orderRepo.GetAdditional(details.Symbol);

                if (component6 != null)
                {
                    component6.Name            = details.Name;
                    component6.Price           = details.Price;
                    component6.QuantityInStock = details.Quantity;

                    await orderRepo.UpdateAdditional(component6);

                    return(Redirect("Components"));
                }

                return(Redirect("Components"));
            }

            return(Redirect("Components"));
        }
コード例 #11
0
 void ApplicationBootstrap.SetComponentsViewDataContext(object componentsViewModel)
 {
     _componentsViewModel = (ComponentsViewModel)componentsViewModel;
 }
コード例 #12
0
 public OpenClerkCommand(ComponentsViewModel viewModel)
 {
     _viewModel = viewModel;
 }
コード例 #13
0
 public OpenStrategyRunnerCommand(ComponentsViewModel viewModel)
 {
     _viewModel = viewModel;
 }