public RowBill(string soLuong, string ten, string gia) { this.Amount = soLuong; this.Name = ten; AddSpace.Space(ref gia); this.Price = gia; }
public UCMonAn(string name, int price, int sale, string ID) { InitializeComponent(); lbName.Text = name; if (sale == 0) { string Price1 = price.ToString(); AddSpace.Space(ref Price1); lbPrice1.Text = Price1; lbSale.Hide(); lbPrice2.Hide(); } else { lbSale.Text = "Sale: " + sale.ToString() + "%"; string Price1 = (price * (100 - sale) / 100).ToString(); AddSpace.Space(ref Price1); lbPrice1.Text = "Giá:" + Price1; string Price2 = price.ToString(); AddSpace.Space(ref Price2); lbPrice2.Text = "Giá ban đầu: " + Price2; } btnPictureFood.BackColor = Color.Red; this.BackColor = Color.Orange; Bitmap bm1 = new Bitmap(Application.StartupPath + "\\image\\" + ID.ToString().Trim() + ".jpg"); Bitmap bm2 = new Bitmap(bm1); bm1.Dispose(); btnPictureFood.BackgroundImage = bm2; }
public void load()///load hoadon { List <RowBill> ListBill = new List <RowBill>(); Total = 0; this.DgvBill.Width = 300; this.DgvBill.Height = 75; for (int i = 0; i < listCount.Count; i++) { Total = Total + listCount[i] * Convert.ToInt32(listFood[i].Price * (100 - listFood[i].Sale) / 100); if (listCount[i] > 0) { RowBill rb = new RowBill(listCount[i].ToString(), listFood[i].Name.ToString(), ((listFood[i].Price * listCount[i] * (100 - listFood[i].Sale) / 100).ToString())); ListBill.Add(rb); if (DgvBill.Height < 200) { DgvBill.Height = DgvBill.Height + 20; } } } DgvBill.DataSource = ListBill; string strTotal = Total.ToString(); AddSpace.Space(ref strTotal); lb1.Text = "Tổng: " + strTotal; }