private void AddItem(object sender, RoutedEventArgs e) { if (ItemBox.Text != "" || PriceBox.Text != "") { float price = 0; price = Convert.ToUInt64(PriceBox.Text); using (var context = new LoginDBEntities()) { var product = new ProductFromPeople() { UserName = Person.Login, ProductName = ItemBox.Text, Price = price }; context.ProductFromPeoples.Add(product); context.SaveChanges(); ItemBox.Clear(); PriceBox.Clear(); MessageBox.Show("Wait , when admin to add your thing to the main list"); } } else { MessageBox.Show("Incorrect"); } }
private void CheckoutForm_Load(object sender, EventArgs e) { var itemRepository = new ItemRepository(Context); OrderRepository = new OrderRepository(Context); Text = $@"Order#{Order.Client.ReceiptType.Type}{Order.OrderNumber:000000000}"; CustInfoTextBox.Text = $@"Client: {Order.Client.Name} | RNC: {Order.Client.RNC}"; OrderInfoTextBox.Text = $@"Order#{Order.Client.ReceiptType.Type}{Order.OrderNumber:000000000} | Date: {Order.OrderDate}"; OrderLines = OrderRepository.GetOrderItems(Order); foreach (var line in OrderLines) { var item = itemRepository.Get(it => it.Id == line.ItemId); OrderItemListBox.Items.Add($"{item.Name}"); PriceBox.Items.Add($"{item.Price:$00.00}"); } OrderItemListBox.Refresh(); PriceBox.Refresh(); SubTotalBox.Text = $@"{Order.SubTotal:$00.00}"; ITBISBox.Text = $@"{Order.ITBIS:$00.00}"; TipBox.Text = $@"{Order.Tip:$00.00}"; TotalBox.Text = $@"{Order.Total:$00.00}"; }
private void Save_Click(object sender, EventArgs e) { if (ValidateChildren()) { //Adding Rows DataGridViewRow row = (DataGridViewRow)dataGridView1.Rows[0].Clone(); row.Cells[0].Value = NameBox.Text; row.Cells[1].Value = PriceBox.Text; row.Cells[2].Value = CategoryBox.Text; row.Cells[3].Value = BrandBox.Text; row.Cells[4].Value = ColorBox.Text; row.Cells[5].Value = BarcodeBox.Text; row.Cells[6].Value = StockBox.Text; row.Cells[7].Value = AdBox.Text; dataGridView1.Rows.Add(row); NameBox.Clear(); PriceBox.Clear(); ColorBox.Clear(); StockBox.Clear(); BarcodeBox.Clear(); AdBox.Clear(); } else { MessageBox.Show("Please fill form correctly,then save!"); } }
private void button1_Click(object sender, EventArgs e) { CFromBox.Clear(); CToBox.Clear(); AirFromBox.Clear(); AirToBox.Clear(); DurationBox.Clear(); PriceBox.Clear(); }
private void BuyOut_Click(object sender, EventArgs e) { if (Shop.Deposits[Shop.IndOfDepByName(DepositComboBox.Text)].DateTimeBuyOut <= DateTime.Now) { MessageBox.Show("Срок кредита истёк!"); --Client.Rank; Shop.Deposits.RemoveAt(Shop.IndOfDepByName(DepositComboBox.Text)); Deposits = Shop.FindDepositsByClient(Client); depositBindingSource.DataSource = Deposits; if (Deposits.Count != 0) { productBindingSource.DataSource = Shop.Deposits[Shop.IndOfDepByName(DepositComboBox.Text)].Products; } else { productBindingSource.DataSource = null; DateTimeBox.Clear(); DateTimeBuyOutBox.Clear(); PriceBox.Clear(); } return; } var res = MessageBox.Show($"К оплате {Shop.GetPrice(Shop.FindDepByName(DepositComboBox.Text), Client)} грн. Подтвердить действие?", "", MessageBoxButtons.YesNo); if (res == DialogResult.Yes) { string name = DepositComboBox.Text; if (DepositComboBox.Text != "") { Shop.Deposits.RemoveAt(Shop.IndOfDepByName(name)); Deposits = Shop.FindDepositsByClient(Client); depositBindingSource.DataSource = Deposits; if (Deposits.Count != 0) { productBindingSource.DataSource = Shop.Deposits[Shop.IndOfDepByName(DepositComboBox.Text)].Products; } else { productBindingSource.DataSource = null; DateTimeBox.Clear(); DateTimeBuyOutBox.Clear(); PriceBox.Clear(); } } Shop.IsDirty = true; ++Client.Rank; } if (Deposits.Count == 0) { BuyOutButton.Enabled = false; } }
private void AddButton_Click(object sender, EventArgs e) { using (StreamWriter VacationPass = new StreamWriter("vacation pass.txt", true)) { VacationPass.WriteLine($"{CFromBox.Text}:{CToBox.Text}:{AirFromBox.Text}:{AirToBox.Text}:{DurationBox.Text}:{PriceBox.Text}"); CFromBox.Clear(); CToBox.Clear(); AirFromBox.Clear(); AirToBox.Clear(); DurationBox.Clear(); PriceBox.Clear(); } }
private void Box_Enter(object sender, EventArgs e) { if (NameBox.Focused) { NameBox.SelectAll(); } if (CountBox.Focused) { CountBox.SelectAll(); } if (PriceBox.Focused) { PriceBox.SelectAll(); } }
//Caution Dirty code below. private void NewButton_Click(object sender, RoutedEventArgs e) { string str = "SELECT `AUTO_INCREMENT`FROM INFORMATION_SCHEMA.TABLES " + "WHERE TABLE_SCHEMA = 'Shop' AND TABLE_NAME = 'Product'"; MySqlCommand cmd = new MySqlCommand(str, conn); object x = cmd.ExecuteScalar(); IDLabel.Text = string.Format("Item Code: {0}", x); NameBox.Clear(); PriceBox.Clear(); WholesaleBox.Clear(); RetailBox.Clear(); SaveButton.IsEnabled = true; DoneImage.Visibility = Visibility.Hidden; }
private void OKButton_Click(object sender, EventArgs e) { try { MainForm.Food.add(FoodNameBox.Text, float.Parse(PriceBox.Text), ++MainForm.codeFood, 0); StreamWriter wr = new StreamWriter("ListFood.txt", true); wr.WriteLine(FoodNameBox.Text); wr.WriteLine(PriceBox.Text); wr.WriteLine(MainForm.codeFood); wr.WriteLine("0"); wr.Close(); MainForm.ListNameFood = MainForm.Food.toArray(Foods.Traversal.Preorder, 1); MainForm.ListPriceFood = MainForm.Food.toArray(Foods.Traversal.Preorder, 2); MainForm.ListCode = MainForm.Food.toArray(Foods.Traversal.Preorder, 3); MainForm.ListFreq = MainForm.Food.toArray(Foods.Traversal.Postorder, 4); this.Close(); } catch { MessageBox.Show("Please input data again"); FoodNameBox.Clear(); PriceBox.Clear(); } }
private void AddBtn_Click(object sender, RoutedEventArgs e) { string ItemName = ItemBox.Text; string DateOfSale = DateBox.Text; string Country = CountryBox.Text; string Currency = CurrencyBox.Text; if (!float.TryParse(PriceBox.Text, out float NetPrice) & float.TryParse(VATbox.Text, out float VAT)) { MessageBox.Show("Net Price and VAT fields can only contain numbers!"); } con.InsertSales(ItemName, Country, Currency, DateOfSale, NetPrice, VAT); MessageBox.Show("Sale has been added."); ItemBox.Clear(); DateBox.Clear(); CountryBox.Clear(); CurrencyBox.Clear(); PriceBox.Clear(); VATbox.Clear(); }
public StockExit(Instrument instrument, Strategy strategy, TradeManager tradeManager) : base(instrument, strategy) { this.tradeManager = tradeManager; this.lastNPrices = new PriceBox(3); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { PriceBox.Focus(); }
private void ClearBtn(object sender, RoutedEventArgs e) { PriceBox.Clear(); QtyBox.Clear(); AmountBox.Clear(); }