/// <summary> /// Get the Requested License based on the UserId1 /// </summary> /// <returns></returns> public List <UserLicenseRequest> GetLicenseRequest(string userId) { SubscriptionBO proSubLogic = new SubscriptionBO(); var subList = proSubLogic.GetSubscriptionFromFile(); var licReqList = Work.UserLicenseRequestRepo.GetData(f => f.Requested_UserId == userId).ToList(); if (licReqList.Count > 0) { var list = licReqList.GroupBy(f => f.UserSubscriptionId).ToList(); List <UserLicenseRequest> userLicReq = new List <UserLicenseRequest>(); foreach (var obj in licReqList) { var tempObj = AutoMapper.Mapper.Map <License.DataModel.UserLicenseRequest>(obj); var subscription = subList.FirstOrDefault(f => f.Id == tempObj.UserSubscripption.SubscriptionId); tempObj.UserSubscripption.Subscription = new SubscriptionType() { Id = subscription.Id, Name = subscription.Name }; tempObj.Product = subscription.Products.FirstOrDefault(p => p.Id == tempObj.ProductId); userLicReq.Add(tempObj); } return(userLicReq); } return(null); }
public List <UserLicenseRequest> GetRequestListByTeam(int teamId) { if (subList == null) { SubscriptionBO proSubLogic = new SubscriptionBO(); subList = proSubLogic.GetSubscriptionFromFile(); } var userlist = Work.TeamMemberRepository.GetData(f => f.TeamId == teamId).ToList(); if (userlist.Count > 0) { var idList = userlist.Select(u => u.InviteeUserId).ToList(); var licReqList = Work.UserLicenseRequestRepo.GetData(f => idList.Contains(f.Requested_UserId) && String.IsNullOrEmpty(f.ApprovedBy) && f.TeamId == teamId).ToList(); if (licReqList.Count > 0) { List <UserLicenseRequest> userLicReq = new List <UserLicenseRequest>(); foreach (var obj in licReqList) { var tempObj = AutoMapper.Mapper.Map <License.DataModel.UserLicenseRequest>(obj); var subscription = subList.FirstOrDefault(f => f.Id == tempObj.UserSubscripption.SubscriptionId); tempObj.UserSubscripption.Subscription = new SubscriptionType() { Id = subscription.Id, Name = subscription.Name }; tempObj.Product = subscription.Products.FirstOrDefault(p => p.Id == tempObj.ProductId); userLicReq.Add(tempObj); } return(userLicReq); } } return(null); }
public List <Product> GetProductbyAdmin(string adminId) { var userSubscriptionList = Work.UserSubscriptionRepository.GetData(us => us.UserId == adminId).ToList(); if (userSubscriptionList != null && userSubscriptionList.Count > 0) { var subscriptionIds = userSubscriptionList.Select(u => u.SubscriptionId); SubscriptionBO subscriptionLogic = new SubscriptionBO(); var subList = subscriptionLogic.GetSubscriptionFromFile().Where(s => subscriptionIds.Contains(s.Id)); List <Product> productList = new List <Product>(); foreach (var sub in subList) { productList.AddRange(sub.Products); } return(productList.Distinct().ToList()); } return(null); }
/// <summary> /// Function to get the Licence Request of all the users based on the admin id /// </summary> /// <param name="adminId"></param> /// <returns></returns> public List <UserLicenseRequest> GetAllRequestList(string adminId) { List <UserLicenseRequest> requestList = new List <UserLicenseRequest>(); SubscriptionBO proSubLogic = new SubscriptionBO(); subList = proSubLogic.GetSubscriptionFromFile(); var teamList = Work.TeamRepository.GetData(f => f.AdminId == adminId); foreach (var team in teamList) { var dataList = GetRequestListByTeam(team.Id); requestList.AddRange(dataList); } if (requestList.Count > 0) { return(requestList); } return(null); }