//==============================================================================


        public OrderOutAddNewViewModel(
            AppRepository <KfsContext> aAppDbRepository, TDStransactionControl aTDStransactionControl)
            : base(aAppDbRepository, aTDStransactionControl)
        {
            _myView             = new OrderOutAddNewView();
            _myView.DataContext = this;

            Command_NavigatBack = new RelayCommand(NavigateBack);
            Command_ToMainMenu  = new RelayCommand(NavigateToMainMenu);
            Command_Save        = new RelayCommand(SaveToDB, CanSaveToDB);
            Command_SeeInvoice  = new RelayCommand(SeeInvoice, CanSeeInvoice);
            Command_NewClient   = new RelayCommand(NavigateToNewclient);
            Command_ClearOrder  = new RelayCommand(ClearOrder);


            Command_DataGridProductsButtonclick = new RelayCommand(DataGridProductsButtonclick);
            Command_DataGridOrdersButtonclick   = new RelayCommand(DataGridOrdersButtonclick);

            //moeilijk doen over ICollection :-(
            ClientsAll = _appDbRespository.Client.GetAllClientsWithAdress();
            foreach (Client clnt in ClientsAll)
            {
                clnt.CltAddresssAsList = clnt.CltAddresss.ToList();
            }


            RefreshData();
        }
        //==============================================================================================================
        public QuatationsViewModel(AppRepository <KfsContext> aAppDbRepository, TDStransactionControl aTDStransactionControl)
            : base(aAppDbRepository, aTDStransactionControl)
        {
            _myView             = new QuatationsView();
            _myView.DataContext = this;

            //(_myView as QuatationsView).haha.DataContext = this;

            Command_NavigatBack = new RelayCommand(NavigateBack);
            Command_ToMainMenu  = new RelayCommand(NavigateToMainMenu);


            watcher.Path                = PATH_PENDING;
            watcher.Created            += new FileSystemEventHandler(OnPendingFilesChanged);
            watcher.Deleted            += new FileSystemEventHandler(OnPendingFilesChanged);
            watcher.EnableRaisingEvents = true;


            Command_MakeJson         = new RelayCommand(MakeJsonSjabloon, CanMakeJsonSjabloon);
            Command_NewProduct       = new RelayCommand(AddNewProduct, CanAddNewProduct);
            Command_ConfirmQuatation = new RelayCommand(ConfirmQuatation, CanConfirmQuatation);

            SuppliersAll = aAppDbRepository.Supplier.GetAll().ToList();

            //TestString = "joske";
            //Command_test = new RelayCommand(testcoommand);

            LoadPendingJsonFiles();
        }
        //==============================================================================


        public InvoiceViewModel(
            AppRepository <KfsContext> aAppDbRepository, TDStransactionControl aTDStransactionControl)
            : base(aAppDbRepository, aTDStransactionControl)
        {
            _myView             = new InvoiceView();
            _myView.DataContext = this;


            Command_NavigatBack = new RelayCommand(NavigateBack);
            Command_ToMainMenu  = new RelayCommand(NavigateToMainMenu);
            Command_Print       = new RelayCommand(Print);

            //BrowserUri. = @"C:\Users\Tompie_HD2\source\repos\KFSolutions\KFSolutionsWPF\bin\Debug\accountancy\invoices\CV_dilenTom.pdf";
        }
Exemple #4
0
        //==============================================================================


        public OrderInHandlerViewModel(
            AppRepository <KfsContext> aAppDbRepository, TDStransactionControl aTDStransactionControl)
            : base(aAppDbRepository, aTDStransactionControl)
        {
            _myView             = new OrderInHandlerView();
            _myView.DataContext = this;


            Command_NavigatBack = new RelayCommand(NavigateBack);
            Command_ToMainMenu  = new RelayCommand(NavigateToMainMenu);
            Command_Save        = new RelayCommand(SaveToDB, CanSaveToDB);
            Command_CheckChange = new RelayCommand(CheckChange);


            RefreschData();
        }
        public FrmSetNumberOfProductsByOrdersOut(TDStransactionControl aTdsTransactionControl, Product aProduct, int aMaxNumberOfProducts)
        {
            this.Owner = aTdsTransactionControl.ParentWindow;

            InitializeComponent();
            txtCaption1.FontSize = 16;
            txtCaption1.Text     = "Produkt: " + aProduct.ProductTitle + "\n";
            //txtCaption1.FontSize = 16;
            txtCaption1.Text += "EAN: " + aProduct.EAN + "\n";
            txtCaption1.Text += $"geef het aantal in dat je wil bestellen [max {aMaxNumberOfProducts}]";

            numInput.Value   = 1;
            numInput.Maximum = aMaxNumberOfProducts;
            numInput.Minimum = 1;
            numInput.Font    = new Font("Segoe UI", 20);;

            numInput.Select();
        }
