예제 #1
0
        /// <summary>
        /// Office Info view model.
        /// </summary>
        /// <param name="eventManager">Event manager</param>
        /// <param name="configurationService">Configuration service</param>
        /// <param name="dataServices">Data services</param>
        /// <param name="dialogService">Dialog services</param>
        /// <param name="container">Unity Manager</param>
        /// <param name="manager">Region Manager</param>
        /// <param name="requestController">Request controller</param>

        public OfficeInfoViewModel(IEventManager eventManager, IConfigurationService configurationService,
                                   IDataServices dataServices,
                                   IDialogService dialogService,
                                   IUnityContainer container,
                                   IRegionManager manager,
                                   IInteractionRequestController requestController) : base(eventManager, configurationService, dataServices, dialogService, manager, requestController)
        {
            _assistDataService = dataServices.GetAssistDataServices();
            _officeDataService = dataServices.GetOfficeDataServices();
            _newOfficeCommand  = new DelegateCommand(OnNewOffice);
            _newOfficeSave     = new DelegateCommand(OnSaveOffice);
            _provinciaDto      = new System.Collections.ObjectModel.ObservableCollection <ProvinciaDto>();
            _openDays          = new System.Collections.ObjectModel.ObservableCollection <DailyTime>();
            _currentHolidays   = new Dictionary <DateTime, HolidayDto>();
            _currentPartOfDay  = null;

            AssistMapper       = _assistDataService.Mapper;
            AssistCommand      = new DelegateCommand <object>(OnAssistCommand);
            ItemChangedCommand = new DelegateCommand <object>(OnChangedField);
            AssistExecuted    += OfficeAssistResult;
            DataObject         = new OfficeDtos();
            DateTime dt = DateTime.Now;

            ProvinciaDto           = _provinciaDto;
            CurrentYear            = dt.Year.ToString();
            ViewModelUri           = new Uri("karve://office/viewmodel?id=" + Guid.ToString());
            TimePickerSaveCommand  = new DelegateCommand <object>(OnPickerSaveCommand);
            TimePickerResetCommand = new DelegateCommand <object>(OnPickerResetCommand);
            SelectedDaysCommand    = new DelegateCommand <object>(OnSelectedDaysCommand);
            PartOfDaySelection     = new DelegateCommand <object>(OnPartOfDaySelection);
            EventManager.RegisterObserverSubsystem(MasterModuleConstants.OfficeSubSytemName, this);
            ActiveSubSystem();
        }
