Exemple #1
0
        public IActionResult ManageTimeSheet(string successMsg, string errorMsg)
        {
            var departmentService = this.GetService <DepartmentService>();

            this.BuildHeaderMsg(successMsg, errorMsg);

            var userIds = departmentService.GetSubordinatesByUserId(this.GetUserId());

            //去掉Admin
            var adminIds = this.GetService <UserService>().Get().Where(o => o.UserType == UserType.Admin).Select(o => o.Id).ToList();

            userIds = userIds.Except(adminIds).ToList();
            var helper = new TimeSheetHelper(this);

            ViewData["UserWeeks"] = helper.BuildUserTimeSheetOverViewModels(userIds);

            return(View());
        }
Exemple #2
0
        public Dictionary <string, List <TimeSheetOverviewModel> > GetManageTimeSheetModel()
        {
            try
            {
                //var helper = new TimeSheetHelper(this);
                //return helper.BuildTimeSheetOverViewModel(this.GetUserId());
                var userIds     = this.GetService <DepartmentService>().GetSubordinatesByUserId(this.GetUserId());
                var adminIds    = this.GetService <UserService>().Get().Where(o => o.UserType == UserType.Admin).Select(o => o.Id).ToList();
                var internalIds = this.GetService <UserService>().Get().Where(o => o.AccountType == AccountType.Internal).Select(o => o.Id).ToList();
                userIds = userIds.Except(adminIds).Except(internalIds).ToList();
                var helper = new TimeSheetHelper(this);

                return(helper.BuildUserTimeSheetOverViewModels(userIds));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(null);
            }
        }