Exemple #6
0
        //==============================================================================


        public SupplierDetailsViewModel(
            AppRepository <KfsContext> aAppDbRepository, TDStransactionControl aTDStransactionControl)
            : base(aAppDbRepository, aTDStransactionControl)
        {
            _myView             = new SupplierDetailsView();
            _myView.DataContext = this;


            ItemsFromDB = _appDbRespository.Supplier.GetAllForOverview();

            Command_NavigatBack   = new RelayCommand(NavigateBack);
            Command_ToMainMenu    = new RelayCommand(NavigateToMainMenu);
            Command_ToNewSupplier = new RelayCommand(NavigateToNewSupplier);

            Command_DeleteDBitemButtonInDatagridClick = new RelayCommand(DeleteDBitemButtonInDatagridClick);
            Command_UpdateDBitemButtonInDatagridClick = new RelayCommand(UpdateDBitemButtonInDatagridClick);
            Command_ViewDBitemButtonInDatagridClick   = new RelayCommand(ViewDBitemButtonInDatagridClick);
        }
        //===========================================================================================================


        public StockManagementViewModel(
            AppRepository <KfsContext> aAppDbRepository, TDStransactionControl aTDStransactionControl)
            : base(aAppDbRepository, aTDStransactionControl)
        {
            _myView             = new StockManagementView();
            _myView.DataContext = this;


            Command_NavigatBack = new RelayCommand(NavigateBack);
            Command_ToMainMenu  = new RelayCommand(NavigateToMainMenu);
            Command_Save        = new RelayCommand(SaveToDB, CanSaveToDB);


            Command_DataGridProductSelectionChanged = new RelayCommand(DataGridProductSelectionChanged);
            Command_CheckInDatagridSuppliers        = new RelayCommand(CheckInDatagridSuppliers);



            RefreschData();
        }
Exemple #8
0
        //==============================================================================

        public ClientAddNewViewModel(AppRepository <KfsContext> aAppDbRepository, TDStransactionControl aTDStransactionControl, Client aClient = null)
            : base(aAppDbRepository, aTDStransactionControl)
        {
            _myView             = new ClientAddNewView();
            _myView.DataContext = this;


            Command_NavigatBack = new RelayCommand(NavigateBack);
            Command_ToMainMenu  = new RelayCommand(NavigateToMainMenu);

            Command_AddClient = new RelayCommand(SaveClient);


            NewClient = aClient;

            if (aClient == null)
            {
                IsNewMode = true;

                NewClient = new Client()
                {
                    IsActive = true
                };
                NewClient.CltAddresss = new List <CltAddress>()
                {
                    new CltAddress()
                };
                //NewClient.CltWebCredentials = new CltWebCredentials();

                NewClient.CltAddresssAsList = new List <CltAddress>()
                {
                    new CltAddress()
                };
            }
            else
            {
                Header = "Klant bewerken";

                NewClient.CltAddresssAsList = NewClient.CltAddresss.ToList(); // new List<CltAddress>() { new CltAddress() };
            }
        }
        //==============================================================================
        public EmployeeAddNewViewModel(
            AppRepository <KfsContext> aAppDbRepository, TDStransactionControl aTDStransactionControl, Employee aEmployee = null)
            : base(aAppDbRepository, aTDStransactionControl)
        {
            _myView             = new EmployeeAddNewView();
            _myView.DataContext = this;

            DepartmentsAvailable          = aAppDbRepository.EmpDepartment.GetAll().ToList();
            ContractStatuutTypesAvailable = aAppDbRepository.EmpContractStatuutType.GetAll().ToList();
            ContractTypesAvailable        = aAppDbRepository.EmpContractType.GetAll().ToList();
            //string k = DepartmentsAvailable[0].DescriptionNL

            Command_NavigatBack = new RelayCommand(NavigateBack);
            Command_ToMainMenu  = new RelayCommand(NavigateToMainMenu);

            Command_AddEmployee = new RelayCommand(SaveEmployee);



            NewEmployee = aEmployee;
            if (aEmployee == null)
            {
                IsNewMode = true;

                NewEmployee                         = new Employee();
                NewEmployee.IsActive                = true;
                NewEmployee.EmpAddress              = new EmpAddress();
                NewEmployee.EmpContract             = new EmpContract();
                NewEmployee.EmpAppAccount           = new EmpAppAccount();
                NewEmployee.EmpContract.DateOfStart = DateTime.Now;
                NewEmployee.DateOfBirth             = new DateTime(2000, 1, 1);
                NewEmployee.IsActive                = true;
            }


            if (IsNewMode == false)
            {
                Header = "Werknemer bewerken";
            }
        }
