Пример #1
0
        public ExpenseReport ExpenseReport(string name, string type)
        {
            ExpenseReport expenseReport;

            using (var db = new FinancialContext())
            {
                //refacter to service

                var expense = (from b in db.Expenses
                               where b.ExpenseType == type
                               select b).FirstOrDefault();

                var person = (from b in db.Persons
                              where b.Name == name
                              select b).FirstOrDefault();

                //build expense report object
                expenseReport = new ExpenseReport {
                    Name          = person.Name,
                    Department    = person.Department,
                    ExpenceAmount = expense.ExpenseAmount,
                    ExpenseType   = expense.ExpenseType
                };
            }

            return(expenseReport);
        }
Пример #2
0
        public int CreateNewExpense(Expense e)
        {
            using (var db = new FinancialContext())
            {
                int    result = 0;
                string type   = "placeholder",
                       amount = "placeholder";

                type   = e.ExpenseType;
                amount = e.ExpenseAmount;

                var expense = new Expense {
                    ExpenseType = type, ExpenseAmount = amount
                };
                db.Expenses.Add(expense);

                result = db.SaveChanges();

                if (false)
                {
                    //handle unexpected result
                }
                else
                {
                    return(result);
                }
            }
        }
Пример #3
0
 public FinancialController(FinancialContext ctx, IFMUnitOfWork uow, IFMUser user, IAccountant accountant, IMasterAccountant masterAccountant)
 {
     this._Context              = ctx;
     this._UserRole             = user;
     this._Uow                  = uow;
     this._AccountantRole       = accountant;
     this._MasterAccountantRole = masterAccountant;
 }
Пример #4
0
        public Person Person(string name)
        {
            Person person;

            using (var db = new FinancialContext())
            {
                //refacter to service

                person = (from b in db.Persons
                          where b.Name == name
                          select b).FirstOrDefault();
            }

            return(person);
        }
Пример #5
0
        public IList <Person> People(string name, string department)
        {
            List <Person> peopleReport;

            using (var db = new FinancialContext())
            {
                //refacter to service
                peopleReport = (from b in db.Persons
                                where b.Name == name
                                orderby b.Department, b.Name
                                select b).ToList();
            }

            return(peopleReport);
        }
Пример #6
0
        public IList <Expense> Expenses()
        {
            var result = new List <Expense>();

            using (var db = new FinancialContext())
            {
                //refacter to service

                var query = (from b in db.Expenses
                             orderby b.ExpenseType
                             select b).ToList();

                result = query;
            }

            return(result);
        }
Пример #7
0
 public DashboardRepository(FinancialContext context)
 {
     this.context = context;
 }
Пример #8
0
 public TransactionsController(FinancialContext context,
                               UserManager <ApplicationUser> userManager)
 {
     this.context     = context;
     this.userManager = userManager;
 }
Пример #9
0
 public EmployeesRepository(FinancialContext context)
 {
     this.context = context;
 }
Пример #10
0
 public ReportsController(FinancialContext context)
 {
     this.context = context;
 }
Пример #11
0
 public GroupController(FinancialContext finContext)
 {
     _finContext = finContext;
 }
Пример #12
0
        //private readonly Dictionary<string, string> _monthNumber = new Dictionary<string, string>()
        //{
        //    { "Jan", "01" },
        //    { "Feb", "02" },
        //    { "Mar", "03" },
        //    { "Apr", "04" },
        //    { "May", "05" },
        //    { "Jun", "06" },
        //    { "Jul", "07" },
        //    { "Aug", "08" },
        //    { "Sep", "09" },
        //    { "Oct", "10" },
        //    { "Nov", "11" },
        //    { "Dec", "12" },
        //};

        public CalendarController(FinancialContext context)
        {
            _context = context;
        }
Пример #13
0
 public UserController(FinancialContext finContext)
 {
     _finContext = finContext;
 }
Пример #14
0
 public AccountantController(FinancialContext ctx, IFMUnitOfWork uow, IAccountant patrick)
 {
     this._Context = ctx;
     this._Service = patrick;
     this._Uow     = uow;
 }
 public PassedEventsNotificationViewComponent(FinancialContext context)
 {
     this.context = context;
 }
 public PredictionRepository(FinancialContext financialContext)
 {
     this.financialContext = financialContext ?? throw new ArgumentNullException($"{nameof(financialContext)} in PredictionRepository");
 }
 public RemindingsNotificationViewComponent(FinancialContext context)
 {
     this.context = context;
 }
Пример #18
0
 public HomeController(FinancialContext context)
 {
     _context = context;
 }
Пример #19
0
 public CodesRepository(FinancialContext context)
 {
     this.context = context;
 }
Пример #20
0
 public OperationController(FinancialContext financialContext)
 {
     _finContext = financialContext;
 }
Пример #21
0
 public UserController(FinancialContext ctx, IFMUnitOfWork uow, IFMUser patrick)
 {
     this._Context = ctx;
     this._Service = patrick;
     this._Uow     = uow;
 }
Пример #22
0
 public static void InitializeDbForTests(FinancialContext db)
 {
     db.Customers.AddRange(GetSeedingCustomers());
     db.SaveChanges();
 }
Пример #23
0
 public AccountsRepository(FinancialContext context)
 {
     this.context = context;
 }
Пример #24
0
 public static void ReinitializeDbForTests(FinancialContext db)
 {
     db.Customers.RemoveRange(db.Customers);
     InitializeDbForTests(db);
 }