예제 #2
0
        /// <summary>
        ///  Constructor
        /// </summary>
        /// <param name="configurationService">This is the configurartion service</param>
        /// <param name="eventManager"> The event manager for sending/recieving messages from the view model</param>
        /// <param name="dialogService"></param>
        /// <param name="services">Data access layer interface</param>
        public VehicleInfoViewModel(IConfigurationService configurationService, IEventManager eventManager,
                                    IDialogService dialogService,
                                    IDataServices services, IRegionManager regionManager, IInteractionRequestController requestController) :
            base(eventManager, configurationService, services, dialogService, regionManager, requestController)
        {
            // by default is not initialized until it comes to Init completed.
            IsViewModelInitialized = false;
            SubSystem             = DataSubSystem.VehicleSubsystem;
            MailBoxHandler       += MessageHandler;
            _vehicleDataServices  = services.GetVehicleDataServices();
            _assistDataService    = services.GetAssistDataServices();
            ItemChangedCommand    = new DelegateCommand <object>(ChangeUnpack);
            MetaDataObject        = InitAssuranceObject();
            DataFieldCollection   = InitDataField();
            RevisionObject        = InitRevisionComposedFieldObjects();
            MaintenanceCollection = _maintenaince;
            _regionManager        = regionManager;
            _deleteEventHandler  += DeleteEventHandler;
            EventManager.RegisterObserverSubsystem(MasterModuleConstants.VehiclesSystemName, this);
            AssistCommand      = new DelegateCommand <object>(AssistCommandHelper);
            _queryStoreFactory = new QueryStoreFactory();
            _saveCommand       = new DelegateCommand <object>(OnSaveCommand);
            var gid = Guid.NewGuid();

            ViewModelUri = new Uri("karve://vehicle/viewmodel?id=" + gid.ToString());

            ActiveSubSystem();
        }
        /// <summary>
        ///  Constructor.
        /// </summary>
        /// <param name="services">Data service for data retrieving</param>
        /// <param name="controller">Interaction controller for showing popup</param>
        /// <param name="dialogService">Error message dialog controller</param>
        /// <param name="unityContainer"></param>
        /// <param name="eventManager"></param>
        /// <param name="navigation"></param>
        /// <param name="configurationService"></param>
        /// <param name="regionManager"></param>
        public BookingIncidentInfoViewModel(IDataServices services, IInteractionRequestController controller,
                                            IDialogService dialogService,
                                            IUnityContainer unityContainer,
                                            IEventManager eventManager,
                                            IKarveNavigator navigation,
                                            IConfigurationService configurationService,
                                            IRegionManager regionManager) : base(services, controller, dialogService, eventManager, regionManager, configurationService)
        {
            AssistCommand      = new DelegateCommand <object>(OnAssistCommand);
            ItemChangedCommand = new DelegateCommand <object>(OnChangedField);

            SubSystem = DataSubSystem.BookingSubsystem;

            ViewModelUri            = new Uri("karve://booking/incident/show/viewmodel?id=" + Guid.ToString());
            _unityContainer         = unityContainer;
            _navigator              = navigation;
            _userSettings           = configurationService.UserSettings;
            _deleteCommand          = new DelegateCommand <object>(DeleteViewCommand);
            _saveCommand            = new DelegateCommand <object>(SaveViewCommand);
            _newCommand             = new DelegateCommand <object>(NewViewCommand);
            _dataIncidentService    = services.GetBookingIncidentDataService();
            _assistDataService      = services.GetAssistDataServices();
            _unityContainer         = unityContainer;
            CompositeCommandOnly    = true;
            VehicleColumns          = "Code,Brand,Model,Matricula,VehicleGroup,Situation,Office,Places,CubeMeters,Activity,Owner";
            ClientsConductorColumns = "Code,Name,Nif,Phone,Movil,Email,Card,ReplacementCar,Zip,City,CreditCardType,NumberCreditCard, PaymentForm,AccountableAccount,Sector,Zona,Origin,Office,Falta,BirthDate,DrivingLicence";
            AssistMapper            = _assistDataService.Mapper;
            EventManager.RegisterObserverSubsystem(BookingModule.GroupBookingIncident, this);
            EventManager.RegisterObserverSubsystem(BookingModule.BookingSubSystem, this);
        }
예제 #4
0
        public ReservationRequestsViewModel(IDataServices services, IInteractionRequestController controller, IDialogService dialogService, IEventManager eventManager, IKarveNavigator navigation, IConfigurationService configurationService, IRegionManager regionManager) : base(services, controller, dialogService, eventManager, regionManager)
        {
            AssistCommand          = new DelegateCommand <object>(OnAssistCommand);
            ItemChangedCommand     = new DelegateCommand <object>(OnChangedField);
            CreateNewClient        = new DelegateCommand(NewClient);
            CreateNewGroup         = new DelegateCommand(NewGroup);
            CreateNewRequestReason = new DelegateCommand(NewRequestReason);
            CreateNewReseller      = new DelegateCommand(NewReseller);
            CreateNewFare          = new DelegateCommand(NewFare);
            CreateNewVehicle       = new DelegateCommand(NewVehicle);
            CreateNewOrigen        = new DelegateCommand(NewOrigin);
            SubSystem = DataSubSystem.BookingSubsystem;

            ViewModelUri            = new Uri("karve://booking/request/viewmodel?id=" + Guid.ToString());
            _navigator              = navigation;
            _helperViewFactory      = _navigator.GetHelperViewFactory();
            _userSettings           = configurationService.GetUserSettings();
            _deleteCommand          = new DelegateCommand <object>(this.DeleteViewCommand);
            _saveCommand            = new DelegateCommand <object>(SaveViewCommand);
            _dataReservationService = services.GetReservationRequestDataService();
            _assistDataService      = services.GetAssistDataServices();
            AssistMapper            = _assistDataService.Mapper;
            CompositeCommandOnly    = true;
            VehicleGridColumns      = _userSettings.FindSetting <string>(UserSettingConstants.VehicleSummaryGridColumnsKey);
            EventManager.RegisterObserverSubsystem("ReservationRequests", this);
        }
