Beispiel #1
0
        public ReestrSettingViewModel(
            ModalNavigationStore modalNavigationStore,
            IBarrelStorageDataService barrelStorageDataService,
            IReestrSettingDataService reestrSettingDataService,
            IRecipeDataService recipeDataService,
            ICustomerDataService customerDataService)
        {
            _modalNavigationStore     = modalNavigationStore;
            _barrelStorageDataService = barrelStorageDataService;
            _reestrSettingDataService = reestrSettingDataService;
            _recipeDataService        = recipeDataService;
            _customerDataService      = customerDataService;

            this.WhenAnyValue(x => x.Password)
            .Throttle(TimeSpan.FromSeconds(1))
            .Where(x => !string.IsNullOrWhiteSpace(x))
            .ObserveOnDispatcher()
            .Subscribe(PasswordChecker);

            this.WhenAnyValue(x => x.SelectedRecipe)
            .Skip(1)
            .SelectMany(async(x) => await _barrelStorageDataService.GetLastBarrelNumber(x))
            .ObserveOnDispatcher()
            .Subscribe(number => ReestrSetting.InitialBarrelNumber = number + 1);

            Task.Run(Initialize);
            SubmitCommand = new DelegateCommand(ExecuteSubmitCommand);
            CancelCommand = new DelegateCommand(() => modalNavigationStore.Close());
        }
Beispiel #2
0
 public CustomersControllerTests()
 {
     _customerDataService       = A.Fake <ICustomerDataService>();
     _addCustomerCommandHandler = A.Fake <ICommandHandler <AddCustomerCommand> >();
     _addContactDetailsForCustomerCommandHandler = A.Fake <ICommandHandler <AddContactDetailsForCustomerCommand> >();
     _sut = new CustomersController(_addCustomerCommandHandler, _addContactDetailsForCustomerCommandHandler, _customerDataService);
 }
Beispiel #3
0
        public CustomerValidator(ICustomerDataService customerDataService, Customer customer)
        {
            if (customer.CustomerCode != null && customer.CustomerCode.Trim().Length > 0)
            {
                customerDataService.CreateSession();
                List <Customer> customers = customerDataService.GetCustomers(customer.CustomerCode);
                customerDataService.CloseSession();
                foreach (Customer existingCustomer in customers)
                {
                    if (existingCustomer.CustomerID != customer.CustomerID)
                    {
                        _validCustomerCode = false;
                        break;
                    }
                }
            }

            RuleFor(a => a.CustomerCode).NotEmpty().WithMessage("Customer Code is required.");
            RuleFor(a => a.CompanyName).NotEmpty().WithMessage("Company Name is required.");
            RuleFor(a => a.CompanyVorname).NotEmpty().WithMessage("CompanyVorname is required.");
            RuleFor(a => a.Salutation).NotEmpty().WithMessage("Salutation is required.");
            RuleFor(a => a.Photo).NotEmpty().WithMessage("Photo is required.");
            RuleFor(a => a.AddressLine1).NotEmpty().WithMessage("AddressLine1 is required.");
            RuleFor(a => a.City).NotEmpty().WithMessage("City is required.");
            RuleFor(a => a.ZipCode).NotEmpty().WithMessage("ZipCode is required.");
            RuleFor(a => a.State).NotEmpty().WithMessage("State is required.");
            RuleFor(a => a.PhoneNumber2).NotEmpty().WithMessage("PhoneNumber2 is required.");
            RuleFor(a => a.EMail).NotEmpty().WithMessage("EMail is required.");

            RuleFor(a => a.CustomerCode).Must(ValidateDuplicateCustomerCode).WithMessage("Customer Code already exists.");
        }
Beispiel #4
0
 public HomeController(Microsoft.AspNetCore.Identity.UserManager <AppUser> userManager, SignInManager <AppUser> signInManager, ICustomerService customerService, ICustomerDataService customerDataService)
 {
     this.userManager         = userManager;
     this.signInManager       = signInManager;
     this.customerService     = customerService;
     this.customerDataService = customerDataService;
 }