Exemple #10
0
        //==============================================================================


        public ProductDetailsViewModel(
            AppRepository <KfsContext> aAppDbRepository, TDStransactionControl aTDStransactionControl)
            : base(aAppDbRepository, aTDStransactionControl)
        {
            _myView             = new ProductDetailsView();
            _myView.DataContext = this;


            Command_NavigatBack = new RelayCommand(NavigateBack);
            Command_ToMainMenu  = new RelayCommand(NavigateToMainMenu);

            Command_AddNewProduct = new RelayCommand(NavigateToNewEmployee);

            Command_UpdateDBitemButtonInDatagridClick = new RelayCommand(UpdateDBitemButtonInDatagridClick);

            ItemsFromDB = _appDbRespository.Product.GetAllForOverview();
            foreach (var item in ItemsFromDB)
            {
                item.Supplier_Product_Prices = item.Supplier_Product_Prices.DistinctBy(p => p.Id_Supplier).ToList();
            }
            //_ProductsForStockManagement.ProductForStockDTO.DistinctBy(p => p.EAN).Select(x => x).ToList();


            //.Include(nameof(Product.Supplier_Product_Prices))
            //.Include(nameof(Product.Supplier_Product_Prices) + "." + nameof(Supplier_Product_Price.Supplier))
            ////.Include(nameof(Employee.EmpContract) + "." + nameof(EmpContract.EmpContractStatuutType))
            ////.Include(nameof(Employee.EmpContract) + "." + nameof(EmpContract.EmpContractType))
            ////.Include(nameof(Employee.EmpAppAccount))
            //.ToList();



            //EAN
            //ProductTitle
            //SellingPriceRecommended
            //BTWpercentage
            //WareHouseLocation
        }
Exemple #11
0
 public _appViewModel(AppRepository <KfsContext> aAppDbRepository, TDStransactionControl aTDStransactionControl)
     : base(aTDStransactionControl)
 {
     _appDbRespository = aAppDbRepository;
 }
Exemple #12
0
 public _BaseDialog(TDStransactionControl aTdsTransactionControl)
 {
     this.Owner = aTdsTransactionControl.ParentWindow;
     InitializeComponent();
 }
