示例#1
0
        /// <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());
        }
示例#3
0
        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);
        }
示例#4
0
        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());
 }
示例#7
0
 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());
 }
示例#10
0
 public Reason Find(string Name)
 {
     return(ReasonRepository.Get().Where(i => i.ReasonName == Name).FirstOrDefault());
 }
示例#11
0
 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()));
 }
示例#12
0
 public static Model FirstOrDefaultNoTracking <Entity, Model>(this RepositoryQuery <Entity> query)
     where Model : class
     where Entity : class
 {
     return(Mapper.Map <Model>(query.Get().AsNoTracking().FirstOrDefault()));
 }
示例#13
0
 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()));
 }
示例#14
0
 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());
 }
示例#16
0
 public TdsGroup GetTdsGroup(int pt)
 {
     //return _unitOfWork.Repository<TdsGroup>().Find(pt);
     return(TdsGroupRepository.Get().Where(i => i.TdsGroupId == pt).FirstOrDefault());
 }
示例#17
0
 public SaleDispatchReturnHeader Find(string Name)
 {
     return(SaleDispatchReturnHeaderRepository.Get().Where(i => i.DocNo == Name).FirstOrDefault());
 }
示例#18
0
 public static Model Single <Entity, Model>(this RepositoryQuery <Entity> query)
     where Model : class
     where Entity : class
 {
     return(Mapper.Map <Model>(query.Get().Single()));
 }
示例#19
0
 public GateIn Find(string Name)
 {
     return(GateInRepository.Get().Where(i => i.DocNo == Name).FirstOrDefault());
 }
示例#20
0
 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);
 }
示例#21
0
 public QAGroup Find(string Name)
 {
     return(QAGroupRepository.Get().Where(i => i.QaGroupName == Name).FirstOrDefault());
 }
示例#22
0
 public Perk Find(string Name)
 {
     return(PerkRepository.Get().Where(i => i.PerkName == Name).FirstOrDefault());
 }
示例#23
0
 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());
 }
示例#25
0
 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());
 }
示例#29
0
 public SalesTaxGroupProduct Find(string Name)
 {
     return(SalesTaxGroupProductRepository.Get().Where(i => i.SalesTaxGroupProductName == Name).FirstOrDefault());
 }
示例#30
0
 public ProductAttributes GetProductAttribute(int pId)
 {
     return(productAttributeRepositoryQry.Get().Where(i => i.ProductAttributeId == pId).FirstOrDefault());
     //return _unitOfWork.Repository<SalesOrder>().Find(soId);
 }