Ejemplo n.º 1
0
        /// <summary>
        /// Save the data objects to the database table and it uses the carekeeper service to
        /// allows the do undo of the saving.
        /// </summary>

        public SaveDataCommand(IDataServices dataServices, ICareKeeperService careKeeperService, IConfigurationService configurationService)
        {
            _dataServices         = dataServices;
            _careKeeperService    = careKeeperService;
            _configurationService = configurationService;
            InitHandlers();
        }
Ejemplo n.º 2
0
        public ClientChargeViewModel(ICareKeeperService careKeeperService,
                                     IDataServices dataServices,
                                     IConfigurationService configurationService, IRegionManager regionManager)
        {
            _dataServices                 = dataServices;
            _regionManager                = regionManager;
            _selectedIndex                = 0;
            _regionSelectedAction         = new DelegateCommand <object>(RegionSelection);
            this.ClickCommand             = new DelegateCommand <string>(OnClickCommand);
            this.DataGridChangedSelection = new DelegateCommand <object>(OnSelectedRow);
            this.NumberTextChanged        = new DelegateCommand <string>(OnTextChanged);

            _currentClickCommand.Add("FindChargeAccount", new DelegateCommand(ChargeAccountPopUp));
            _currentClickCommand.Add("FindChargeCommissionAccount", new DelegateCommand(ChargeCommisionAccountPopUp));
            _currentClickCommand.Add("FindCommissionBank", new DelegateCommand(ChargeCommissionBankPopUp));
            _currentClickCommand.Add("FindOffice", new DelegateCommand(ChargeOfficePopUp));
            _currentClickCommand.Add("FindChargeBank", new DelegateCommand(ChargeBankPopUp));
            _currentClickCommand.Add("FindBillingAccount", new DelegateCommand(ChargeBillingAccountPopUp));
            InitDataLayer();
        }
