Exemplo n.º 1
0
        public override Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            if (User != null && User.Identity.IsAuthenticated)
            {
                _itemRepo.SetLoggedInUserId(GetUserId());
                _itemRepo.SetLoggedInUserName(GetUserUserName());
                _itemRepo.SetIsAdmin(GetIsUserAdmin());

                _unitRepo.SetLoggedInUserId(GetUserId());
                _unitRepo.SetLoggedInUserName(GetUserUserName());
                _unitRepo.SetIsAdmin(GetIsUserAdmin());

                _itemGroupRepo.SetLoggedInUserId(GetUserId());
                _itemGroupRepo.SetLoggedInUserName(GetUserUserName());
                _itemGroupRepo.SetIsAdmin(GetIsUserAdmin());

                _itemUnitRepo.SetLoggedInUserId(GetUserId());
                _itemUnitRepo.SetLoggedInUserName(GetUserUserName());
                _itemUnitRepo.SetIsAdmin(GetIsUserAdmin());

                _priceRepo.SetLoggedInUserId(GetUserId());
                _priceRepo.SetLoggedInUserName(GetUserUserName());
                _priceRepo.SetIsAdmin(GetIsUserAdmin());

                _itemUnitPriceRepo.SetLoggedInUserId(GetUserId());
                _itemUnitPriceRepo.SetLoggedInUserName(GetUserUserName());
                _itemUnitPriceRepo.SetIsAdmin(GetIsUserAdmin());

                _storeItemUnitRepo.SetLoggedInUserId(GetUserId());
                _storeItemUnitRepo.SetLoggedInUserName(GetUserUserName());
                _storeItemUnitRepo.SetIsAdmin(GetIsUserAdmin());
                _storeItemUnitRepo.SetPeriodId(_periodManager.GetPeriod());
            }
            return(base.OnActionExecutionAsync(context, next));
        }
Exemplo n.º 2
0
        public async Task <List <ErrorViewModel> > CheckAddBill(long typeId, AddBillViewModel model, BillType billType)
        {
            var errors = new List <ErrorViewModel>();

            if (_periodManager.GetPeriod() == Guid.Empty)
            {
                errors.Add(new ErrorViewModel(ErrorType.BadRequest, "", Resources.Global.Common.FinancialPeriodMustBeSpecified));
                return(errors);
            }

            var financialPeriod = await _financialPeriodRepo.FindAsync(_periodManager.GetPeriod());

            if (financialPeriod == null)
            {
                errors.Add(new ErrorViewModel(ErrorType.NotFound, "FinancialPeriodNotFound"));
                return(errors);
            }

            if (!financialPeriod.CheckIfDateInPeriod(model.Date))
            {
                errors.Add(new ErrorViewModel(ErrorType.BadRequest, "Date", Resources.Global.Common.DateOutCurrenctPeriod));
                return(errors);
            }

            billType = await _billTypeRepo.GetAsync(typeId);

            if (billType == null)
            {
                errors.Add(new ErrorViewModel(ErrorType.NotFound, Resources.Bills.BillResource.BillTypeNotFound));
                return(errors);
            }

            switch (billType.Type)
            {
            case BillsType.Transfer:
                errors.Add(new ErrorViewModel(ErrorType.BadRequest, "", "can't not add new transfare from here!"));
                return(errors);

            case BillsType.EndPeriodInventory:
                errors.Add(new ErrorViewModel(ErrorType.BadRequest, "", "can't add End Period Inventory bill"));
                return(errors);
            }



            return(errors);
        }
Exemplo n.º 3
0
        public override Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            if (User != null && User.Identity.IsAuthenticated)
            {
                _customerRepo.SetLoggedInUserId(GetUserId());
                _customerTypeRepo.SetLoggedInUserId(GetUserId());

                _customerRepo.SetIsAdmin(GetIsUserAdmin());
                _customerTypeRepo.SetIsAdmin(GetIsUserAdmin());

                _entryItemRepo.SetLoggedInUserId(GetUserId());
                _entryItemRepo.SetIsAdmin(GetIsUserAdmin());
                _entryItemRepo.SetPeriodId(_periodManager.GetPeriod());

                _billRepo.SetLoggedInUserId(GetUserId());
                _billRepo.SetIsAdmin(GetIsUserAdmin());
                _billRepo.SetPeriodId(_periodManager.GetPeriod());
            }
            return(base.OnActionExecutionAsync(context, next));
        }
