public AuthenticationService(
     IFrontServiceClient hubFacade,
     IStorageService storage)
 {
     _hubFacade = hubFacade;
     _storage   = storage;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SaleWindowViewModel"/> class.
 /// </summary>
 public SaleWindowViewModel()
 {
     this.frontServiceClient       = FrontServiceDIContainer.Resolve <IFrontServiceClient>();
     this.SaleCommand              = new RelayCommand(cmd => this.Sale(), cmd => this.CanSale());
     this.WarehouseGoodsCollection = this.frontServiceClient.GetAllWarehouseGoods().ToObservableCollection();
     this.SelectedIndex            = -1;
 }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RegistrationWindowViewModel"/> class.
        /// </summary>
        public RegistrationWindowViewModel()
        {
            this.RegistrateCommand = new RelayCommand(cmd => this.Registrate(), cmd => this.CanRegistrate());
            this.CancleCommand     = new RelayCommand(cmd => this.Cancle());

            this.frontServiceClient = FrontServiceDIContainer.Resolve <IFrontServiceClient>();
        }
Beispiel #4
0
        public ChatViewModel(Window currentWindow, IFrontServiceClient frontServiceClient, UserDTO loggedUser)
        {
            this.currentWindow      = currentWindow;
            this.frontServiceClient = frontServiceClient;
            this.loggedUser         = loggedUser;

            this.currentWindow.Title = $"Чат {loggedUser.LastName} {loggedUser.FirstName} {loggedUser.MiddleName}";

            this.SendMessageCommand  = new RelayCommand(_ => this.SendMessage());
            this.EditSettingsCommand = new RelayCommand(_ => this.EditSettings());

            currentWindow.Closing += this.CurrentWindowOnClosing;

            var sendAllUser = new UserDTO {
                Id = 0, LastName = "Всем"
            };

            this.ConnectedUsers.Add(sendAllUser);
            this.sendingTo = sendAllUser;

            this.updateMessageTimer = new Timer {
                Interval = int.Parse(ConfigurationManager.AppSettings["ChatReadingDelay"]), Enabled = true
            };
            this.updateMessageTimer.Elapsed += this.UpdateMessageTimerOnElapsed;
            this.updateMessageTimer.Start();
        }
Beispiel #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LoginWindowViewModel"/> class.
        /// </summary>
        public LoginWindowViewModel()
        {
            this.frontServiceClient = FrontServiceDIContainer.Resolve <IFrontServiceClient>();

            this.LoginCommand        = new RelayCommand(cmd => this.Login(), can => this.CanLogin());
            this.RegistrationCommand = new RelayCommand(cmd => this.Registration());
        }
Beispiel #6
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="LoginViewModel" /> class.
        /// </summary>
        public LoginViewModel()
        {
            // for stub
            this.frontServiceClient = new FrontServiceClientStub();

            // this.frontServiceClient = new FrontServiceClient();
        }
Beispiel #7
0
        private void AppExit(object sender, ExitEventArgs args)
        {
            IFrontServiceClient frontServiceClient = ServiceManager.GetInstance().GetManager("FrontServiceClient") as IFrontServiceClient;

            frontServiceClient.ConnectionClose();
            this.Shutdown();
        }
        public UserService(
            IFrontServiceClient hubFacade)
        {
            _hubFacade = hubFacade;

            _hubFacade.UserHub.Notify += Notify.Invoke;
        }
Beispiel #9
0
        public NoteService(
            IFrontServiceClient hubFacade)
        {
            _hubFacade = hubFacade;

            _hubFacade.NotesHub.Notify += Notify.Invoke;
        }
        public LoginViewModel()
        {
            //for stub
            //frontServiceClient = new FrontServiceClientStub();

            //for real
            frontServiceClient = ServiceManager.GetInstance().GetManager("FrontServiceClient") as IFrontServiceClient;
        }
Beispiel #11
0
        public RegistrationViewModel(Window currentWindow, IFrontServiceClient frontServiceClient)
        {
            this.currentWindow      = currentWindow;
            this.frontServiceClient = frontServiceClient;

            this.CancelCommand       = new RelayCommand(_ => this.Cancel());
            this.RegistrationCommand = new RelayCommand(_ => this.RegistrationUser());
        }
Beispiel #12
0
        public ViewModelLogin(IEnterValidationRule enterValidationRule, IMainWindowController mainWindowController, IFrontServiceClient frontServiceClient)
        {
            this.validatablePropertyCollection.Add("Login");
            this.validatablePropertyCollection.Add("Password");

            this.enterValidationRule  = enterValidationRule;
            this.mainWindowController = mainWindowController;
            this.frontServiceClient   = frontServiceClient;
        }
Beispiel #13
0
        public ViewModelFactory(IMainWindowController mainWindowController, IFrontServiceClient frontServiceClient)
        {
            _mainWindowController = mainWindowController;
            _frontServiceClient   = frontServiceClient;

            _viewModelCollection.Add(typeof(LoginViewModel), new LoginViewModel(_mainWindowController, frontServiceClient));
            _viewModelCollection.Add(typeof(RegisterViewModel), new RegisterViewModel(_mainWindowController, frontServiceClient));
            _viewModelCollection.Add(typeof(DashboardViewModel), new DashboardViewModel(_mainWindowController, frontServiceClient));
        }
Beispiel #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FindByClassAndPeriodWindowViewModel"/> class.
        /// </summary>
        /// <param name="warehouseWindowViewModel">
        /// The warehouse window view model.
        /// </param>
        public FindByClassAndPeriodWindowViewModel(WarehouseWindowViewModel warehouseWindowViewModel)
        {
            this.warehouseWindowViewModel = warehouseWindowViewModel;
            this.frontServiceClient       = FrontServiceDIContainer.Resolve <IFrontServiceClient>();
            this.GoodsClassCollection     = this.frontServiceClient.GetAllGoodsClass().ToObservableCollection();
            this.FindCommand = new RelayCommand(cmd => this.Find());

            this.SelectedClassIndex = -1;
        }
Beispiel #15
0
        public ViewModelReport(IReportValidationRule reportValidationRule, IMainWindowController mainWindowController, IFrontServiceClient frontServiceClient, User user)
        {
            this.validatablePropertyCollection.Add("SinceDate");
            this.validatablePropertyCollection.Add("ToDate");

            this.reportValidationRule = reportValidationRule;
            this.mainWindowController = mainWindowController;
            this.frontServiceClient   = frontServiceClient;
            this.user = user;
        }
Beispiel #16
0
        public void LoadReport(User user, IFrontServiceClient frontServiceClient)
        {
            this.mainWindow.Dispatcher.Invoke(() =>
            {
                this.mainWindow.WindowState           = WindowState.Normal;
                this.mainWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            });

            this.SetElement(mainWindow, (UIElement)viewFactory.CreateViewReport(user, frontServiceClient));
        }
Beispiel #17
0
        public ViewModelMain(IProductByDateValidationRule productByDateValidationRule, ISaleByDateValidationRule saleByDateValidationRule, IMainWindowController mainWindowController, IFrontServiceClient frontServiceClient, User user)
        {
            this.validatablePropertyCollection.Add("SinceDate");
            this.validatablePropertyCollection.Add("ToDate");

            this.productByDateValidationRule = productByDateValidationRule;
            this.saleByDateValidationRule    = saleByDateValidationRule;
            this.mainWindowController        = mainWindowController;
            this.frontServiceClient          = frontServiceClient;
            this.user = user;
        }
Beispiel #18
0
        public ViewModelSale(ISaleValidationRule saleValidationRule, IProductValidationRule productValidationRule, IMainWindowController mainWindowController, IFrontServiceClient frontServiceClient, Seller seller, User user)
        {
            this.validatablePropertyCollection.Add("Product");
            this.validatablePropertyCollection.Add("Count");
            this.validatablePropertyCollection.Add("Datetime");

            this.saleValidationRule    = saleValidationRule;
            this.productValidationRule = productValidationRule;
            this.mainWindowController  = mainWindowController;
            this.frontServiceClient    = frontServiceClient;
            this.seller = seller;
            this.user   = user;
        }
 public ViewProfileViewModel()
 {
     //try
     //{
     frontServiceClient = ServiceManager.GetInstance().GetManager("FrontServiceClient") as IFrontServiceClient;
     this.Transform(this.frontServiceClient);
     //this.ValidatedProperties.Add("Profile");
     //}
     //catch (Exception ex)
     //{
     //    throw ex;
     //}
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="AddOrModifyProviderWindowViewModel"/> class.
        /// </summary>
        public AddOrModifyProviderWindowViewModel()
        {
            this.frontServiceClient = FrontServiceDIContainer.Resolve <IFrontServiceClient>();
            this.AddGoodsCommand    = new RelayCommand(cmd => this.AddGoods(), cmd => this.CanAddGoods());
            this.AddProviderCommand = new RelayCommand(cmd => this.AddProvider());
            this.ProviderIndeSelectedSelectedChangedCommand = new RelayCommand(cmd => this.ProviderIndeSelectedSelected());
            this.GoodsSelectedChangedCommand = new RelayCommand(cmd => this.GoodsSelectedChanged());
            this.UpdateCommand = new RelayCommand(cmd => this.Update(), cmd => this.CanUpdate());

            this.ProviderCollectionSelectedIndex = -1;
            this.GoodsCollectionSelectionIndex   = -1;

            this.ProviderCollection      = this.frontServiceClient.GetAllProvider().ToObservableCollection();
            this.GoodsClassCollection    = this.frontServiceClient.GetAllGoodsClass().ToObservableCollection();
            this.GoodsCategoryCollection = this.frontServiceClient.GetAllGoodsCategory().ToObservableCollection();
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="DashboardViewModel" /> class.
        /// </summary>
        public DashboardViewModel()
        {
            this.departmentViewModel = new DepartmentViewModel();

            // For Stub
            // this.frontServiceClient = new FrontServiceClientStub();

            // For real
            this.frontServiceClient = new FrontServiceClient();
            this.Departments        = this.departmentViewModel.CreateDepartments();

            // Connect to server
            var hubConnectionUrl = ConfigurationManager.AppSettings["ServiceUrl"];

            this.frontServiceClient.Connect(hubConnectionUrl);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="WarehouseWindowViewModel"/> class.
        /// </summary>
        /// <param name="userId">
        /// The user Id.
        /// </param>
        public WarehouseWindowViewModel(int userId)
        {
            this.userId = userId;

            this.frontServiceClient = FrontServiceDIContainer.Resolve <IFrontServiceClient>();

            this.WarehouseGoodsCollection = this.frontServiceClient.GetAllWarehouseGoods().ToObservableCollection();

            this.WindowCloseCommand               = new RelayCommand(cmd => this.WindowClose());
            this.OnWarehouseCommand               = new RelayCommand(cmd => this.OnWarehouse());
            this.DeliverCommand                   = new RelayCommand(cmd => this.Deliver());
            this.SaleCommand                      = new RelayCommand(cmd => this.Sale());
            this.FindByProviderCommand            = new RelayCommand(cmd => this.FindByProvider());
            this.FindByClassAndPeriodCommand      = new RelayCommand(cmd => this.FindByClassAndPeriod());
            this.ReportByPeriodAndTypeCommand     = new RelayCommand(cmd => this.ReportByPeriodAndType());
            this.ReportSumFromSalesCommand        = new RelayCommand(cmd => this.ReportSumFromSales());
            this.ReportSalesRevenueCommand        = new RelayCommand(cmd => this.ReportSalesRevenue());
            this.ReportByCategoryAndPeriodCommand = new RelayCommand(cmd => this.ReportByCategoryAndPeriod());
        }
Beispiel #23
0
        public ViewModelProduct(IArrivedGoodsValidationRule arrivedGoodsValidationRule, IProductValidationRule productValidationRule, IMainWindowController mainWindowController, IFrontServiceClient frontServiceClient, ArrivedGoods arrivedGoods, Product product, Seller seller, User user, int id)
        {
            this.validatablePropertyCollection.Add("Unit");
            this.validatablePropertyCollection.Add("Count");
            this.validatablePropertyCollection.Add("Datetime");
            this.validatablePropertyCollection.Add("ExpirationDate");
            this.validatablePropertyCollection.Add("PurchasePrice");
            this.validatablePropertyCollection.Add("SalesPrice");
            this.validatablePropertyCollection.Add("ReturnedDate");

            this.arrivedGoodsValidationRule = arrivedGoodsValidationRule;
            this.productValidationRule      = productValidationRule;
            this.mainWindowController       = mainWindowController;
            this.frontServiceClient         = frontServiceClient;
            this.seller       = seller;
            this.product      = product;
            this.arrivedGoods = arrivedGoods;
            this.user         = user;
            this.id           = id;
        }
Beispiel #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DeliverWindowViewModel"/> class.
        /// </summary>
        public DeliverWindowViewModel()
        {
            this.frontServiceClient = FrontServiceDIContainer.Resolve <IFrontServiceClient>();

            this.ProviderSelectionChangedCommand         = new RelayCommand(cmd => this.ProviderSelectionChanged());
            this.GoodsClassSelectionChangedCommand       = new RelayCommand(cmd => this.GoodsClassSelectionChanged());
            this.GoodsCategorySelectionChangedCommand    = new RelayCommand(cmd => this.GoodsCategorySelectionChanged());
            this.GoodsProviderGridSelectedChangedCommand = new RelayCommand(cmd => this.GoodsProviderGridSelectedChanged());
            this.AddGoodsToDeliveryCommand      = new RelayCommand(cmd => this.AddGoodsToDelivery(), cmd => this.CanAddGoodsToDelivery());
            this.DeleteGoodsFromDeviveryCommand = new RelayCommand(cmd => this.DeleteGoodsFromDevivery(), cmd => this.CanDeleteGoodsFromDevivery());
            this.DeliverCommand             = new RelayCommand(cmd => this.Deliver(), cmd => this.CanDeliver());
            this.NewDeliverCommand          = new RelayCommand(cmd => this.NewDeliver());
            this.AddOrModifyProviderCommand = new RelayCommand(cmd => this.AddOrModifyProvider());

            this.ProviderCollection      = this.frontServiceClient.GetAllProvider().ToObservableCollection();
            this.GoodsCategoryCollection = this.frontServiceClient.GetAllGoodsCategory().ToObservableCollection();
            this.GoodsClassCollection    = this.frontServiceClient.GetAllGoodsClass().ToObservableCollection();

            this.WarehouseGoodsGridSelectedIndex   = -1;
            this.ProviderListBoxSelectedIndex      = -1;
            this.GoodsClassListBoxSelectedIndex    = -1;
            this.GoodsCategoryListBoxSelectedIndex = -1;
        }
Beispiel #25
0
        public void LoadProduct(int id, User user, ArrivedGoods arrivedGoods, Product product, Seller seller, IFrontServiceClient frontServiceClient)
        {
            this.mainWindow.Dispatcher.Invoke(() =>
            {
                this.mainWindow.WindowState           = WindowState.Normal;
                this.mainWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            });

            this.SetElement(mainWindow, (UIElement)viewFactory.CreateViewProduct(id, arrivedGoods, product, seller, user, frontServiceClient));
        }
 public DashboardViewModel(IMainWindowController mainWindowController, IFrontServiceClient frontServiceClient) :
     base(mainWindowController, frontServiceClient)
 {
 }
 /// <summary>
 /// The Transform.
 /// </summary>
 public void Transform(IFrontServiceClient frontServiceClient)
 {
     this.Profile = "Hello, " + frontServiceClient.GetMember().Login + "!" + "\n" + "You have " + frontServiceClient.GetProfile() + " message(s).";
 }
 public SystemSaleController(SystemSettings systemSettings, IFrontServiceClient frontServiceClient)
 {
     this.systemSettings     = systemSettings;
     this.frontServiceClient = frontServiceClient;
 }
Beispiel #29
0
 public AddMessageViewModel()
 {
     frontServiceClient = ServiceManager.GetInstance().GetManager("FrontServiceClient") as IFrontServiceClient;
 }
Beispiel #30
0
 public void SetUp()
 {
     this.frontServiceClient = new FrontServiceClient(new ChatServiceClient("http://localhost:8080"));
 }