Beispiel #1
0
        public static SalesOrderHeader CreateNewOrder(thisCustomer customer,
                                                      [Optionally] bool copyHeaderFromLastOrder,
                                                      IQueryable <BusinessEntityAddress> addresses,
                                                      IQueryable <SalesOrderHeader> headers)
        {
            throw new NotImplementedException(); //TODO
            //            SalesOrderHeader newOrder = null;//Container.NewTransientInstance<SalesOrderHeader>();
            //newOrder.Customer = customer;

            //if (copyHeaderFromLastOrder) {
            //    SalesOrderHeader last = LastOrder(customer, headers);
            //    if (last != null) {
            //        newOrder.BillingAddress = last.BillingAddress;
            //        newOrder.ShippingAddress = last.ShippingAddress;
            //        newOrder.CreditCard = last.CreditCard;
            //        newOrder.ShipMethod = last.ShipMethod;
            //        newOrder.AccountNumber = last.AccountNumber;
            //    }
            //}
            //else {
            //    newOrder.BillingAddress = PersonRepository.AddressesFor(customer.BusinessEntity(), addresses,  "Billing").FirstOrDefault();
            //    newOrder.ShippingAddress = PersonRepository.AddressesFor(customer.BusinessEntity(), addresses, "Shipping").FirstOrDefault();
            //}
            //return newOrder;
        }
Beispiel #2
0
 public static QuickOrderForm QuickOrder(thisCustomer customer)
 {
     throw new NotImplementedException();
     //var qo = Container.NewViewModel<QuickOrderForm>();
     //qo.Customer = customer;
     //return qo;
 }
Beispiel #3
0
        public static IQueryable <SalesOrderHeader> SearchForOrders(
            thisCustomer customer,
            [Optionally][Mask("d")] DateTime?fromDate,
            [Optionally][Mask("d")] DateTime?toDate,
            IQueryable <SalesOrderHeader> query)
        {
            int customerID = customer.CustomerID;

            var headers = from obj in query
                          where ((fromDate == null) || obj.OrderDate >= fromDate) &&
                          ((toDate == null) || obj.OrderDate <= toDate)
                          orderby obj.OrderDate
                          select obj;

            return(customer == null ?
                   headers
                 : headers.Where(x => x.Customer.CustomerID == customerID));
        }