Exemplo n.º 4
0
        public override Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            if (User != null && User.Identity.IsAuthenticated)
            {
                _billRepo.SetLoggedInUserId(GetUserId());
                _billRepo.SetIsAdmin(GetIsUserAdmin());
                _billRepo.SetPeriodId(_periodManager.GetPeriod());

                _billTypeRepo.SetLoggedInUserId(GetUserId());
                _billTypeRepo.SetIsAdmin(GetIsUserAdmin());
                _billTypeRepo.SetPeriodId(_periodManager.GetPeriod());

                _entryRepo.SetLoggedInUserId(GetUserId());
                _entryRepo.SetIsAdmin(GetIsUserAdmin());
                _entryRepo.SetPeriodId(_periodManager.GetPeriod());

                _accountBalanceRepo.SetLoggedInUserId(GetUserId());
                _accountBalanceRepo.SetIsAdmin(GetIsUserAdmin());
                _accountBalanceRepo.SetPeriodId(_periodManager.GetPeriod());

                _customerRepo.SetLoggedInUserId(GetUserId());
                _customerRepo.SetIsAdmin(GetIsUserAdmin());
                _customerRepo.SetPeriodId(_periodManager.GetPeriod());

                _accountRepo.SetLoggedInUserId(GetUserId());
                _accountRepo.SetIsAdmin(GetIsUserAdmin());
                _accountRepo.SetPeriodId(_periodManager.GetPeriod());

                _storeRepo.SetLoggedInUserId(GetUserId());
                _storeRepo.SetIsAdmin(GetIsUserAdmin());
                _storeRepo.SetPeriodId(_periodManager.GetPeriod());

                _costCenterRepo.SetLoggedInUserId(GetUserId());
                _costCenterRepo.SetIsAdmin(GetIsUserAdmin());
                _costCenterRepo.SetPeriodId(_periodManager.GetPeriod());

                _branchRepo.SetLoggedInUserId(GetUserId());
                _branchRepo.SetIsAdmin(GetIsUserAdmin());
                _branchRepo.SetPeriodId(_periodManager.GetPeriod());

                _itemRepo.SetLoggedInUserId(GetUserId());
                _itemRepo.SetIsAdmin(GetIsUserAdmin());
                _itemRepo.SetPeriodId(_periodManager.GetPeriod());

                _itemUnitRepo.SetLoggedInUserId(GetUserId());
                _itemUnitRepo.SetIsAdmin(GetIsUserAdmin());
                _itemUnitRepo.SetPeriodId(_periodManager.GetPeriod());

                _storeItemRepo.SetLoggedInUserId(GetUserId());
                _storeItemRepo.SetIsAdmin(GetIsUserAdmin());
                _storeItemRepo.SetPeriodId(_periodManager.GetPeriod());

                _storeItemUnitRepo.SetLoggedInUserId(GetUserId());
                _storeItemUnitRepo.SetIsAdmin(GetIsUserAdmin());
                _storeItemUnitRepo.SetPeriodId(_periodManager.GetPeriod());

                _priceRepo.SetLoggedInUserId(GetUserId());
                _priceRepo.SetIsAdmin(GetIsUserAdmin());
                _priceRepo.SetPeriodId(_periodManager.GetPeriod());

                _currencyRepo.SetLoggedInUserId(GetUserId());
                _currencyRepo.SetIsAdmin(GetIsUserAdmin());
                _currencyRepo.SetPeriodId(_periodManager.GetPeriod());

                _financialPeriodRepo.SetLoggedInUserId(GetUserId());
                _financialPeriodRepo.SetIsAdmin(GetIsUserAdmin());
                _financialPeriodRepo.SetPeriodId(_periodManager.GetPeriod());
            }
            return(base.OnActionExecutionAsync(context, next));
        }