-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathFreeSaleForm.cs
50 lines (42 loc) · 1.32 KB
/
FreeSaleForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DvizhSeller
{
public partial class FreeSaleForm : Form
{
public CashierForm cashierForm;
public FreeSaleForm(CashierForm setCashierForm)
{
cashierForm = setCashierForm;
InitializeComponent();
}
private void FreeSaleForm_Load(object sender, EventArgs e)
{
priceBox.Select();
priceBox.Focus();
}
private void FreeSaleForm_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
string productName = nameBox.Text;
double productPrice = Convert.ToDouble(priceBox.Text);
int count = Convert.ToInt16(productCount.Value);
entities.Product product = new entities.Product(0, "0", productName, productPrice);
cashierForm.PutToCart(product, count);
productCount.Value = 1;
nameBox.Text = "Товар X";
priceBox.Text = "";
cashierForm.BarCodeFocus();
this.Close();
}
}
}
}