예제 #5
0
 public DirectionBaseViewModel(string query, IDataServices dataServices, IRegionManager region, IEventManager manager, IDialogService dialogService) : base(query, dataServices, region, manager, dialogService)
 {
     _assistDataService            = dataServices.GetAssistDataServices();
     AssistMapper                  = _assistDataService.Mapper;
     AssistCommand                 = new DelegateCommand <object>(OnAssistAsync);
     AssistCompletionEventHandler += AssistComplete;
 }
예제 #6
0
 /// <summary>
 ///  CitiesViewModel
 /// </summary>
 /// <param name="dataServices">DataService</param>
 /// <param name="region">Region</param>
 /// <param name="manager">EventManager</param>
 public CitiesViewModel(IDataServices dataServices, IRegionManager region, IEventManager manager, IDialogService service, IConfigurationService config) : base(String.Empty, dataServices, region, manager, service, config)
 {
     AssistCommand = new DelegateCommand <object>(OnAssistRequest);
     if (_gridIdentifier == 0)
     {
         _gridIdentifier = GenerateGridId();
     }
     _assistDataService = dataServices.GetAssistDataServices();
     GridIdentifier     = _gridIdentifier;
 }
예제 #7
0
        public KarveViewModelBase(IDataServices services)
        {
            DataServices = services;
            var assistDataService = services.GetAssistDataServices();

            if (assistDataService != null)
            {
                AssistMapper = assistDataService.Mapper;
            }
            SortCommand        = new DelegateCommand <object>(OnSortCommand);
            HelperDataServices = services.GetHelperDataServices();
            InitViewModelState();
        }
예제 #8
0
 /// <summary>
 /// ProviderInfoViewModel.
 /// </summary>
 /// <param name="eventManager"></param>
 /// <param name="configurationService"></param>
 /// <param name="dataServices"></param>
 /// <param name="dialogService"></param>
 /// <param name="manager"></param>
 /// <param name="controller"></param>
 public ProviderInfoViewModel(IEventManager eventManager, IConfigurationService configurationService,
                              IDataServices dataServices, IDialogService dialogService,
                              IRegionManager manager, IInteractionRequestController controller) : base(eventManager, configurationService, dataServices, dialogService, manager, controller)
 {
     ConfigurationService = configurationService;
     MailBoxHandler      += MessageHandler;
     AccountAssistQuery   = _accountAssistQuery;
     EventManager.RegisterObserverSubsystem(MasterModuleConstants.ProviderSubsystemName, this);
     // TODO: all the mapping shall be isolated.
     mapper = MapperField.GetMapper();
     _onBranchesPrimaryKey += ProviderInfoViewModel__onBranchesPrimaryKey;
     _onContactsPrimaryKey += ProviderInfoViewModel__onContactsPrimaryKey;
     _uniqueCounter++;
     _assistDataService = dataServices.GetAssistDataServices();
     SubSystem          = DataSubSystem.SupplierSubsystem;
     ViewModelUri       = new Uri("karve://supplier/viewmodel?id=" + Guid.ToString());
     InitVmCommands();
 }