Beispiel #5
0
 public InvoicesController(ICustomerDataService customerDataService, IInvoiceDataService invoiceDataService, ICommandHandler <InvoiceCustomerCommand> invoiceCustomerCommandHandler, ICommandHandler <ChangeInvoiceStatusCommand> changeInvoiceStatusCommandHandler)
 {
     _customerDataService               = customerDataService ?? throw new ArgumentNullException(nameof(customerDataService));
     _invoiceDataService                = invoiceDataService ?? throw new ArgumentNullException(nameof(invoiceDataService));
     _invoiceCustomerCommandHandler     = invoiceCustomerCommandHandler ?? throw new ArgumentNullException(nameof(invoiceCustomerCommandHandler));
     _changeInvoiceStatusCommandHandler = changeInvoiceStatusCommandHandler ?? throw new ArgumentNullException(nameof(changeInvoiceStatusCommandHandler));
 }
 public AddCustomerDetailsViewModel(ICustomerDataService customerDataService, IRegionDataService regionDataService)
 {
     _customerDataService = customerDataService;
     _regionDataService = regionDataService;
     _customer = new Customer();
     Regions = new ObservableCollection<Region>();
     GetRegionList();
 }
 public ReestrEditViewModel(ICustomerDataService customerDataService, ModalNavigationStore modalNavigationStore)
 {
     _customerDataService  = customerDataService;
     _modalNavigationStore = modalNavigationStore;
     SubmitCommand         = new DelegateCommand(ExecuteSubmitCommand);
     CancelCommand         = new DelegateCommand(() => modalNavigationStore.Close());
     Task.Run(Initialize);
 }
Beispiel #8
0
 //to avoid injecting all these command handlers, in a production environment I would use MediatR and just inject IMedatior.
 public CustomersController(ICommandHandler <AddCustomerCommand> addCustomerCommandHandler,
                            ICommandHandler <AddContactDetailsForCustomerCommand> addContactDetailsForCustomerCommandHandler,
                            ICustomerDataService customerDataService)
 {
     _addCustomerCommandHandler = addCustomerCommandHandler ?? throw new ArgumentNullException(nameof(addCustomerCommandHandler));
     _addContactDetailsForCustomerCommandHandler = addContactDetailsForCustomerCommandHandler ?? throw new ArgumentNullException(nameof(addContactDetailsForCustomerCommandHandler));
     _customerDataService = customerDataService ?? throw new ArgumentNullException(nameof(customerDataService));
 }
Beispiel #9
0
 public InvoicesControllerTests()
 {
     _customerDataService               = A.Fake <ICustomerDataService>();
     _invoiceDataService                = A.Fake <IInvoiceDataService>();
     _invoiceCustomerCommandHandler     = A.Fake <ICommandHandler <InvoiceCustomerCommand> >();
     _changeInvoiceStatusCommandHandler = A.Fake <ICommandHandler <ChangeInvoiceStatusCommand> >();
     _sut = new InvoicesController(_customerDataService, _invoiceDataService, _invoiceCustomerCommandHandler, _changeInvoiceStatusCommandHandler);
 }
 public UpdateCustomerDetailsViewModel(ICustomerDataService customerDataService, IRegionDataService regionDataService, Customer customer)
 {
     _customerDataService = customerDataService;
     _regionDataService = regionDataService;
     _customer = customer;
     Regions = new ObservableCollection<Region>();
     GetRegionList();
 }
Beispiel #11
0
 public MainWindowViewModel(IEventAggregator eventAggregator)
 {
     _customerDataService    = new CustomerDataService(() => new PlannerDbContext());
     _appointmentDataService = new AppointmentDataService(() => new PlannerDbContext());
     _authDataService        = new AuthenticationDataService(() => new PlannerDbContext());
     _eventAggregator        = eventAggregator;
     CurrentPage             = new LoginPage(new LoginViewModel(_authDataService, _eventAggregator));
     _eventAggregator.GetEvent <UserAuthenticationEvent>().Subscribe(OnUserAuthenticated);
 }
Beispiel #12
0
 public CustomerListViewModel(ICustomerDataService customerDataService, IErrorDataService errorDataService, ICustomerRepository customerRepository)
 {
     _customerDataService = customerDataService;
     _errorDataService    = errorDataService;
     _customerRepository  = customerRepository;
     Customers            = new ObservableCollection <CustomerDto>();
     Equipments           = new ObservableCollection <EquipmentLookup>();
     Departments          = new ObservableCollection <CustomerDepartmentDto>();
 }