Exemple #13
0
        //==============================================================================


        public CompanyBalanceSheetViewModel(
            AppRepository <KfsContext> aAppDbRepository, TDStransactionControl aTDStransactionControl)
            : base(aAppDbRepository, aTDStransactionControl)
        {
            _myView             = new CompanyBalanceSheetView();
            _myView.DataContext = this;


            Command_NavigatBack = new RelayCommand(NavigateBack);
            Command_ToMainMenu  = new RelayCommand(NavigateToMainMenu);


            Command_ViewInvoiceButtonInDatagridClick = new RelayCommand(ViewInvoiceButtonInDatagridClick);


            //===============================================================================
            //data uit db laden
            //===============================================================================

            _OrdersOutFromDB = _appDbRespository.OrderOut.GetForBalance();

            foreach (var item in _OrdersOutFromDB)
            {
                item._FullNameClient         = item.Client.FirstName + " " + item.Client.NameAddition + " " + item.Client.LastName;
                item._FullNameEmployeeSolded = item.SoldBy.FirstName + " " + item.SoldBy.NameAddition + " " + item.SoldBy.LastName;
                foreach (var ol in item.OrderLineOuts)
                {
                    item._TTverkoopPrijs += (ol.NumberOfProducts * ol.UnitPrice);
                    item._AantalStuks    += ol.NumberOfProducts;
                }
            }

            //-----------------------------------------------------------------------------------------

            _OrdersInFromDB = _appDbRespository.OrderIn.GetForBalance();

            foreach (var item in _OrdersInFromDB)
            {
                if (item.HandledBy != null)
                {
                    item._FullNameEmployeeHandledBy = item.HandledBy.FirstName + " " + item.HandledBy.NameAddition + " " + item.HandledBy.LastName;
                }
                item._FullNameEmployeeOrderedBy = item.OrderedBy.FirstName + " " + item.OrderedBy.NameAddition + " " + item.OrderedBy.LastName;
                //item._FullNameSupplier = item.Supplier. + " " + item.OrderedBy.NameAddition + " " + item.OrderedBy.LastName;

                foreach (var ol in item.OrderLineIns)
                {
                    item._TTaankoopPrijs += (ol.NumberOfProducts * ol.UnitPrice);
                    item._AantalStuks    += (ol.NumberOfProducts);
                }
            }

            //-----------------------------------------------------------------------------------------

            _ProductsFromDB = _appDbRespository.Product.GetForBalance();

            foreach (var item in _ProductsFromDB)
            {
                item.CalculatatedStockValue = item.CountInStock * item.SellingPriceRecommended;
            }


            //-----------------------------------------------------------------------------------------
            _ProductHelpersWorkerList = new List <ProductHelper>();
            foreach (var item in _OrdersOutFromDB)
            {
                foreach (var ol in item.OrderLineOuts)
                {
                    _ProductHelpersWorkerList.Add(new ProductHelper()
                    {
                        EAN              = ol.EAN_Product,
                        ProductTitle     = ol.Product.ProductTitle,
                        UnitPrice        = ol.UnitPrice,
                        NumberOfProducts = ol.NumberOfProducts,
                        TTPrice          = ol.UnitPrice * ol.NumberOfProducts,
                        DateSaled        = (DateTime)item.SoldAt,
                        EmpSaled         = item.SoldBy,
                        EmpFullName      = item.SoldBy.FirstName + " " + item.SoldBy.NameAddition + " " + item.SoldBy.LastName,
                    });
                }
            }



            //===============================================================================
            //datums juist zetten waar publics worden geinit
            //===============================================================================

            SelectedDateFrom = DateTime.Now.AddDays(-7).Date;
            SelectedDateTo   = DateTime.Now.Date;

            IsInit = true;
            SelectDate();
        }
Exemple #14
0
 public NavigateReadUserCommand(TDStransactionControl aTransactionControl)
 {
     _transactionControl = aTransactionControl;
 }
        //==============================================================================


        public ProductAddNewViewModel(

            AppRepository <KfsContext> aAppDbRepository,
            TDStransactionControl aTDStransactionControl,
            ViewType aviewType,
            Product aInitProduct = null)
            : base(aAppDbRepository, aTDStransactionControl)
        {
            _myView             = new ProductAddNewView();
            _myView.DataContext = this;
            _viewtype           = aviewType;


            Command_NavigatBack = new RelayCommand(NavigateBack);
            Command_ToMainMenu  = new RelayCommand(NavigateToMainMenu);

            Command_AddProduct = new RelayCommand(SaveProduct);

            //needed for add
            ProductTypesAvailable = _appDbRespository.ProductType.GetAll().ToList();

            NewProduct = new Product()
            {
                CountInStock = 0, BTWpercentage = 21, MinCountInStock = 10, MaxCountInStock = 100
            };

            switch (_viewtype)
            {
            case ViewType.ReadOnly:
                throw new NotImplementedException("niet geimplementeerd");
                break;

            case ViewType.Edit:
                Header = "Bewerk Produkt";
                if (aInitProduct == null)
                {
                    throw new NotImplementedException("ainitproduct mag niet null zijn");
                }
                NewProduct = aInitProduct;
                break;

            case ViewType.New:
                Header    = "Nieuw Produkt";
                IsNewMode = true;
                break;

            case ViewType.NewFromQuatations:
                Header    = "Nieuw Produkt";
                IsNewMode = true;
                if (aInitProduct == null)
                {
                    throw new NotImplementedException("ainitproduct mag niet null zijn");
                }
                NewProduct = aInitProduct;
                break;

            default:
                throw new NotImplementedException("niet geimplementeerd");
                break;
            }
        }
Exemple #16
0
 public NavigateMainMenuCommand(TDStransactionControl aTransactionControl, AppRepository <KfsContext> aAppDbRespository)
 {
     _transactionControl = aTransactionControl;
     _appDbRespository   = aAppDbRespository;
 }