/// <summary> /// GetUserTasks /// </summary> /// <returns></returns> public List <UserTask> GetUserTasks(ContextEnum contextId, string assignedTo, DateTime?fromDate, DateTime?toDate, bool activeTasks) { RepositoryQuery <UserTask> userTasks = eCollabroDbContext.Repository <UserTask>().Query().Include(inc => inc.UserMembership).Include(inc => inc.UserMembership1).Filter(qry => qry.SiteId.Equals(UserContextDetails.SiteId)); if (contextId != 0) { userTasks = userTasks.Filter(qry => qry.ContextId.Equals((int)contextId)); } if (!string.IsNullOrEmpty(assignedTo)) { userTasks = userTasks.Filter(qry => qry.UserMembership.UserName.Equals(assignedTo)); } if (fromDate.HasValue) { DateTime dtFrom = fromDate.Value.ToUniversalTime(); userTasks.Filter(qry => qry.CreatedOn >= dtFrom); } if (toDate.HasValue) { DateTime dtTo = toDate.Value.ToUniversalTime(); userTasks.Filter(qry => qry.CreatedOn <= dtTo); } if (activeTasks) { userTasks.Filter(qry => qry.IsActive); } SecurityManager securityManager = new SecurityManager(); if ((securityManager.CheckSiteCollectionAdmin(UserContextDetails.UserId) || securityManager.CheckSiteAdmin(UserContextDetails.UserId, UserContextDetails.SiteId))) { return(userTasks.Get().ToList()); } else { List <FeaturePermissionResult> userFeaturePermissionResults = eCollabroDbContext.ExtendedRepository().SecurityRepository.GetUserPermissions(UserContextDetails.SiteId, UserContextDetails.UserId).Where(qry => qry.ContentPermissionId.Equals((int)PermissionEnum.ApproveContent)).ToList(); List <int> contentContexts = new List <int>(); if (userFeaturePermissionResults.Count > 0) { foreach (FeaturePermissionResult featurePermissionResult in userFeaturePermissionResults) { ContextEnum context = GetContextForFeature((FeatureEnum)featurePermissionResult.FeatureId); if (context != ContextEnum.None) { contentContexts.Add((int)context); } } } if (contentContexts.Count > 0) { userTasks = userTasks.Filter(qry => contentContexts.Contains(qry.ContextId) || (qry.AssignedUserId == UserContextDetails.UserId)); } else { userTasks = userTasks.Filter(qry => qry.AssignedUserId.HasValue && qry.AssignedUserId == UserContextDetails.UserId); } return(userTasks.Get().ToList()); } }
public ProductSupplier GetProductSupplier(int pt) { //return ProductSupplierRepository.Include(r => r.SalesOrder).Get().Where(i => i.SalesOrderDetailId == pt).FirstOrDefault(); //return _unitOfWork.Repository<ProductSupplier>().Find(pt); //return ProductSupplierRepository.Get().Where(i => i.ProductSupplierId == pt).FirstOrDefault(); return(ProductSupplierRepository.Get().Where(i => i.ProductSupplierId == pt).FirstOrDefault()); }
public static async Task <List <Model> > ToListNoTrackingAsync <Entity, Model>(this RepositoryQuery <Entity> query) where Model : class where Entity : class { var results = await query.Get().AsNoTracking().ToListAsync(); var models = new List <Model>(); foreach (var result in results) { models.Add(Mapper.Map <Model>(result)); } return(models); }
public static IEnumerable <Model> AsEnumerable <Entity, Model>(this RepositoryQuery <Entity> query) where Model : class where Entity : class { var results = query.Get().AsEnumerable <Entity>(); var models = new List <Model>(); foreach (var result in results) { models.Add(Mapper.Map <Model>(result)); } return(models); }
public ProductSizeType Find(string Name) { return(ProductSizeTypeRepository.Get().Where(i => i.ProductSizeTypeName == Name).FirstOrDefault()); }
public Dimension1 Find(string Name) { return(Dimension1Repository.Get().Where(i => i.Dimension1Name == Name).FirstOrDefault()); }
public LeaveType Find(string Name) { return(LeaveTypeRepository.Get().Where(i => i.LeaveTypeName == Name).FirstOrDefault()); }
public ServiceTaxCategory GetServiceTaxCategory(int pt) { //return _unitOfWork.Repository<ServiceTaxCategory>().Find(pt); return(ServiceTaxCategoryRepository.Get().Where(i => i.ServiceTaxCategoryId == pt).FirstOrDefault()); }
public ProductBuyer Find(string Name) { return(ProductBuyerRepository.Get().Where(i => i.Buyer.Person.Name == Name).FirstOrDefault()); }
public Reason Find(string Name) { return(ReasonRepository.Get().Where(i => i.ReasonName == Name).FirstOrDefault()); }
public static async Task <Model> FirstOrDefaultNoTrackingAsync <Entity, Model>(this RepositoryQuery <Entity> query) where Model : class where Entity : class { return(Mapper.Map <Model>(await query.Get().AsNoTracking().FirstOrDefaultAsync())); }
public static Model FirstOrDefaultNoTracking <Entity, Model>(this RepositoryQuery <Entity> query) where Model : class where Entity : class { return(Mapper.Map <Model>(query.Get().AsNoTracking().FirstOrDefault())); }
public static List <Model> ToList <Entity, Model>(this RepositoryQuery <Entity> query) where Model : class where Entity : class { return(Mapper.Map <List <Model> >(query.Get().ToList())); }
public static async Task <Model> SingleOrDefaultAsync <Entity, Model>(this RepositoryQuery <Entity> query) where Model : class where Entity : class { return(Mapper.Map <Model>(await query.Get().SingleOrDefaultAsync())); }
public ProductDesign Find(string Name) { return(ProductDesignRepository.Get().Where(i => i.ProductDesignName == Name).FirstOrDefault()); }
public TdsGroup GetTdsGroup(int pt) { //return _unitOfWork.Repository<TdsGroup>().Find(pt); return(TdsGroupRepository.Get().Where(i => i.TdsGroupId == pt).FirstOrDefault()); }
public SaleDispatchReturnHeader Find(string Name) { return(SaleDispatchReturnHeaderRepository.Get().Where(i => i.DocNo == Name).FirstOrDefault()); }
public static Model Single <Entity, Model>(this RepositoryQuery <Entity> query) where Model : class where Entity : class { return(Mapper.Map <Model>(query.Get().Single())); }
public GateIn Find(string Name) { return(GateInRepository.Get().Where(i => i.DocNo == Name).FirstOrDefault()); }
public ProductSampleAttributes GetProductSampleAttribute(int pId) { return(productSampleAttributesRepositoryQry.Get().Where(i => i.ProductSampleAttributeId == pId).FirstOrDefault()); // return _unitOfWork.Repository<ProductSampleAttributes>().Query().Include(m => m.ProductTypeAttribute).Get().Where(m => m.ProductSampleAttributeId == pId).FirstOrDefault(); //return _unitOfWork.Repository<SalesOrder>().Find(soId); }
public QAGroup Find(string Name) { return(QAGroupRepository.Get().Where(i => i.QaGroupName == Name).FirstOrDefault()); }
public Perk Find(string Name) { return(PerkRepository.Get().Where(i => i.PerkName == Name).FirstOrDefault()); }
public JobReturnHeader Find(string Name) { return(JobReturnHeaderRepository.Get().Where(i => i.DocNo == Name).FirstOrDefault()); }
public DeliveryTerms Find(string Name) { return(DeliveryTermsRepository.Get().Where(i => i.DeliveryTermsName == Name).FirstOrDefault()); }
public SalesTaxProductCode Find(string Name) { return(SalesTaxProductCodeRepository.Get().Where(i => i.Code == Name).FirstOrDefault()); }
public LedgerAccountGroup Find(string Name) { return(AccountGroupRepository.Get().Where(i => i.LedgerAccountGroupName == Name).FirstOrDefault()); }
public PurchaseInvoiceHeader Find(string Name) { return(PurchaseInvoiceHeaderRepository.Get().Where(i => i.DocNo == Name).FirstOrDefault()); }
public ProductQuality Find(string Name) { return(ProductQualityRepository.Get().Where(i => i.ProductQualityName == Name).FirstOrDefault()); }
public SalesTaxGroupProduct Find(string Name) { return(SalesTaxGroupProductRepository.Get().Where(i => i.SalesTaxGroupProductName == Name).FirstOrDefault()); }
public ProductAttributes GetProductAttribute(int pId) { return(productAttributeRepositoryQry.Get().Where(i => i.ProductAttributeId == pId).FirstOrDefault()); //return _unitOfWork.Repository<SalesOrder>().Find(soId); }