Ejemplo n.º 3
0
 public void Setup()
 {
     _careKeeper = new CareKeeper();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// KarveToolBarViewModel is a view model to modle the toolbar behaviour.
        /// </summary>
        /// <param name="dataServices">Service for fetching datas</param>
        /// <param name="eventManager">Service for communicate with other view models</param>
        /// <param name="careKeeper">Service for caring command and storing/undoing command</param>
        /// <param name="regionManager">Service for region handling</param>
        /// <param name="dialogService">Service for spotting the dialog</param>
        /// <param name="configurationService">Service for the configuraration parameters</param>
        public KarveToolBarViewModel(IDataServices dataServices,
                                     IEventManager eventManager,
                                     ICareKeeperService careKeeper,
                                     IRegionManager regionManager,
                                     IDialogService dialogService,
                                     IConfigurationService configurationService) : base(dataServices, null, dialogService, configurationService)
        {
            this._dictionary           = SubsystemFactory.GetSubsytem();
            this._dataServices         = dataServices;
            this._dialogService        = dialogService;
            this._configurationService = configurationService;
            this._eventManager         = eventManager;
            this._eventManager.RegisterObserverToolBar(this);
            this._careKeeper           = careKeeper;
            this.SaveCommand           = new DelegateCommand(DoSaveCommand);
            this.NewCommand            = new DelegateCommand(DoNewCommand);
            this.DeleteCommand         = new DelegateCommand <object>(DoDeleteCommand);
            this._dataServices         = dataServices;
            this._configurationService = configurationService;
            this._eventManager         = eventManager;
            this._eventManager.RegisterObserverToolBar(this);
            this.CurrentSaveImagePath = currentSaveImage;
            _regionManager            = regionManager;
            _states              = ToolbarStates.None;
            _noActiveValue       = string.Empty;
            this.IsSaveEnabled   = false;
            this.IsDeleteEnabled = false;
            this.IsNewEnabled    = false;
            ConfirmationRequest  = new InteractionRequest <IConfirmation>();
            Confirmation request = new Confirmation
            {
                Title   = "Confirmacion",
                Content = confirmDelete
            };

            ViewModelUri        = new Uri("karve://toolbar/viewmodel?id=" + UniqueId);
            ConfirmationCommand = new DelegateCommand(() =>
            {
                // string noActiveValue = configurationService.GetPrimaryKeyValue();
                request.Content = confirmDelete;
                ConfirmationRequest.Raise(request);
                if (request.Confirmed)
                {
                    string value   = string.Empty;
                    var singleView = _regionManager.Regions[RegionNames.TabRegion].ActiveViews.FirstOrDefault();
                    if (singleView != null)
                    {
                        var headerProp = singleView.GetType().GetProperty("Header");
                        if (headerProp != null)
                        {
                            if (headerProp.GetValue(singleView) is string header)
                            {
                                value = header.Split('.')[0];
                            }
                        }
                    }

                    DeleteCommand.Execute(value);
                }
            });
            SaveValueCommand = new DelegateCommand(() =>
            {
                request.Content = confirmSave;

                ConfirmationRequest.Raise(request);
                if (request.Confirmed)
                {
                    SaveCommand.Execute();
                }
                else
                {
                    this.CurrentSaveImagePath = KarveToolBarViewModel.currentSaveImage;
                }
            });

            AddValidationChain();
            _uniqueId = ObserverName + Guid.NewGuid();
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Save a data command for the configuration manager.
 /// </summary>
 /// <param name="dataServices"></param>
 /// <param name="careKeeperService"></param>
 /// <param name="eventManager"></param>
 /// <param name="configurationService"></param>
 public SaveDataCommand(IDataServices dataServices, ICareKeeperService careKeeperService, IEventManager eventManager, IConfigurationService configurationService) :
     this(dataServices, careKeeperService, configurationService)
 {
     _eventManager = eventManager;
     InitHandlers();
 }
        /// <summary>
        /// KarveToolBarViewModel is a view model to modle the toolbar behaviour.
        /// </summary>
        /// <param name="dataServices"></param>
        /// <param name="eventManager"></param>
        /// <param name="careKeeper"></param>
        /// <param name="regionManager"></param>
        /// <param name="configurationService"></param>
        public KarveToolBarViewModel(IDataServices dataServices,
                                     IEventManager eventManager,
                                     ICareKeeperService careKeeper,
                                     IRegionManager regionManager,
                                     IConfigurationService configurationService)
        {
            this._dataServices         = dataServices;
            this._configurationService = configurationService;
            this._eventManager         = eventManager;
            this._eventManager.RegisterObserverToolBar(this);
            this._careKeeper           = careKeeper;
            this.SaveCommand           = new DelegateCommand(DoSaveCommand);
            this.NewCommand            = new DelegateCommand(DoNewCommand);
            this.DeleteCommand         = new DelegateCommand(DoDeleteCommand);
            this._dataServices         = dataServices;
            this._configurationService = configurationService;
            this._eventManager         = eventManager;
            this._eventManager.RegisterObserverToolBar(this);
            this.CurrentSaveImagePath = currentSaveImage;
            _regionManager            = regionManager;
            _states             = ToolbarStates.None;
            ConfirmationRequest = new InteractionRequest <IConfirmation>();
            Confirmation request = new Confirmation
            {
                Title   = "Confirmacion",
                Content = confirmDelete
            };

            Confirmed           = false;
            ConfirmationCommand = new DelegateCommand(() =>
            {
                string noActiveValue = configurationService.GetPrimaryKeyValue();
                if (string.IsNullOrEmpty(noActiveValue))
                {
                    InteractionRequest <INotification> ir = new InteractionRequest <INotification>();
                    Notification nt = new Notification
                    {
                        Content = "No puedo borrar la ficha de consulta",
                        Title   = "Error"
                    };
                    ir.Raise(nt);
                }
                else
                {
                    request.Content = confirmDelete;
                    ConfirmationRequest.Raise(request);
                    if (request.Confirmed)
                    {
                        DeleteCommand.Execute();
                        Confirmed = false;
                    }
                }
            });
            SaveValueCommand = new DelegateCommand(() =>
            {
                request.Content = confirmSave;

                ConfirmationRequest.Raise(request);
                if (request.Confirmed)
                {
                    SaveCommand.Execute();
                    Confirmed = false;
                }
                else
                {
                    this.CurrentSaveImagePath = KarveToolBarViewModel.currentSaveImage;
                }
            });

            SetInsertValidationChain();
            _uniqueId = ObserverName + Guid.NewGuid();
        }