Beispiel #13
0
 public void Init()
 {
     customerService  = new CustomerDataService();
     accountService   = new AccountDataService();
     unit             = new UnitOfWork.UnitOfWork(customerService, accountService);
     payoff           = new UnitOfWork.Payoff(1, 300m, unit);
     accounts         = payoff.GetAccounts().ToList().OrderBy(a => a.DailyInterest()).ToList();
     payoff._Accounts = accounts;
 }
Beispiel #14
0
 public AuthorisationMiddleware(
     RequestDelegate requestDelegate,
     ILogger logger,
     ICustomerDataService customerDataService)
 {
     _next   = requestDelegate ?? throw new ArgumentNullException(nameof(requestDelegate));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _customerDataService = customerDataService ?? throw new ArgumentNullException(nameof(customerDataService));
 }
Beispiel #15
0
        public CustomersControllerTests()
        {
            // Arrange
            var services = new ServiceCollection();

            services.AddTransient <ICustomerDataService, MockCustomerDataService>();
            var serviceProvider = services.BuildServiceProvider();

            _customerDataService = serviceProvider.GetService <ICustomerDataService>();
        }
 public CustomerViewModel(INavigationService navigationService,
                          LocalDatabaseManager localDatabaseManager,
                          ICustomerDataService customerDataService)
 {
     this.Title            = "Customers";
     _navigationService    = navigationService;
     _customerDataService  = customerDataService;
     _localDatabaseManager = localDatabaseManager;
     //_localDatabaseManager
 }
Beispiel #17
0
        public CustomerListViewModel(ICustomerDataService customerDataService, IMessagingService messagingService,
                                     INavigationService navigationService, IToastService toastService, IPhoneService phoneService)
            : base(messagingService, navigationService, toastService)
        {
            _customerDataService = customerDataService;
            _phoneService        = phoneService;

            InitCommands();

            OnLoad();
        }
        public CustomerDetailsViewModel(ICustomerDataService customerDataService,
                                        IMessagingService messagingService, INavigationService navigationService, IToastService toastService)
            : base(messagingService, navigationService, toastService)
        {
            _customerDataService = customerDataService;

            InitCommands();

            _messagingService.Subscribe <CustomerListViewModel, CustomerDTO>
                (this, Messages.SendingCustomer, OnCustomerReceive);
        }
        /// <summary>
        /// Validate Customer
        /// </summary>
        /// <param name="customer"></param>
        /// <param name="dataService"></param>
        public void ValidateCustomer(Customer customer, ICustomerDataService dataService)
        {
            customerDataService = dataService;

            InitializeValidationRules(customer);

            ValidateRequired("FirstName", "First Name");
            ValidateRequired("LastName", "Last Name");
            ValidateRequired("EmailAddress", "Email Address");
            ValidateEmailAddress("EmailAddress", "Email Address");
            ValidateCreditInformation(customer);
        }
        /// <summary>
        /// Validate Customer
        /// </summary>
        /// <param name="customer"></param>
        /// <param name="dataService"></param>
        public void ValidateCustomer(Customer customer, ICustomerDataService dataService)
        {
            customerDataService = dataService;

            InitializeValidationRules(customer);

            ValidateRequired("FirstName", "First Name");
            ValidateRequired("LastName", "Last Name");
            ValidateRequired("EmailAddress", "Email Address");
            ValidateEmailAddress("EmailAddress", "Email Address");
            ValidateCreditInformation(customer);
        }
 public CustomerController(ICustomerDataService customerService,
                           ICustomerRepository customerRepo,
                           IResourceRepository resourceRepo,
                           IUserAccountRepository useraccountRepo,
                           ILikeRepository likeRepo)
 {
     this._customerService = customerService;
     _customerRepo         = customerRepo;
     _resourceRepo         = resourceRepo;
     _useraccountRepo      = useraccountRepo;
     _likeRepo             = likeRepo;
 }
 public CustomerController(ICustomerDataService customerService,
     ICustomerRepository customerRepo,
     IResourceRepository resourceRepo,
     IUserAccountRepository useraccountRepo,
     ILikeRepository likeRepo)
 {
     this._customerService = customerService;
     _customerRepo = customerRepo;
     _resourceRepo = resourceRepo;
     _useraccountRepo = useraccountRepo;
     _likeRepo = likeRepo;
 }
 public PaymentController(IEFRepository<OrderTransactionEntity> ordTranRepo
     , IEFRepository<PaymentNotifyLogEntity> paynotiRepo
     , IOrderRepository orderRepo
     , IOrderLogRepository orderLogRepo,
     ICustomerDataService customerService
     ,IEFRepository<ExOrderEntity> exorderRepo)
 {
     _orderTranRepo = ordTranRepo;
     _paymentNotifyRepo = paynotiRepo;
     _orderRepo = orderRepo;
     _orderlogRepo = orderLogRepo;
     _customerService = customerService;
     _exorderRepo = exorderRepo;
 }
