private void Form3_Load(object sender, EventArgs e) { loadDataGridView(); label_cost.Text = String.Format("{0:0.00}$", KFCStore.getKFCStore().getTotalCost()); box_datetime.Text = DateTime.Now.ToString(); checkRadioBtn(); }
private void btn_addCoke_Click(object sender, EventArgs e) { int quantity = showInputBox(); if (quantity != 0) { KFCStore.getKFCStore().addItem("Coke", quantity); addProductToGridView("Coke", quantity); } }
private void Form2_Load(object sender, EventArgs e) { table.Columns.Add("Product", typeof(string)); table.Columns.Add("Quantity", typeof(int)); foreach (IItem item in KFCStore.getKFCStore().items) { table.Rows.Add(item.name, item.getQuantity()); } datagridview_Product.DataSource = table; }
private void loadDataGridView() { table.Columns.Add("Product", typeof(string)); table.Columns.Add("Quantity", typeof(int)); table.Columns.Add("Cost", typeof(double)); foreach (IItem item in KFCStore.getKFCStore().items) { table.Rows.Add(item.name, item.getQuantity(), item.getCost()); } datagridview_billing.DataSource = table; }
private void checkRadioBtn() { if (KFCStore.getKFCStore().GetDiscount() is NoDiscount) { radiobtn_NoDiscount.Checked = true; } else if (KFCStore.getKFCStore().GetDiscount() is MondayDiscount) { radiobtn_MondayDiscount.Checked = true; } else { radiobtn_MondayKidDiscount.Checked = true; } }
private void btn_printbill_Click(object sender, EventArgs e) { DateTime datetime = Convert.ToDateTime(box_datetime.Text); StreamWriter writer = new StreamWriter("Text.txt"); writer.WriteLine("Printed bill\n--------------------"); writer.WriteLine("Date: " + datetime.ToString("d") + ", Time: " + datetime.ToString("T")); writer.WriteLine("----------------------------------"); foreach (IItem item in KFCStore.getKFCStore().items) { writer.WriteLine("\t{0}\t|\t{1}\t|\t", item.name, item.getQuantity(), item.getCost()); writer.WriteLine("----------------------------------"); } writer.WriteLine("Total cost: " + label_cost.Text); writer.Close(); KFCStore.getKFCStore().reset(); this.Close(); }
private void radiobtn_MondayKidDiscount_CheckedChanged(object sender, EventArgs e) { KFCStore.getKFCStore().setDiscount(new MondayKidDiscount()); label_cost.Text = String.Format("{0:0.00}$", KFCStore.getKFCStore().getTotalCost()); }
private void removeItem(string selected_name, int selected_quantity) { datagridview_Product.Rows.Remove(datagridview_Product.SelectedRows[0]); KFCStore.getKFCStore().removeItem(selected_name, selected_quantity); }