Ejemplo n.º 1
0
        protected override object GetUpdateDialogView()
        {
            if (ViewModel is ProductivitiesViewModel viewModel && viewModel.SelectedModel != null)
            {
                var snackbar = (Application.Current.MainWindow as MainWindow)?.MainSnackbar.MessageQueue;
                var user     = (Application.Current.MainWindow as MainWindow)?.ViewModel.User;

                if (snackbar == null || user == null)
                {
                    return(null);
                }

                var cowsVm  = new CowsViewModel(snackbar, viewModel.CowsViewModel.Models, user, viewModel.CowsViewModel.BullsViewModel, viewModel.CowsViewModel.BloodTypesViewModel, viewModel.CowsViewModel.CategoriesViewModel, viewModel.CowsViewModel.LinesViewModel, viewModel.CowsViewModel.BreedsViewModel, viewModel.CowsViewModel.FamiliesViewModel);
                var prodsVm = new ProductivitiesViewModel(snackbar, user, cowsVm, viewModel.Models);

                var productivityVm = new ProductivityViewModel()
                {
                    Id              = viewModel.SelectedModel.Id,
                    BelokProz       = viewModel.SelectedModel.BelokProz,
                    Date            = viewModel.SelectedModel.Date,
                    Cow             = viewModel.SelectedModel.Cow,
                    CowId           = viewModel.SelectedModel.CowId,
                    UchtenoLaktacij = viewModel.SelectedModel.UchtenoLaktacij,
                    UdojKg          = viewModel.SelectedModel.UdojKg,
                    ZhirProz        = viewModel.SelectedModel.ZhirProz
                };

                return(new ProductivityDialog("Изменить", productivityVm, prodsVm));
            }

            return(null);
        }
 public void LoadProductivityViewModel(ProductivityViewModel viewModel)
 {
     viewModel.Headline          = GetStringValue(_languageCurrent.PRODUCTIVITY_PRODUCTIVITY_HEADLINE, "PRODUCTIVITY_PRODUCTIVITY_HEADLINE");
     viewModel.Lede              = GetStringValue(_languageCurrent.PRODUCTIVITY_PRODUCTIVITY_COPY, "PRODUCTIVITY_PRODUCTIVITY_COPY");
     viewModel.PopTopHeadline    = GetStringValue(_languageCurrent.PRODUCTIVITY_PRODUCTIVITY_POPLEFT_TITLE, "PRODUCTIVITY_PRODUCTIVITY_POPLEFT_TITLE");
     viewModel.PopTopLede        = GetStringValue(_languageCurrent.PRODUCTIVITY_PRODUCTIVITY_POPLEFT_COPY, "PRODUCTIVITY_PRODUCTIVITY_POPLEFT_COPY");
     viewModel.PopTopLegal       = GetStringValue(_languageCurrent.PRODUCTIVITY_PRODUCTIVITY_POPLEFT_LEGAL, "PRODUCTIVITY_PRODUCTIVITY_POPLEFT_LEGAL");
     viewModel.PopCenterHeadline = GetStringValue(_languageCurrent.PRODUCTIVITY_PRODUCTIVITY_POPRIGHT_TITLE, "TECH_TECH_RIGHT_TITLE");
     viewModel.PopCenterLede     = GetStringValue(_languageCurrent.PRODUCTIVITY_PRODUCTIVITY_POPRIGHT_COPY, "TECH_TECH_RIGHT_COPY");
     viewModel.PopBottomHeadline = GetStringValue(_languageCurrent.PRODUCTIVITY_PRODUCTIVITY_POPBOTTOM_TITLE, "PRODUCTIVITY_PRODUCTIVITY_POPBOTTOM_TITLE");
     viewModel.PopBottomLede     = GetStringValue(_languageCurrent.PRODUCTIVITY_PRODUCTIVITY_POPBOTTOM_COPY, "PRODUCTIVITY_PRODUCTIVITY_POPBOTTOM_COPY");
     viewModel.PopBottomLegal    = GetStringValue(_languageCurrent.PRODUCTIVITY_PRODUCTIVITY_POPBOTTOM_LEGAL, "PRODUCTIVITY_PRODUCTIVITY_POPBOTTOM_LEGAL");
 }
        public ProductivityViewModel GetProductivity(ContextModel context)
        {
            var result = new ProductivityViewModel();

            result.vm_machine_info = new MachineInfoViewModel
            {
                model       = context.ActualMachine.Model.Name,
                mtype       = context.ActualMachine.Type.Name,
                id_mtype    = context.ActualMachine.Type.Id,
                machineName = context.ActualMachine.MachineName
            };
            var operatorActivities = _stateService.GetOperatorsActivity(context.ActualMachine, context.ActualPeriod.StartDate, context.ActualPeriod.EndDate);

            result.vm_productivity = GetVueModel(operatorActivities, context.ActualMachine, context.ActualPeriod);
            result.opt_historical  = GetHistoricalOptions(context.ActualMachine, context.ActualPeriod);
            result.opt_operators   = GetOperatorsOptions(operatorActivities);


            return(result);
        }