Beispiel #24
0
        public CustomerViewModel(ICustomerDataService customerDataService)
        {
            _customerDataService = customerDataService;

            CreateCustomer = ReactiveCommand.CreateFromTask(ExecuteCreateCreateCustomer);
            CreateCustomer.Subscribe(x => AddCustomer(x));

            var canPrint = this
                           .WhenAnyValue(x => x.SelectedCustomer)
                           .Select(x => x != null);

            PrintCommand = ReactiveCommand.Create <Customer>(ExecutePrintCommand, canPrint);
            Task.Run(Initialize);
        }
Beispiel #25
0
        public CustomerDataController(ICustomerDataService service, IMapper mapper)
        {
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }

            if (mapper == null)
            {
                throw new ArgumentNullException(nameof(mapper));
            }

            this.service = service;
            this.mapper  = mapper;
        }
Beispiel #26
0
        public void InitializeDependencies()
        {
            string integrationType = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["IntegrationType"]);

            if (integrationType == "EntityFramework")
            {
                customerDataService = new EFCustomerService();
            }
            else if (integrationType == "Ado")
            {
                customerDataService = new AdoCustomerService();
            }
            else
            {
                customerDataService = new MockedCustomerService();
            }
        }
        public CustomerDetailViewModel(
            ICustomerDataService dataService,
            IEventAggregator eventAggregator)
        {
            long startTicks = Log.Trace(String.Format("Enter"), Common.LOG_APPNAME);

            _dataService     = dataService;
            _eventAggregator = eventAggregator;

            _eventAggregator.GetEvent <OpenCustomerDetailViewEvent>()
            .Subscribe(OnOpenCustomerDetailView);

            SaveCommand = new DelegateCommand(
                OnSaveExecute, OnSaveCanExecute);

            AddServiceAddressCommand = new DelegateCommand(
                OnAddServiceAddressExecute, OnAddServiceAddressCanExecute);

            Log.Trace(String.Format("Exit"), Common.LOG_APPNAME, startTicks);
        }
Beispiel #28
0
        public CustomerBusinessRules(ICustomerDataService customerDataService, Customer customer)
        {
            if (customer.CustomerCode != null && customer.CustomerCode.Trim().Length > 0)
            {
                customerDataService.CreateSession();
                List <Customer> customers = customerDataService.GetCustomers(customer.CustomerCode);
                customerDataService.CloseSession();
                foreach (Customer existingCustomer in customers)
                {
                    if (existingCustomer.CustomerID != customer.CustomerID)
                    {
                        _validCustomerCode = false;
                        break;
                    }
                }
            }

            RuleFor(a => a.CustomerCode).NotEmpty().WithMessage("Customer Code is required.");
            RuleFor(a => a.CompanyName).NotEmpty().WithMessage("Company Name is required.");
            RuleFor(a => a.CustomerCode).Must(ValidateDuplicateCustomerCode).WithMessage("Customer Code already exists.");
        }
