private void CheckPendingOrders() { List <ETC.Order> orders = ETC.Order.ListByAccountID(Common.Session.Account.ID); ETC.Order order = null; foreach (ETC.Order _order in orders) { if (_order.Status == ETC.Order.STATUS_PENDING) { order = _order; break; } } if (order == null) { order = ETC.Order.ExecuteCreate(Common.Session.Account.ID, ETC.Order.STATUS_PENDING, ETC.Order.PAYMENT_METHOD_DEFAULT, Constants.DEFAULT_VALUE_DECIMAL); order.Insert(); } if (order.ID != Constants.DEFAULT_VALUE_INT) { Common.Session.CurrentOrderID = order.ID; this.order = order; } }
public static void UpdateTotalAmountInOrder(int OrderID) { ETC.Order order = ETC.Order.ExecuteCreate(OrderID); List <ETC.OrderItem> list = ETC.OrderItem.ListByOrderID(OrderID); decimal total = 0.00m; foreach (ETC.OrderItem item in list) { total += item.Subtotal; } order.Update(DateTime.Now, order.Status, order.PaymentMethod, total); }
public static bool RemoveOrder(int?orderID) { bool result = false; if (orderID != null) { ETC.Order order = ETC.Order.ExecuteCreate(orderID ?? 0); order.Delete(); result = true; } return(result); }
public OrderViewModel(int OrderID) { this.order = ETC.Order.ExecuteCreate(OrderID); if (this.order != null) { this.id = this.order.ID; this.accountID = this.order.AccountID; this.dateCreated = this.order.DateCreated; this.status = this.order.Status; this.paymentMethod = this.order.PaymentMethod; this.totalAmount = this.order.TotalAmount; this.orderItems = ETC.OrderItem.ListByOrderID(this.id); this.user = this.order.ExecuteCreateAccountByAccountID(); } }
private static void CheckPendingOrders() { List <ETC.Order> orders = ETC.Order.ListByAccountID(Common.Session.Account.ID); ETC.Order order = null; foreach (ETC.Order item in orders) { if (item.Status == ETC.Order.STATUS_PENDING) { order = item; break; } } if (order == null) { ETC.Order newOrder = ETC.Order.ExecuteCreate(Common.Session.Account.ID, ETC.Order.STATUS_PENDING, ETC.Order.PAYMENT_METHOD_DEFAULT, 0.00m); newOrder.Insert(); order = newOrder; } Common.Session.CurrentOrderID = order.ID; }