//Lấy danh sách Group dựa vào UserId public async Task <IEnumerable <ApplicationGroup> > GetListGroupByUserId(string userId) { return(await Task.FromResult(_appGroupRepository.GetListGroupByUserId(userId))); }
public IEnumerable <ApplicationGroup> GetListGroupByUserId(string userId) { return(_appGroupRepository.GetListGroupByUserId(userId)); }
public IEnumerable <Transaction> GetAllByTime(DateTime fromDate, DateTime toDate, string userName, string userId, int serviceId) { var user = _userRepository.getByUserName(userName); var listGroup = _groupRepository.GetListGroupByUserId(user.Id); bool IsManager = false; bool IsAdministrator = false; foreach (var item in listGroup) { string name = item.Name; if (name == "Manager") { IsManager = true; } if (name == "Administrator") { IsAdministrator = true; } } if (IsAdministrator) { if (!string.IsNullOrEmpty(userId) && serviceId != 0) { return(_transactionRepository.GetAll(fromDate, toDate, userId, serviceId)); } else { if (string.IsNullOrEmpty(userId) && serviceId == 0) { return(_transactionRepository.GetAll(fromDate, toDate)); } else { if (string.IsNullOrEmpty(userId)) { return(_transactionRepository.GetAll(fromDate, toDate, serviceId)); } else { return(_transactionRepository.GetAll(fromDate, toDate, userId)); } } } } else { if (IsManager) { if (!string.IsNullOrEmpty(userId) && serviceId != 0) { return(_transactionRepository.GetAllByTimeAndPOID(fromDate, toDate, user.POID, userId, serviceId)); } else { if (string.IsNullOrEmpty(userId) && serviceId == 0) { return(_transactionRepository.GetAllByTimeAndPOID(fromDate, toDate, user.POID)); } else { if (string.IsNullOrEmpty(userId)) { return(_transactionRepository.GetAllByTimeAndPOID(fromDate, toDate, user.POID, serviceId)); } else { return(_transactionRepository.GetAllByTimeAndPOID(fromDate, toDate, user.POID, userId)); } } } } else { return(_transactionRepository.GetAllByTimeAndUsername(fromDate, toDate, user.UserName)); } } }