// GET: Employees/Create
        public async Task <IActionResult> Create()
        {
            GetSessions();

            if (ViewBag.Email == null)
            {
                return(ExpiredSession());
            }

            try
            {
                var accessLevel = await _accessLevelService.FindAllAsync();

                var typeReleases = await _hourService.FindStatus("tipoProjeto");

                var viewModel = new EmployeeFormViewModel {
                    Access_Level = accessLevel, TypeReleases = typeReleases
                };

                return(View(viewModel));
            }
            catch (Exception e)
            {
                return(RedirectToAction(nameof(Error), new { message = e.Message }));
            }
        }
Beispiel #2
0
        public async Task <IActionResult> ModeAdmin(int?Selectbilling, int?approval, int?description, int?clients, int?projects, int?employees, int?month, int?year, int?obsDay)
        {
            GetSessions();

            if (ViewBag.Email == null)
            {
                return(ExpiredSession());
            }

            try
            {
                ViewBag.Month       = month;
                ViewBag.Year        = year;
                ViewBag.Billing     = Selectbilling;
                ViewBag.Approval    = approval;
                ViewBag.Description = description;
                ViewBag.Clients     = clients;
                ViewBag.Projects    = projects;
                ViewBag.Employees   = employees;
                ViewBag.obsDay      = obsDay;

                int empId       = ViewBag.Id;
                int accessLevel = ViewBag.AcessLevel;

                //var result = await _hourService.FindAllAsync(month, year);
                var horas = await _hourService.FindAllAsync(Selectbilling, approval, description, clients, projects, employees, month, year, empId, accessLevel);

                var clientes = await _clientService.FindAllAsync(accessLevel, empId);

                var projetos = await _projectService.FindProjectAsync(empId, accessLevel);

                var funcionarios = await _employeeService.FindAllAsync();

                var status = await _hourService.FindStatus("horas");

                var descri = await _context.Description.Where(x => x.Active == 1).ToListAsync();

                var viewModel = new HourFormViewModel {
                    Hours = horas, Projects = projetos, Employees = funcionarios, Clients = clientes, Status = status, Description = descri
                };

                return(View(viewModel));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(RedirectToAction(nameof(Error), new { message = e.Message }));
            }
        }
Beispiel #3
0
        // GET: Outlays
        public async Task <IActionResult> Index(int?status, int?clients, int?projects, int?employees, int?month, int?year)
        {
            GetSessions();

            if (ViewBag.Email == null)
            {
                return(ExpiredSession());
            }

            int empId       = ViewBag.Id;
            var accessLevel = ViewBag.AcessLevel;

            var despesas = await _outlaysService.FindAllAsync(status, clients, projects, employees, month, year);

            var clientes = await _clienteService.FindAllAsync(accessLevel, empId);

            var projetos = await _projectService.FindProjectAsync(empId, accessLevel);

            var funcionarios = await _employeeService.FindAllAsync();

            var statusDespesas = await _hourService.FindStatus("despesas");

            var viewModel = new OutlaysFormViewModel {
                Outlay = despesas, Projects = projetos, Employees = funcionarios, Clients = clientes, Status = statusDespesas
            };

            ViewBag.Month     = month;
            ViewBag.Year      = year;
            ViewBag.Status    = status;
            ViewBag.Clients   = clients;
            ViewBag.Projects  = projects;
            ViewBag.Employees = employees;

            return(View(viewModel));
        }
        public async Task <IActionResult> Index(int?Selectbilling, int?approval, int?description, int?clients, int?projects, int?month, int?year)
        {
            GetSessions();

            if (ViewBag.Email == null)
            {
                return(ExpiredSession());
            }


            try
            {
                //int empId = ViewBag.Id;
                //var result = await _hourService.FindAllPerEmployeeAsync(ViewBag.Id);

                ViewBag.Month       = month;
                ViewBag.Year        = year;
                ViewBag.Billing     = Selectbilling;
                ViewBag.Approval    = approval;
                ViewBag.Description = description;
                ViewBag.Clients     = clients;
                ViewBag.Projects    = projects;

                int empId       = ViewBag.Id;
                var accessLevel = ViewBag.AcessLevel;
                //var result = await _hourService.FindAllAsync(month, year);
                var horas = await _hourService.FindAllPerEmployeeAsync(ViewBag.Id, Selectbilling, approval, description, clients, projects, month, year);

                var clientes = await _clientService.FindAllAsync(accessLevel, empId);

                var projetos = await _projectService.FindProjectAsync(empId, accessLevel);

                var descriptions = await _context.Description.Where(x => x.Active == 1).ToListAsync();

                var localities = await _context.Locality.Where(x => x.Active == 1).ToListAsync();

                var status = await _hourService.FindStatus("horas");

                //var funcionarios = await _employeeService.FindEmployeesActivesAsync();
                var viewModel = new HourFormViewModel {
                    Hours = horas, Projects = projetos, Clients = clientes, Description = descriptions, Locality = localities, Status = status
                };


                return(View(viewModel));
            }
            catch (Exception e)
            {
                return(RedirectToAction(nameof(Error), new { message = e.Message }));
            }
        }