private void listProducts() { List <Product> products = ProductQuery.getProducts(); foreach (Product product in products) { ProductBox productBox = new ProductBox(product, this); Border border = new Border(); border.BorderBrush = Brushes.Black; border.BorderThickness = new Thickness(2); border.CornerRadius = new CornerRadius(5); border.Margin = new Thickness(20); border.Padding = new Thickness(15); border.Background = Brushes.White; DropShadowEffect DropShadow = new DropShadowEffect(); DropShadow.BlurRadius = 5; DropShadow.Color = Color.FromRgb(0, 0, 0); DropShadow.Opacity = 1; border.Effect = DropShadow; border.Child = productBox; _productContainer.Children.Add(border); } }
private void ComboBoxOrderBy_SelectedIndexChanged(object sender, EventArgs e) { TextBoxSearch.Focus(); if (ComboBoxOrderBy.SelectedIndex == 0) { ProductBox.Products = ProductBox.Products.OrderBy(Product => !Product.Promotion).ThenByDescending(Product => Product.PromotionPercentage).ToList(); } if (ComboBoxOrderBy.SelectedIndex == 1) { ProductBox.Products = ProductBox.Products.OrderBy(Product => Product.Name).ToList(); } if (ComboBoxOrderBy.SelectedIndex == 2) { ProductBox.Products = ProductBox.Products.OrderByDescending(Product => Product.Promotion ? Product.PromotionValue : Product.Value).ToList(); } if (ComboBoxOrderBy.SelectedIndex == 3) { ProductBox.Products = ProductBox.Products.OrderBy(Product => Product.Promotion ? Product.PromotionValue : Product.Value).ToList(); } ProductBox.UpdateView(); }
// Chon 1 san pham private void ProductBox_MouseDown(object sender, MouseEventArgs e) { ListViewHitTestInfo info = ProductBox.HitTest(e.X, e.Y); ListViewItem item = info.Item; if (item != null) { selected_qrcode = qrcode_input.Text = item.Text; for (int index = 0; index < temp.Count; ++index) { if (temp.ElementAt(index).qrcode == selected_qrcode) { string name = temp.ElementAt(index).name; string price = temp.ElementAt(index).price; string quantity = temp.ElementAt(index).quantity; resultBox.Text = "Tên sản phẩm: " + name; resultBox.AppendText(Environment.NewLine); resultBox.AppendText("Giá: " + price); resultBox.AppendText(Environment.NewLine); resultBox.AppendText("Số lượng: " + quantity); break; } } } /*else * { * this.listView1.SelectedItems.Clear(); * resultBox.Text = "No Item is Selected"; * }*/ }
public void GetBox(ProductBox getBox) { animator.SetTrigger("PickUp"); carryingBox = getBox; getBox.MoveBoxTo(carryBoxPos); animator.SetBool("hasBox", true); }
public void SetCurrentBox(ProductBox incomingBox) { currentBox = incomingBox; // make the box place on the top of station incomingBox.MoveBoxTo(boxTransform); currentBox.transform.position = boxTransform.position; }
public Machine(ProductBox prodcutBox, CoinBox rBox, CoinBox sBox, IMessenger messenger) { this._pBox = prodcutBox; this._rBox = rBox; this._sBox = sBox; this._msg = messenger; this._status = MachineStatus.Init; }
public void Reset() { ProductBox.Products = DAO.Products.ListEnableds(); ProductBox.Products = ProductBox.Products.OrderBy(Product => !Product.Promotion).ThenByDescending(Product => Product.PromotionPercentage).ToList(); ProductBox.UpdateView(); CartPanel.Order.Products.Clear(); CartPanel.CartProductBox.UpdateView(); CartPanel.UpdateView(); }
private void TextBoxSearch_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { ProductBox.Products = DAO.Products.ListEnableds().Where( Product => Product.Name.IndexOf(TextBoxSearch.TextOnly, StringComparison.OrdinalIgnoreCase) >= 0 || Product.Category.Name.IndexOf(TextBoxSearch.TextOnly, StringComparison.OrdinalIgnoreCase) >= 0 ).ToList(); ComboBoxOrderBy_SelectedIndexChanged(ComboBoxOrderBy, EventArgs.Empty); ProductBox.UpdateView(); } }
private void NewButton_Click(object sender, RoutedEventArgs e) { string image = ((Anh)ImageBox.SelectedValue).ImagePath; Thongtins.Add(new Thongtin { Product = ProductBox.Text, Description = DescriptionBox.Text, anh = image }); ProductBox.Text = ""; DescriptionBox.Text = ""; ImageBox.SelectedIndex = -1; ProductBox.Focus(FocusState.Programmatic); }
private static void Main(string[] args) { while (true) { Console.Write("Enter Weight in kg: "); var weight = Console.ReadLine(); if (string.IsNullOrWhiteSpace(weight)) { Console.Clear(); continue; } Console.Write("Enter Height in cm: "); var height = Console.ReadLine(); if (string.IsNullOrWhiteSpace(height)) { Console.Clear(); continue; } Console.Write("Enter Width in cm: "); var width = Console.ReadLine(); if (string.IsNullOrWhiteSpace(width)) { Console.Clear(); continue; } Console.Write("Enter Depth: "); var depth = Console.ReadLine(); if (string.IsNullOrWhiteSpace(depth)) { Console.Clear(); continue; } Console.WriteLine("-------------------------"); var box = new ProductBox(depth.ChangeType <int>(), height.ChangeType <int>(), width.ChangeType <int>()); var delivery = new DeliveryItem(box, weight.ChangeType <double>()); delivery.Print(); Console.ReadKey(); Console.Clear(); Thread.Sleep(1000); } }
public void instantiatePool(int numsOfBoxes) { for (int i = 0; i < numsOfBoxes; i++) { //Instatiate Boxpanel GameObject boxPanelGameObject = Instantiate(boxPanelPrefab, boxPanels); GameObject currentBoxGameObject = Instantiate(boxPrefab); ProductBox productBox = currentBoxGameObject.GetComponent <ProductBox>(); BoxPanel boxPanel = boxPanelGameObject.GetComponent <BoxPanel>(); productBox.boxPanel = boxPanel; boxesPool.Add(productBox); int randomIndex = Random.Range(0, processTypeSequences.Count); while (processTypeSequences[randomIndex].Length > maxProcessesPerBox) { randomIndex = Random.Range(0, processTypeSequences.Count); } productBox.processes.Add(GameConstants.StationType.CInspection); //Instantiate(productionIconsPrefab, boxPanelGameObject.GetComponent<BoxPanel>().productionIconsTransform.transform); for (int seqIndex = 0; seqIndex < processTypeSequences[randomIndex].Length; seqIndex++) { switch (processTypeSequences[randomIndex][seqIndex]) { case 'L': productBox.processes.Add(lightProcessToBeRandomize[Random.Range(0, lightProcessToBeRandomize.Count)]); break; case 'H': productBox.processes.Add(heavyProcessToBeRandomize[Random.Range(0, heavyProcessToBeRandomize.Count)]); break; default: break; } // Instantiate(prefabIcon, transform) with parent as boxpanel; GameObject productionIcon = Instantiate(productionIconsPrefab, boxPanel.productionIconsTransform.transform); boxPanel.productionIcons.Add(productionIcon.GetComponent <Image>()); } productBox.processes.Add(GameConstants.StationType.CPolishing); GameObject polishingProductionIcon = Instantiate(productionIconsPrefab, boxPanelGameObject.GetComponent <BoxPanel>().productionIconsTransform.transform); boxPanel.productionIcons.Add(polishingProductionIcon.GetComponent <Image>()); } }
public void Interact(PlayerBot player, ProductBox incomingBox) { Debug.Log("Station Top Interacted " + gameObject.name); if (stationType == GameConstants.StationType.CTable || stationType == GameConstants.StationType.CBoxGenerator) { progress = 1f; } if (incomingBox && !currentBox) { Debug.Log("Placed!"); SetCurrentBox(incomingBox); player.BoxGiven(); if (stationType != GameConstants.StationType.CTable && stationType != GameConstants.StationType.CBoxGenerator) { player.StartWork(this); } if (incomingBox.currentWork < incomingBox.processes.Count && incomingBox.processes[incomingBox.currentWork] == stationType && PlayerTypeCompatibleCheck(player)) { isWorking = true; progress = 0f; } } else if (!incomingBox && currentBox) { if (!isWorking && progress >= 1f) { if (progress >= 1f) { CurrBoxPickedUp(player); } else { isWorking = true; player.StartWork(this); } } } if (stationType == GameConstants.StationType.CBoxGenerator) { this.GetComponent <BoxGenerator>().SpawnBox(); } }
// Update is called once per frame void Update() { if (thisStation.currentBox) { ProductBox currentBox = thisStation.currentBox; if (currentBox.processes.Count == currentBox.currentWork) { // the box is done numOfBoxesAccepted++; // play animation } } if (numOfBoxesAccepted == gManager.numsOfBoxes) { gManager.showResult(); } }
// Load a CSV file into an array of rows and columns. // Assume there may be blank lines but every line has // the same number of fields. public static ProductBox[] LoadCsv(string filename) { // Get the file's text. string whole_file = System.IO.File.ReadAllText(filename); // Split into lines. whole_file = whole_file.Replace('\n', '\r'); string[] lines = whole_file.Split(new char[] { '\r' }, StringSplitOptions.RemoveEmptyEntries); // See how many rows and columns there are. int num_rows = lines.Length; int num_cols = 12; //lines[0].Split(',').Length; // Allocate the data array. //string[,] values = new string[num_rows, num_cols]; ProductBox[] Shapes = new ProductBox[12]; // Load the array. for (int r = 0; r < num_rows; r++) { string[] line_r = lines[r].Split(';'); Point[] points = new Point[line_r.Length]; for (int c = 0; c < line_r.Length; c++) { try { string[] point = line_r[c].Split(','); points[c] = new Point(Convert.ToInt32(point[0]), Convert.ToInt32(point[1])); } catch { continue; } } Shapes[r] = new ProductBox(points); Shapes[r].ID = r + 1; } // Return the values. return(Shapes); }
private void FormMain_Load(object sender, EventArgs e) { ProductBox.Products = DAO.Products.ListEnableds(); ProductBox.ClickProductBuy += ProductBox_ClickProductBuy; ProductBox.UpdateView(); ComboBoxOrderBy.SelectedIndex = 1; ComboBoxOrderBy.SelectedIndex = 0; CartPanel.CartProductBox.ChangeProductQuantity += CartProductBox_ChangeProductQuantity; CartPanel.CartProductBox.ClickProductRemove += CartProductBox_ClickProductRemove; CartPanel.ClickFinishOrder += CartPanel_ClickFinishOrder; Menu.Login += Menu_Login; Menu.Logout += Menu_Logout; Menu.Admin += Menu_Admin; Menu.Register += Menu_Register; Menu.Profile += Menu_Profile; Menu.Order += Menu_Order; }
public void TestInit() { pBox = new ProductBox("products", 40, 20); // name, typs of products, capacity of each product pBox.AddProduct(water, 20); // product, count pBox.AddProduct(soda, 20); pBox.AddProduct(cola, 20); /// 100 x 1p, 50 x 5p, 50 x 10p sBox = new CoinBox(Machine.StoreCoinBox); sBox.AddCoins(one, 100); // coin, count sBox.AddCoins(five, 50); sBox.AddCoins(ten, 50); rBox = new CoinBox(Machine.ReceiveCoinBox); rBox.Clear(); machine = new TestMachine(pBox, rBox, sBox, TestMessenger.Default); machine.Start(); }
public void IsEmptyTest() { /// ProductBox ProductBox pBox = new ProductBox("temp product box", 40, 20); Assert.IsTrue(pBox.IsEmpty); string productName = Guid.NewGuid().ToString(); int productPrice = Guid.NewGuid().GetHashCode(); pBox.AddProduct(new Product(productName, productPrice), 0); Assert.IsTrue(pBox.IsEmpty); Assert.AreEqual(0, pBox[new Product(productName, productPrice)]); pBox.AddProduct(new Product(productName, productPrice), 10); Assert.IsFalse(pBox.IsEmpty); Assert.AreEqual(10, pBox[new Product(productName, productPrice)]); /// CoinBox CoinBox cBox = new CoinBox("temp coin box"); Assert.IsTrue(cBox.IsEmpty); cBox.AddCoins(new Coin(1), 0); Assert.IsTrue(cBox.IsEmpty); cBox.AddCoins(new Coin(2), 0); Assert.IsTrue(cBox.IsEmpty); cBox.AddCoins(new Coin(5), 0); Assert.IsTrue(cBox.IsEmpty); cBox.AddCoins(new Coin(1), 1); Assert.IsFalse(cBox.IsEmpty); cBox.Clear(); Assert.IsTrue(cBox.IsEmpty); }
void CurrBoxPickedUp(PlayerBot player) { player.GetBox(currentBox); currentBox = null; Debug.Log("Got!"); }
public DeliveryItem(ProductBox box, double weight) : base(box) { Weight = weight; }
public DeliveryItem(ProductBox box) : this(box, 0d) { }
public void Reload() { ProductBox.Products = DAO.Products.ListEnableds(); ProductBox.Products = ProductBox.Products.OrderBy(Product => !Product.Promotion).ThenByDescending(Product => Product.PromotionPercentage).ToList(); ProductBox.UpdateView(); }
public TestMachine(ProductBox pBox, CoinBox rBox, CoinBox sBox, TestMessenger messenger) : base(pBox, rBox, sBox, messenger) { }
protected DeliveryBase(ProductBox box) { Volume = box.Depth * box.Height * box.Width; Box = box; }
public void BoxGiven() { animator.SetTrigger("Place"); animator.SetBool("hasBox", false); carryingBox = null; }