Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 Task3
- {
- public partial class Medication : Form
- {
- public Medication()
- {
- InitializeComponent();
- }
- private void btnExit_Click(object sender, EventArgs e) //Exit button
- {
- Application.Exit();
- }
- private void btnPrevious_Click(object sender, EventArgs e) //Previous button
- {
- Form Start = new ClientData();
- this.Hide();
- Start.Show();
- }
- private void btnNextForm3_Click(object sender, EventArgs e)
- {
- Form Start = new Procedures();
- this.Hide();
- Start.Show();
- }
- int nudAntibiotic7OldValue;
- int nudAntibiotic14OldValue;
- int nudFleeAndMiteOldValue;
- int nudHeartwormOldValue;
- int nudAnesGasto30mOldValue;
- int nudAnesgasafter20mOldValue;
- int nudFentanylOldValue;
- int nudFrontlineOldValue;
- int nudAnalgesiaOldValue;
- int nudBaytrillOldValue;
- int nudMetronidazoleOldValue;
- int nudRimadylOldValue;
- int nudDrontalSmalldogOldValue;
- int nudDrontalLargedogOldValue;
- int nudCanineRabiesOldValue;
- private decimal Calculate(int count, string nudName)
- {
- decimal price;
- decimal result = 0;
- switch (nudName)
- {
- case "nudAntibiotic":
- count -= nudAntibiotic7OldValue;
- price = 19.60m;
- result = price * count;
- break;
- //...add other cases for different medicine
- default:
- break;
- }
- return result;
- }
- private void UpdownAntibiotic7_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(priceTotal.Text))
- priceTotal.Text = (Calculate(Convert.ToInt32(UpdownAntibiotic7.Value), UpdownAntibiotic7.Name)).ToString();
- else
- priceTotal.Text = (decimal.Parse(priceTotal.Text.Replace(' ', '0').Replace('€', '0').Replace('$', '0').Replace('£', '0')) + Calculate(Convert.ToInt32(UpdownAntibiotic7.Value), UpdownAntibiotic7.Name)).ToString("C");
- nudAntibiotic7OldValue = Convert.ToInt32(UpdownAntibiotic7.Value);
- }
- private void UpdownAntibiotic14_ValueChanged(object sender, EventArgs e)
- {
- }
- private void UpdownFleeAndMite_ValueChanged(object sender, EventArgs e)
- {
- }
- private void UpdownHeartworm_ValueChanged(object sender, EventArgs e)
- {
- }
- private void UpdownAnesGasTo30min_ValueChanged(object sender, EventArgs e)
- {
- }
- private void UpdownAnesGasAfter30min_ValueChanged(object sender, EventArgs e)
- {
- }
- private void UpdownFentanyl_ValueChanged(object sender, EventArgs e)
- {
- }
- private void UpdownFrontline_ValueChanged(object sender, EventArgs e)
- {
- }
- private void UpDownAnalgesia_ValueChanged(object sender, EventArgs e)
- {
- }
- private void UpDownBaytrill_ValueChanged(object sender, EventArgs e)
- {
- }
- private void UpDownMetronidazole_ValueChanged(object sender, EventArgs e)
- {
- }
- private void UpDownRimadyl_ValueChanged(object sender, EventArgs e)
- {
- }
- private void UpDownDrontalSmall_ValueChanged(object sender, EventArgs e)
- {
- }
- private void UpDownDrontalLarge_ValueChanged(object sender, EventArgs e)
- {
- }
- private void UpDownCanineRabies_ValueChanged(object sender, EventArgs e)
- {
- }
- private void lblTotalAmountForm2_Click(object sender, EventArgs e)
- {
- }
- private void btnCalc_Click(object sender, EventArgs e)
- {
- float amount1 = (float)UpdownAntibiotic14.Value;
- double cost1 = amount1 * 10;
- float amount2 = (float)UpdownAntibiotic7.Value; /* copy and paste */
- double cost2 = amount2 * 10;
- double ExcTotal = cost1 + cost2; /* add cost here */
- priceTotal.Text = ExcTotal.ToString();
- }
- private void Medication_Load(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement