示例#1
0
        public static IList<Invoice> GetInvoices(Dictionary status)
        {
            Repository<Invoice, Guid> rep = new Repository<Invoice, Guid>();
            var result = from i in rep.GetQueryable() select i;
            if (status != null)
                result = result.Where(i => i.InvoiceStatus == status);

            return result.ToList();
        }
示例#2
0
        public static IList<Task> GetTasks(Employee assignedTo, Employee givenBy, Employee createdBy, Dictionary taskStatus,
            bool showOnlyApproved, DateTime? dateCreatedFrom, DateTime? dateCreatedTo)
        {
            Repository<Task, Guid> rep = new Repository<Task, Guid>();
            var result = from t in rep.GetQueryable() select t;
            if (assignedTo != null)
                result = result.Where(t => t.AssignedTo == assignedTo);
            if (givenBy != null)
                result = result.Where(t => t.GivenBy == givenBy);
            if (createdBy != null)
                result = result.Where(t => t.CreatedBy == createdBy);
            if (taskStatus != null)
                result = result.Where(t => t.TaskStatus == taskStatus);
            if (dateCreatedFrom.HasValue)
                result = result.Where(t => t.DateCreated > dateCreatedFrom.Value);
            if (dateCreatedTo.HasValue)
                result = result.Where(t => t.DateCreated < dateCreatedTo.Value);
            if (showOnlyApproved)
                result = result.Where(t => t.IsApproved == true);

            return result.ToList();
        }
示例#3
0
        public static IList<Order> GetOrders(Customer customer, Employee emp, Territory terr,
            DateTime? startDate, DateTime? endDate, Dictionary orderStatus)
        {
            Repository<Order, Guid> rep = new Repository<Order, Guid>();
            var result = from o in rep.GetQueryable() select o;
            if (customer != null)
                result = result.Where(o => o.CustomerFacility.Customer == customer);
            if (emp != null)
                result = result.Where(o => o.Employee == emp);
            if (terr != null)
                result = result.Where(o => o.Territory == terr);
            if (orderStatus != null)
                result = result.Where(o => o.OrderStatus == orderStatus);
            if (startDate.HasValue)
                result = result.Where(o => o.OrderDate > startDate.Value);
            if (endDate.HasValue)
                result = result.Where(o => o.OrderDate < endDate.Value);

            return result.ToList();
        }