Beispiel #29
0
        public MainPageViewModel(ICustomerDataService customerDataService,
                                 IAppointmentDataService appointmentDataService,
                                 IAuthenticationDataService authDataService, User user)
        {
            _customerDataService    = customerDataService;
            _appointmentDataService = appointmentDataService;
            _authDataService        = authDataService;
            _user                 = user;
            _customers            = new ObservableCollection <CustomerWrapper>();
            _allAppointments      = new ObservableCollection <AppointmentWrapper>();
            _customerAppointments = new ObservableCollection <AppointmentWrapper>();
            _users                = new ObservableCollection <User>();
            _eventAggregator      = new EventAggregator();
            _customerListVM       = new CustomersListViewModel(_eventAggregator, _customers);
            _appointmentListVM    = new AppointmentsListViewModel(_eventAggregator, _customers, _customerAppointments);

            //Initializing all events
            InitializeEvents();

            //creates controls for the main page
            Controls = new Dictionary <ApplicationControls, UserControl>
            {
                [ApplicationControls.CustomersList]    = new CustomersListControl(_customerListVM),
                [ApplicationControls.AppointmentsList] = new AppointmentsListControl(_appointmentListVM),
                [ApplicationControls.Calendar]         = new CalendarControl(new CalendarViewModel(_eventAggregator, _allAppointments)),
                [ApplicationControls.Report]           = new ReportControl(
                    new ReportViewModel(_eventAggregator, _customers, _allAppointments, _users))
            };

            //setting up onLoad control
            CurrentContent = Controls[ApplicationControls.CustomersList];

            //initializing Commands
            CustomersCommand    = new RelayCommand(OnCustomersControlLoad);
            AppointmentsCommand = new RelayCommand(OnAppointmentsControlLoad);
            CalendarCommand     = new RelayCommand(OnCalendarControlLoad);
            ReportCommand       = new RelayCommand(OnReportControlLoad);
            InitCusAppList();
        }
 /// <summary>
 /// Constructor
 /// </summary>
 public CustomerApplicationService(ICustomerDataService dataService)
 {
     _customerDataService = dataService;
 }
 /// <summary>
 /// Initialize Customer Business Rules
 /// </summary>
 /// <param name="customer"></param>
 /// <param name="dataService"></param>
 public void InitializeCustomerBusinessRules(Customer customer, ICustomerDataService dataService)
 {
     customerDataService = dataService;
     InitializeValidationRules(customer);
 }
Beispiel #32
0
 /// <summary>
 /// Constructor
 /// </summary>
 public CustomerBusinessService(ICustomerDataService customerDataService)
 {
     _customerDataService = customerDataService;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public CustomerApplicationService(ICustomerDataService dataService)
 {
     _customerDataService = dataService;
 }
 public CustomerGridViewModel(ICustomerDataService customerDataService)
 {
     _customerDataService = customerDataService;
     Customers = new ObservableCollection<Customer>();
     GetCustomerList();
 }
 /// <summary>
 /// Constructor with Dependency Injection using Ninject
 /// </summary>
 /// <param name="dataService"></param>
 public SeedDataApiController(ICustomerDataService dataService)
 {
     customerDataService = dataService;
 }
 /// <summary>
 /// Constructor with Dependency Injection using Ninject
 /// </summary>
 /// <param name="dataService"></param>
 public SeedDataApiController(ICustomerDataService dataService)
 {
     customerDataService = dataService;
 }
 public GetCustomerActivity(ICustomerDataService customerDataService)
 {
     _customerDataService = customerDataService;
 }
 public CustomerViewModel(ICustomerDataService customerDataService)
 {
     _CustomerDataService = customerDataService;
     Customers            = new ObservableCollection <Customer>();
     NewCustomer          = new Customer();
 }
 public CustomerService(IArchivedDataService archivedDataService, ICustomerDataService customerDataService)
 {
     _archivedDataService = archivedDataService;
     _customerDataService = customerDataService;
 }
 public CustomerBillingService(ICustomerDataService customerDataService)
 {
     _customerDataService = customerDataService;
 }
 public void SetUp()
 {
     _mockedFailoverService = new Mock<IFailoverService>();
     _mockedResponseFactory = new Mock<IDataAccessResponseFactory<CustomerResponse>>();
     _sut= new CustomerDataService(_mockedResponseFactory.Object, _mockedFailoverService.Object);
 }
 public MainWindowViewModel(ICustomerDataService customerDataService)
 {
     _customerDataService = customerDataService;
 }
 public CustomersController(ICustomerDataService customerDataService)
 {
     _customerDataService = customerDataService;
 }
 /// <summary>
 /// Constructor with Dependency Injection using Ninject
 /// </summary>
 /// <param name="dataService"></param>
 public CustomersApiController(ICustomerDataService dataService)
 {
     customerDataService = dataService;
 }
        public void InitializeDependencies()
        {
            string integrationType = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["IntegrationType"]);

            if (integrationType=="EntityFramework")
                customerDataService = new EFCustomerService();
            else if (integrationType=="Ado")
                customerDataService = new AdoCustomerService();
            else
                customerDataService = new MockedCustomerService();
        }