public void OrderAddingItemsShouldNotifyPropertyChange(string propertyName) { OrderList test = new OrderList(); BriarheartBurger item = new BriarheartBurger(); test.Add(item); Assert.PropertyChanged(test, propertyName, () => { test.Add(item); }); }
public void ShouldHaveCorrectPriceSum() { OrderList test = new OrderList(); test.Add(new BriarheartBurger()); test.Add(new DoubleDraugr()); test.Add(new MarkarthMilk() { Size = Size.Large }); double sum = 6.32 + 7.32 + 1.22; sum = (Math.Round(sum, 2)); Assert.Equal <double>(sum, test.Subtotal); }
public override void ProcessSignal(List <ISignal> signalList) { var cl = signalList.Where(v => v.Name.EndsWith("RecentHighPriceCondition")).ToList(); if (cl == null || cl.Count() == 0) { return; } cl.ForEach(v => { var info = CurrentPortfolio.PositionList.FirstOrDefault(i => i.InstrumentTicker == v.Ticker); if (info != null && info.Shares == 0) { var o = CurrentPortfolio.GenerateOrderByPercent(v.Ticker, v.Price, percent, OrderType.Buy); if (o != null) { o.OrderTime = v.Time; //info.ProcessOrder(o); OrderList.Add(o); } } }); }
/// <summary> /// When the button "btnIceAdd" is clicked, add a new "Order" to the "OrderList" that contains the name and the amount of the ice cream, then refresh the list. /// </summary> private void btnIceAdd_Click(object sender, RoutedEventArgs e) { try { int selectedAmount = int.Parse(tbxIceAmount.Text); if (selectedAmount > 0 && selectedAmount <= 255) { OrderList.Add(new Order() { Product = ChosenProducts, Amount = selectedAmount }); Refresh(); } else if (selectedAmount <= 0) { MessageBox.Show("Vælg venligst minimum 1 is."); } else if (selectedAmount > 255) { MessageBox.Show("Vælg venligst højst 255 is ad gangen."); } else { MessageBox.Show("Ukendt fejl."); } DataGridCheck(); } catch (FormatException) { MessageBox.Show("Indtast venligst et gyldigt nummer."); } catch (OverflowException) { MessageBox.Show("Vælg venligst et antal mellem 1 og 255."); } }
public void ShouldHaveCorrectSubtotal() { OrderList test = new OrderList(); test.Add(new BriarheartBurger()); Assert.Equal <double>(6.32, test.Subtotal); }
public IBarcode Add(string barcodeString, SaleStatus status) { //匹配已存在商品(1、状态相同(Promotion促销状态此时默认与正常状态为同一状态)2、条码相同(一品多码、多条码串、主条目)3、该商品不能为称重商品 4、商品要允许改价) var product = OrderList.Where(o => o.Details.EnableEditNum && (o.Details.SaleStatus == status || (status == SaleStatus.Normal && o.Details.SaleStatus == SaleStatus.Promotion)) && o.ProductType != ProductType.Weigh && !o.HasEditPrice && o.SameProduct(barcodeString)).FirstOrDefault(); if (product != null) { product.SaleNumber++; } else { product = BarcodeFactory.Factory(MachineInformation.StoreId, MachineInformation.MachineSn, MachineInformation.CompanyId, barcodeString, status); switch (status) { case SaleStatus.POSGift: case SaleStatus.ActivityGifts: product.SalePrice = 0; break; } OrderList.Add(product); } //移除活动赠品 ResetProduct(status); return(product); }
public void AddOrder(string title, string description, string date, List <string> items, List <int> quantity) { _orderId++; Order newOrder = new Order(_orderId, title, description, date, items, quantity); OrderList.Add(newOrder); }
public async void LoadOrdersAsync() { List <Order> orders = null; try { orders = await PersistencyService.LoadOrdersAsync(); } catch (Exception e) { Debug.WriteLine(e); throw; } if (orders != null) { foreach (Order order in orders) { OrderList.Add(order); } } else { throw new ArgumentNullException("Orders list null"); } }
public Task <Order> Create(Order order) { int newOrderId = OrderList.Count > 0 ? OrderList.Max(o => o.Id) + 1 : 1; order.Id = newOrderId; OrderList.Add(order); return(Task <Order> .FromResult(order)); }
/// <summary> /// Updates order's grid view. /// </summary> private void UpdateOrderGridView() { OrderList.Clear(); foreach (var item in _orderService.GetAll().Result) { OrderList.Add(item); } }
public async Task RefresOrdersAsync() { var data = await OrderService.GetOrdersAsync(); OrderList.Clear(); foreach (var item in data) { OrderList.Add(item); } }
public void StartingPriceShouldBeZero() { OrderList test = new OrderList(); Assert.Equal <double>(0, test.Subtotal); OrderList order2 = new OrderList(); order2.Add(new WarriorWater()); Assert.Equal <double>(0, order2.Subtotal); }
public OrderBase AddOrder(OrderType orderType) { OrderBase order = OrderFactory.CreateOrder(this, orderType); OrderList.Add(order); OrderAdded?.Invoke(order); return(order); }
public Orders() { DataContext = this; InitializeComponent(); List <IPersistable> li = dc.GetEntities("ORDER"); foreach (IPersistable item in li) { OrderList.Add(item as Order); } }
/// <summary> /// Method for filtering view. /// </summary> public void FilterViewAcordingToRoles() { OrderList.Clear(); foreach (Order o in OrdersFromWebAPI) { var newOrder = CopyOrderExceptEvents(o); foreach (Event e in o.DCRGraph.Events) { if (!e.Groups.Exists(ev => ev.Name == "Edit events") && e.Groups.Exists(ev => ev.Name == "only pending")) //Filter out "Edit events" and be sure the event shows for "only pending" { foreach (Role r in e.Roles) { if (Manager) //If manager is checked off, we just add all events. { if (!newOrder.DCRGraph.Events.Contains(e)) { newOrder.DCRGraph.Events.Add(e); continue; } } if (r.Name == "Waiter" && Waiter) { if (!newOrder.DCRGraph.Events.Contains(e)) { newOrder.DCRGraph.Events.Add(e); continue; } } if (r.Name == "Chef" && Chef) { if (!newOrder.DCRGraph.Events.Contains(e)) { newOrder.DCRGraph.Events.Add(e); continue; } } if (r.Name == "Delivery" && Delivery) { if (!newOrder.DCRGraph.Events.Contains(e)) { newOrder.DCRGraph.Events.Add(e); continue; } } } } } if (_ShowOnlyPendingOrders && newOrder.DCRGraph.Events.Count == 0) //If no event are to be shown in order, don't add it. It is not relevant. { continue; } OrderList.Add(newOrder); } }
public async Task GetOrders() { ProgressBarVal = "0"; List <OrdersResponseModel> Orders = await dashboardRepo.GetOrders(); OrderList.Clear(); foreach (var o in Orders) { OrderList.Add(o); } ProgressBarVal = "100"; }
public void PlaceOrder(IOrder order) { if (this.StoreName == order.Vehicle.Producer.ProducerName.ToString()) { OrderList.Add(order); Console.WriteLine($"Following order was placed:\n {order.AllDetails}"); } else { Console.WriteLine("Sorry, can not place order in this store."); } }
public OrderList Map(GetOrdersQueryResult list) { var result = new OrderList(); foreach (var item in list) { result.Add(Map(item)); } result.PagingInfo = Map(list.PagingInfo); return(result); }
private void NewOrder() { var order = new Order(); var vm = new EditOrderViewModel(new UnitOfWorkFactory(), order); vm.Init(); var window = new EditOrderView(vm); if (window.ShowDialog() ?? false) { OrderList.Add(order); } }
} // Update /// <summary> /// Sort the control and their children. /// </summary> /// <param name="controlList"></param> private static void SortLevel(ControlsList controlList) { if (controlList != null) { for (int i = 0; i < controlList.Count; i++) { if (controlList[i].Visible) { OrderList.Add(controlList[i]); SortLevel(controlList[i].ChildrenControls); } } } } // SortLevel
public async Task PlayCardAsync(int deck) { T thisCard = _gameContainer.GetSpecificCardFromDeck(deck); thisCard.Player = _gameContainer.WhoTurn; int index = GetCardIndex(); T newCard = _gameContainer.GetBrandNewCard(deck); newCard.Player = _gameContainer.WhoTurn; newCard.Visible = true; OrderList.Add(newCard); TradeCard(index, newCard); await AfterPlayCardAsync(thisCard); }
public void AddItem() { if (SelectedItem != null) { if (!OrderList.Contains(SelectedItem)) { OrderList.Add(SelectedItem); SelectedItem.OrderQuantity = 1; CalcSubTotalNet(); } else { this._dialog.ShowMessageAsync(this, "Uwaga", "Produkt znajduje się już na liście"); } } }
private OrderList ConvertOrderArrayListToOrderList(ArrayList orderList, object amountPosition, object pricePosition, int?maxSize = null) { OrderList returnList = new OrderList(); //If a maximum size was given, only put that number of orders in the asks and bids lists. Otherwise, get them all. if (maxSize != null && maxSize < orderList.Count) { orderList = orderList.GetRange(0, maxSize.Value); } if (orderList != null && orderList.Count > 0) { foreach (object order in orderList) { decimal amount = 0.0m; decimal price = 0.0m; if (order != null && order.GetType() == typeof(Dictionary <string, object>)) { Dictionary <string, object> orderDict = (Dictionary <string, object>)order; if (orderDict.ContainsKey((string)pricePosition) && orderDict.ContainsKey((string)amountPosition) && orderDict[(string)amountPosition] != null && orderDict[(string)pricePosition] != null) { amount = TypeConversion.ParseStringToDecimalStrict(orderDict[(string)amountPosition].ToString()); price = TypeConversion.ParseStringToDecimalStrict(orderDict[(string)pricePosition].ToString()); } } else if (order != null && order.GetType() == typeof(ArrayList)) { ArrayList orderArrayList = (ArrayList)order; //Make sure each order has a price and amount if (orderArrayList.Count >= 2) { amount = TypeConversion.ParseStringToDecimalStrict(orderArrayList[(int)amountPosition].ToString()); price = TypeConversion.ParseStringToDecimalStrict(orderArrayList[(int)pricePosition].ToString()); } } returnList.Add(new Order(amount, price)); } } return(returnList.Count <= 0 ? null : returnList); }
protected override void OnColumnHeaderMouseClick(DataGridViewCellMouseEventArgs e) { if (OrderList != null) { OrderList.Clear(); } else { OrderList = new List <OrderEntity>(); } sortAsc = !sortAsc; OrderList.Add(new OrderEntity(Columns[e.ColumnIndex].Name, sortAsc)); RefreshList(); }
/// <summary> /// Method for getting all orders which holds status 2, indicating that an order is ready to be served /// </summary> public async void GetAllOrders() { DataBaseList = await rep.GetOrderByStatus(2); OrderList.Clear(); foreach (Order item in DataBaseList) { OrderViewModel model = new OrderViewModel(); model.OrderID = item.OrderID; model.Price = item.Price; model.Status = item.Status; OrderList.Add(model); } }
private async void UpdateOrderList() { try { MainPage.Current.ActiveProgressRing(); OrderList.Clear(); (await GetSearchedData()).ForEach(item => { OrderList.Add(item); }); } catch (Exception ex) { await MainPage.ShowErrorMessage(ex.Message); } finally { MainPage.Current.InActiveProgressRing(); } }
/// <summary> /// Fetch OrderList. /// </summary> /// <param name="criteria">The criteria.</param> /// <returns></returns> public OrderList Fetch(OrderCriteria criteria) { OrderList item = (OrderList)Activator.CreateInstance(typeof(OrderList), true); bool cancel = false; OnFetching(criteria, ref cancel); if (cancel) { return(item); } // Fetch Child objects. using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); using (var command = new SqlCommand("[dbo].[CSLA_Order_Select]", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag)); command.Parameters.AddWithValue("@p_ShipAddr2HasValue", criteria.ShipAddr2HasValue); command.Parameters.AddWithValue("@p_BillAddr2HasValue", criteria.BillAddr2HasValue); using (var reader = new SafeDataReader(command.ExecuteReader())) { if (reader.Read()) { do { item.Add(new OrderFactory().Map(reader)); } while(reader.Read()); } } } } MarkOld(item); MarkAsChild(item); OnFetched(); return(item); }
/// <summary> /// Fetch OrderList. /// </summary> /// <param name="criteria">The criteria.</param> /// <returns></returns> public OrderList Fetch(OrderCriteria criteria) { OrderList item = (OrderList)Activator.CreateInstance(typeof(OrderList), true); bool cancel = false; OnFetching(criteria, ref cancel); if (cancel) { return(item); } // Fetch Child objects. string commandText = String.Format("SELECT [OrderId], [UserId], [OrderDate], [ShipAddr1], [ShipAddr2], [ShipCity], [ShipState], [ShipZip], [ShipCountry], [BillAddr1], [BillAddr2], [BillCity], [BillState], [BillZip], [BillCountry], [Courier], [TotalPrice], [BillToFirstName], [BillToLastName], [ShipToFirstName], [ShipToLastName], [AuthorizationNumber], [Locale] FROM [dbo].[Orders] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag)); using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); using (var command = new SqlCommand(commandText, connection)) { command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag)); using (var reader = new SafeDataReader(command.ExecuteReader())) { if (reader.Read()) { do { item.Add(new OrderFactory().Map(reader)); } while(reader.Read()); } } } } MarkOld(item); MarkAsChild(item); OnFetched(); return(item); }
/// <summary> /// Add Order /// </summary> /// <param name="order"></param> /// <param name="index">Optional, insert index</param> public static void AddOrder(Order order, int index = -1) { if (index < 0) { if (OrderList.Count == 0) { OrderList.Add(order); return; } // Add in appropriate date slot for (int i = 0; i < OrderList.Count; i++) { OrderList.Insert(i, order); return; } } else { OrderList.Insert(index, order); } // Sort by date }
public void CreateOrderList() { OrderList.Clear(); SqlConnection con = Methods.AccessDatabase(); SqlDataAdapter autoNode = new SqlDataAdapter("SELECT * From [ORDER]", con); DataTable dt = new DataTable(); autoNode.Fill(dt); for (int i = 0; i < dt.Rows.Count; i++) { ORDER newOrder = new ORDER(); newOrder.OrderID = Convert.ToInt16(dt.Rows[i]["Order_ID"]); newOrder.SupplierID = Convert.ToInt16(dt.Rows[i]["Supplier_ID"]); newOrder.ProductID = Convert.ToInt16(dt.Rows[i]["Product_ID"]); newOrder.DateOrdered = Convert.ToDateTime(dt.Rows[i]["Date"]); newOrder.QuantityOrdered = Convert.ToInt16(dt.Rows[i]["Quantity_Ordered"]); OrderList.Add(newOrder); } }