예제 #9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="eventManager"></param>
 /// <param name="configurationService"></param>
 /// <param name="dataServices"></param>
 /// <param name="dialogService"></param>
 /// <param name="manager"></param>
 /// <param name="controller"></param>
 public CompanyInfoViewModel(IEventManager eventManager, IConfigurationService configurationService, IDataServices dataServices,
                             IDialogService dialogService,
                             IRegionManager manager,
                             IInteractionRequestController controller) : base(eventManager, configurationService, dataServices, dialogService,
                                                                              manager, controller)
 {
     AssistCommand      = new DelegateCommand <object>(OnAssistCommand);
     ItemChangedCommand = new DelegateCommand <object>(OnChangedField);
     ShowOfficesCommand = new DelegateCommand <object>(ShowOffices);
     _newCommand        = new DelegateCommand(OnNewCommand);
     _assistDataService = dataServices.GetAssistDataServices();
     AssistMapper       = _assistDataService.Mapper;
     AssistExecuted    += CompanyAssistResult;
     EventManager.RegisterObserverSubsystem(MasterModuleConstants.CompanySubSystemName, this);
     ViewModelUri = new Uri("karve://company/viewmodel?id=" + Guid.ToString());
     ItemName     = "Empresa";
     ActiveSubSystem();
 }
예제 #10
0
        /// <summary>
        /// InvoiceInfoViewModel.
        /// </summary>
        /// <param name="dataServices">DataServices</param>
        /// <param name="dialogServices"></param>
        /// <param name="manager"></param>
        /// <param name="container"></param>
        /// <param name="regionManager"></param>
        /// <param name="controller"></param>

        public InvoiceInfoViewModel(IDataServices dataServices,
                                    IDialogService dialogServices,
                                    IEventManager manager,
                                    IConfigurationService configurationService,
                                    IRegionManager regionManager,
                                    IInteractionRequestController controller) : base(dataServices,
                                                                                     controller,
                                                                                     dialogServices,
                                                                                     manager, configurationService)
        {
            _dataServices       = dataServices;
            _regionManager      = regionManager;
            _invoiceDataService = _dataServices.GetInvoiceDataServices();
            LineVisible         = true;
            CollectionView      = new ObservableCollection <InvoiceSummaryViewObject>();
            AssistMapper        = _dataServices.GetAssistDataServices().Mapper;
            ItemChangedCommand  = new Prism.Commands.DelegateCommand <IDictionary <string, object> >(OnChangedCommand);
            NavigateCommand     = new DelegateCommand <object>(OnNavigate);
            AssistCommand       = new DelegateCommand <object>(OnAssistCommand);
            AddNewClientCommand = new DelegateCommand <object>(OnAddNewClientCommand);
            OpenContractCommand = new DelegateCommand <object>(OnOpenContract);
            OpenVehiclesCommand = new DelegateCommand <object>(OnOpenVehicles);

            AssistExecuted += OnAssistExecuted;
            CompanyName     = String.Empty;
            AddressName     = String.Empty;
            List <string> colList;
            var           genericInovice = new InvoiceSummaryViewObject();

            colList = genericInovice.GetType().GetProperties().Select(value => value.Name).ToList();

            GridColumns = new List <string>()
            {
                "AgreementCode", "VehicleCode", "Opciones", "Description", "Quantity", "Price", "Discount", "Subtotal",
                "Unity", "Iva"
            };

            /*
             * This is a cell grid presentation item
             */
            var presenter = new ObservableCollection <CellPresenterItem>()
            {
                new NavigationAwareItem()
                {
                    DataTemplateName = "NavigateInvoiceItem", MappingName = "AgreementCode", RegionName = RegionNames.LineRegion
                },
                new NavigationAwareItem()
                {
                    DataTemplateName = "NavigateVehicleItem", MappingName = "VehicleCode", RegionName = RegionNames.LineRegion
                }
            };

            CellGridPresentation = presenter;
            EventManager.RegisterObserverSubsystem(InvoiceModule.InvoiceSubSystem, this);
            var gid = Guid.NewGuid();

            GridIdentifier  = GridIdentifiers.InvoiceLineGrids;
            ViewModelUri    = new Uri("karve://invoice/viewmodel?id=" + gid.ToString());
            MailBoxHandler += IncomingMailBox;
            SubSystem       = DataSubSystem.InvoiceSubsystem;
            RegisterMailBox(ViewModelUri.ToString());
        }
 private void InitServices(IDataServices services, IConfigurationService configurationService)
 {
     _userSettings           = configurationService.UserSettings;
     _dataReservationService = services.GetReservationRequestDataService();
     _assistDataService      = services.GetAssistDataServices();
 }