示例#1
0
        public static Expense ParseExpenseMessage(string str, Telegram.Bot.Types.User user,
                                                  ExpenseCategoryRepository expCat)
        {
            var inputWithoutSpaces = Regex.Replace(str, @"^\-\s+", "");

            inputWithoutSpaces = inputWithoutSpaces.Replace(".", ",");

            var digitInputValue = Regex.Match(inputWithoutSpaces, @"[0-9]+(\,[0-9]+)?").Value;

            inputWithoutSpaces = inputWithoutSpaces.Replace(digitInputValue, "");
            inputWithoutSpaces = inputWithoutSpaces.Replace(@"-", "");


            var category = Regex.Match(inputWithoutSpaces, @"\D+").Value;
            var money    = (float)Convert.ToDouble(digitInputValue, CultureInfo.CurrentCulture);

            var foundedCategory = expCat.GetByString(category);

            return(new Expense()
            {
                Amount = money,
                CreatedTime = DateTime.Now,
                CategoryId = foundedCategory.Id,
                Id = Guid.NewGuid().GetHashCode(),
                UserId = user.Id,
                Definition = category
            });
        }
 public SettingsController(ExpenseRepository expenseRepository,
                           ExpenseSubCategoryRepository subCategoryRepository,
                           ExpenseCategoryRepository categoryRepository,
                           NoteRepository noteRepository)
 {
     _expenseRepository     = expenseRepository;
     _categoryRepository    = categoryRepository;
     _subCategoryRepository = subCategoryRepository;
     _noteRepository        = noteRepository;
 }
示例#3
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context        = context;
     Notifications   = new NotificationRepository(_context);
     Income          = new IncomeRepository(_context);
     IncomeCategory  = new IncomeCategoryRepository(_context);
     ExpenseCategory = new ExpenseCategoryRepository(_context);
     Documents       = new DocumentRepository(_context);
     Projects        = new ProjectRepository(_context);
     Products        = new ProductRepository(_context);
     Clients         = new ClientRepository(_context);
     ProjectStatus   = new ProjectStatusRepository(_context);
     ProjectSource   = new ProjectSourceRepository(_context);
 }
示例#4
0
        private static void SeedExpenseCategories()
        {
            var expenseCategoryRepository = new ExpenseCategoryRepository(dbFactory);
            var groceryCategory           = new ExpenseCategory
            {
                ExpenseCategoryId = "Groceries",
                Description       = "Groceries"
            };

            var gasCategory = new ExpenseCategory
            {
                ExpenseCategoryId = "Gas",
                Description       = "Gas"
            };

            expenseCategoryRepository.Add(groceryCategory);
            expenseCategoryRepository.Add(gasCategory);
            unitOfWork.Save();
        }
示例#5
0
        public UnitOfWork(PlutoContext context)
        {
            _ILog = Log.GetInstance;

            _context                  = context;
            AppUsers                  = new UserRepository(context);
            Students                  = new StudentRepository(context);
            PaymentHistories          = new PaymentHistoryRepository(context);
            Payments                  = new PaymentRepository(context);
            studentclasses            = new StudentClassRepository(context);
            departments               = new DepartmentRepository(context);
            regions                   = new RegionRepository(context);
            studentstatuses           = new StudentStatusRepository(context);
            employees                 = new EmployeeRepository(context);
            employeedocuments         = new EmployeeDocumentRepository(context);
            payrollamounts            = new PayrollAmountRepository(context);
            employeecategories        = new EmployeeCategoryRepository(context);
            employeelevelsofeducation = new EmployeeLevelOfEducationRepository(context);
            payrollrates              = new PayrollRateRepository(context);
            taxrates                  = new TaxRateRepository(context);
            ssnitrates                = new SSNITRateRepository(context);
            studentsubjects           = new StudentSubjectRepository(context);
            payrollallowances         = new PayrollAllowancesRepository(context);
            employeetypes             = new EmployeeTypeRepository(context);
            employeeloanhistories     = new EmployeeLoanHistoryRepository(context);
            employeeloans             = new EmployeeLoanRepository(context);
            exams          = new ExamRepository(context);
            marks          = new MarkRepository(context);
            externalhelper = new ExternalHelperRepository(context);

            hostels           = new HostelRepository(context);
            libraries         = new LibraryRepository(context);
            transports        = new TransportRepository(context);
            expenses          = new ExpenseRepository(context);
            expensecategories = new ExpenseCategoryRepository(context);
            incomes           = new IncomeRepository(context);
            incomecategories  = new IncomeCategoryRepository(context);
            books             = new BookRepository(context);
            booktypes         = new BookTypeRepository(context);
            rooms             = new RoomRepository(context);
            payrolldates      = new PayrollDateRepository(context);
            allowances        = new AllowanceRepository(context);
        }
示例#6
0
 public ExpenseCategoryService(ExpenseCategoryRepository repository)
 {
     _repository = repository;
 }
示例#7
0
 public ChartCalculationHelper(ExpenseRepository expenseRepository, ExpenseCategoryRepository categoryRepository)
 {
     _expenseRepository  = expenseRepository;
     _categoryRepository = categoryRepository;
 }