private void ServiceAddmetroButton_Click(object sender, EventArgs e) { try { string serviceName = ServiceNameTextBox.Text; string servicePrice = ServicePriceTextBox.Text; if (serviceName != "" && servicePrice != "") { table.Rows.Add(ServiceNameTextBox.Text, ServicePriceTextBox.Text, quantityTextBox.Text, "Service"); SubTotal = double.Parse(SubtotalTextBox.Text); double total = double.Parse(ServicePriceTextBox.Text) * double.Parse(quantityTextBox.Text); SubTotal = SubTotal + total; SubtotalTextBox.Text = SubTotal.ToString(); ServiceNameTextBox.Text = ""; ServicePriceTextBox.Text = ""; DiscountTextbox.Text = ""; quantityTextBox.Text = "1"; ServiceIdTextBox.Clear(); GrandTotalTextBox.Clear(); } else { MessageBox.Show("Field can not be null"); } } catch (Exception ex) { MessageBox.Show("error\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void MetroButton1_Click(object sender, EventArgs e) { try { string serviceName = metroTextBoxMedicineName.Text; string servicePrice = metroTextBoxMedicineRate.Text; string serviceque = metroTextBoxMedicineQty.Text; if (serviceName != "" && servicePrice != "" && serviceque != "") { table.Rows.Add(metroTextBoxMedicineName.Text, metroTextBoxMedicineRate.Text, metroTextBoxMedicineQty.Text, "Medicine"); SubTotal = double.Parse(SubtotalTextBox.Text); double total = double.Parse(metroTextBoxMedicineRate.Text) * double.Parse(metroTextBoxMedicineQty.Text); SubTotal = SubTotal + total; SubtotalTextBox.Text = SubTotal.ToString(); metroTextBoxMedicineName.Text = ""; metroTextBoxMedicineRate.Text = ""; //quantityTextBox.Text = "1"; metroTextBoxMedicineid.Clear(); DiscountTextbox.Text = ""; GrandTotalTextBox.Clear(); } else { MessageBox.Show("Field can not be null"); } } catch (Exception ex) { MessageBox.Show("error\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void AddTestNametroButton_Click(object sender, EventArgs e) { try { string testName = TestNameTextBox.Text; string testPrice = TestPricemetroTextBox.Text; if (testName != "" && testPrice != "") { table.Rows.Add(TestNameTextBox.Text, TestPricemetroTextBox.Text, testquantityTextBox.Text, "Lab Test"); SubTotal = double.Parse(SubtotalTextBox.Text); SubTotal = SubTotal + double.Parse(TestPricemetroTextBox.Text); SubtotalTextBox.Text = SubTotal.ToString(); TestNameTextBox.Text = ""; TestPricemetroTextBox.Text = ""; DiscountTextbox.Text = ""; TestIdTextBox.Clear(); GrandTotalTextBox.Clear(); } else { MessageBox.Show("Field can not be null"); } } catch (Exception ex) { MessageBox.Show("error\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }