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
- {
- int nudAntibiotic7OldValue;
- int nudAntibiotic14OldValue;
- int nudFleeAndMiteOldValue;
- int nudHeartwormOldValue;
- int nudAnesGasto30mOldValue;
- int nudAnesgasafter30mOldValue;
- int nudFentanylOldValue;
- int nudFrontlineOldValue;
- int nudAnalgesiaOldValue;
- int nudBaytrillOldValue;
- int nudMetronidazoleOldValue;
- int nudRimadylOldValue;
- int nudDrontalSmalldogOldValue;
- int nudDrontalLargedogOldValue;
- int nudCanineRabiesOldValue;
- public Medication()
- {
- InitializeComponent();
- }
- public static string PriceMedication = "";
- 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();
- PriceMedication = priceTotal.Text;
- }
- private decimal Calculate(int count, string nudName)
- {
- decimal price;
- decimal result = 0;
- switch (nudName)
- {
- case "UpdownAntibiotic7":
- count -= nudAntibiotic7OldValue;
- price = 19.60m;
- result = price * count;
- break;
- case "UpdownAntibiotic14":
- count -= nudAntibiotic14OldValue;
- price = 25.20m;
- result = price * count;
- break;
- case "UpdownFleeAndMite":
- count -= nudAntibiotic14OldValue;
- price = 6.75m;
- result = price * count;
- break;
- case "UpdownHeartworm":
- count -= nudHeartwormOldValue;
- price = 12.05m;
- result = price * count;
- break;
- case "UpdownAnesGasTo30min":
- count -= nudAnesGasto30mOldValue;
- price = 15.97m;
- result = price * count;
- break;
- case "UpdownAnesGasAfter30min":
- count -= nudAnesgasafter30mOldValue;
- price = 25.97m;
- result = price * count;
- break;
- case "UpdownFentanyl":
- count -= nudFentanylOldValue;
- price = 3.20m;
- result = price * count;
- break;
- case "UpdownFrontline":
- count -= nudAntibiotic14OldValue;
- price = 9.99m;
- result = price * count;
- break;
- case "UpDownAnalgesia":
- count -= nudAnalgesiaOldValue;
- price = 14.12m;
- result = price * count;
- break;
- case "UpDownBaytrill":
- count -= nudBaytrillOldValue;
- price = 5.00m;
- result = price * count;
- break;
- case "UpDownMetronidazole":
- count -= nudMetronidazoleOldValue;
- price = 3.88m;
- result = price * count;
- break;
- case "UpDownRimadyl":
- count -= nudRimadylOldValue;
- price = 7.60m;
- result = price * count;
- break;
- case "UpDownDrontalSmall":
- count -= nudDrontalSmalldogOldValue;
- price = 5.00m;
- result = price * count;
- break;
- case "UpDownDrontalLarge":
- count -= nudDrontalLargedogOldValue;
- price = 7.00m;
- result = price * count;
- break;
- case "UpDownCanineRabies":
- count -= nudCanineRabiesOldValue;
- price = 345m;
- 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')) + Calculate(Convert.ToInt32(UpdownAntibiotic7.Value), UpdownAntibiotic7.Name)).ToString("C");
- nudAntibiotic7OldValue = Convert.ToInt32(UpdownAntibiotic7.Value);
- }
- private void UpdownAntibiotic14_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(priceTotal.Text))
- priceTotal.Text = (Calculate(Convert.ToInt32(UpdownAntibiotic14.Value), UpdownAntibiotic14.Name)).ToString();
- else
- priceTotal.Text = (decimal.Parse(priceTotal.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpdownAntibiotic14.Value), UpdownAntibiotic14.Name)).ToString("C");
- nudAntibiotic14OldValue = Convert.ToInt32(UpdownAntibiotic14.Value);
- }
- private void UpdownFleeAndMite_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(priceTotal.Text))
- priceTotal.Text = (Calculate(Convert.ToInt32(UpdownFleeAndMite.Value), UpdownFleeAndMite.Name)).ToString();
- else
- priceTotal.Text = (decimal.Parse(priceTotal.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpdownFleeAndMite.Value), UpdownFleeAndMite.Name)).ToString("C");
- nudFleeAndMiteOldValue = Convert.ToInt32(UpdownFleeAndMite.Value);
- }
- private void UpdownHeartworm_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(priceTotal.Text))
- priceTotal.Text = (Calculate(Convert.ToInt32(UpdownHeartworm.Value), UpdownHeartworm.Name)).ToString();
- else
- priceTotal.Text = (decimal.Parse(priceTotal.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpdownHeartworm.Value), UpdownHeartworm.Name)).ToString("C");
- nudHeartwormOldValue = Convert.ToInt32(UpdownHeartworm.Value);
- }
- private void UpdownAnesGasTo30min_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(priceTotal.Text))
- priceTotal.Text = (Calculate(Convert.ToInt32(UpdownAnesGasTo30min.Value), UpdownAnesGasTo30min.Name)).ToString();
- else
- priceTotal.Text = (decimal.Parse(priceTotal.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpdownAnesGasTo30min.Value), UpdownAnesGasTo30min.Name)).ToString("C");
- nudAnesGasto30mOldValue = Convert.ToInt32(UpdownAnesGasTo30min.Value);
- }
- private void UpdownAnesGasAfter30min_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(priceTotal.Text))
- priceTotal.Text = (Calculate(Convert.ToInt32(UpdownAnesGasAfter30min.Value), UpdownAnesGasAfter30min.Name)).ToString();
- else
- priceTotal.Text = (decimal.Parse(priceTotal.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpdownAnesGasAfter30min.Value), UpdownAnesGasAfter30min.Name)).ToString("C");
- nudAnesgasafter30mOldValue = Convert.ToInt32(UpdownAnesGasAfter30min.Value);
- }
- private void UpdownFentanyl_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(priceTotal.Text))
- priceTotal.Text = (Calculate(Convert.ToInt32(UpdownFentanyl.Value), UpdownFentanyl.Name)).ToString();
- else
- priceTotal.Text = (decimal.Parse(priceTotal.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpdownFentanyl.Value), UpdownFentanyl.Name)).ToString("C");
- nudFentanylOldValue = Convert.ToInt32(UpdownFentanyl.Value);
- }
- private void UpdownFrontline_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(priceTotal.Text))
- priceTotal.Text = (Calculate(Convert.ToInt32(UpdownFrontline.Value), UpdownFrontline.Name)).ToString();
- else
- priceTotal.Text = (decimal.Parse(priceTotal.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpdownFrontline.Value), UpdownFrontline.Name)).ToString("C");
- nudFrontlineOldValue = Convert.ToInt32(UpdownFrontline.Value);
- }
- private void UpDownAnalgesia_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(priceTotal.Text))
- priceTotal.Text = (Calculate(Convert.ToInt32(UpDownAnalgesia.Value), UpDownAnalgesia.Name)).ToString();
- else
- priceTotal.Text = (decimal.Parse(priceTotal.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpDownAnalgesia.Value), UpDownAnalgesia.Name)).ToString("C");
- nudAnalgesiaOldValue = Convert.ToInt32(UpDownAnalgesia.Value);
- }
- private void UpDownBaytrill_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(priceTotal.Text))
- priceTotal.Text = (Calculate(Convert.ToInt32(UpDownBaytrill.Value), UpDownBaytrill.Name)).ToString();
- else
- priceTotal.Text = (decimal.Parse(priceTotal.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpDownBaytrill.Value), UpDownBaytrill.Name)).ToString("C");
- nudBaytrillOldValue = Convert.ToInt32(UpDownBaytrill.Value);
- }
- private void UpDownMetronidazole_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(priceTotal.Text))
- priceTotal.Text = (Calculate(Convert.ToInt32(UpDownMetronidazole.Value), UpDownMetronidazole.Name)).ToString();
- else
- priceTotal.Text = (decimal.Parse(priceTotal.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpDownMetronidazole.Value), UpDownMetronidazole.Name)).ToString("C");
- nudMetronidazoleOldValue = Convert.ToInt32(UpDownMetronidazole.Value);
- }
- private void UpDownRimadyl_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(priceTotal.Text))
- priceTotal.Text = (Calculate(Convert.ToInt32(UpDownRimadyl.Value), UpDownRimadyl.Name)).ToString();
- else
- priceTotal.Text = (decimal.Parse(priceTotal.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpDownRimadyl.Value), UpDownRimadyl.Name)).ToString("C");
- nudRimadylOldValue = Convert.ToInt32(UpDownRimadyl.Value);
- }
- private void UpDownDrontalSmall_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(priceTotal.Text))
- priceTotal.Text = (Calculate(Convert.ToInt32(UpDownDrontalSmall.Value), UpDownDrontalSmall.Name)).ToString();
- else
- priceTotal.Text = (decimal.Parse(priceTotal.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpDownDrontalSmall.Value), UpDownDrontalSmall.Name)).ToString("C");
- nudDrontalSmalldogOldValue = Convert.ToInt32(UpDownDrontalSmall.Value);
- }
- private void UpDownDrontalLarge_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(priceTotal.Text))
- priceTotal.Text = (Calculate(Convert.ToInt32(UpDownDrontalLarge.Value), UpDownDrontalLarge.Name)).ToString();
- else
- priceTotal.Text = (decimal.Parse(priceTotal.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpDownDrontalLarge.Value), UpDownDrontalLarge.Name)).ToString("C");
- nudDrontalLargedogOldValue = Convert.ToInt32(UpDownDrontalLarge.Value);
- }
- private void UpDownCanineRabies_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(priceTotal.Text))
- priceTotal.Text = (Calculate(Convert.ToInt32(UpDownCanineRabies.Value), UpDownCanineRabies.Name)).ToString();
- else
- priceTotal.Text = (decimal.Parse(priceTotal.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpDownCanineRabies.Value), UpDownCanineRabies.Name)).ToString("C");
- nudCanineRabiesOldValue = Convert.ToInt32(UpDownCanineRabies.Value);
- }
- private void lblTotalAmountForm2_Click(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')) + Calculate(Convert.ToInt32(UpdownAntibiotic7.Value), UpdownAntibiotic7.Name)).ToString("C");
- nudAntibiotic7OldValue = Convert.ToInt32(UpdownAntibiotic7.Value);
- }
- private void Medication_Load(object sender, EventArgs e)
- {
- }
- }
- }
- 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 Procedures : Form
- {
- int nudEarsCleanAndFlushOldValue;
- int nudLuxationOldValue;
- int nudSlingOldValue;
- int nudWoundSoreOldValue;
- int nudLacerationsOldValue;
- int nudBloodPressureOldValue;
- int nudECGOldValue;
- int nudTeethExtractionOldValue;
- int nudCatheterOldValue;
- int nudBiopsyOldValue;
- int nudRadiographOldValue;
- int nudPotassiumOldValue;
- int nudIVOldValue;
- public static string ProceduresTotal = "";
- public Procedures()
- {
- InitializeComponent();
- }
- private void btnPrevious_Click(object sender, EventArgs e)
- //Previous button
- {
- Form Start = new Medication();
- this.Hide();
- Start.Show();
- }
- private void btnExit_Click(object sender, EventArgs e)
- {
- Application.Exit();
- }
- private void btnNextForm4_Click(object sender, EventArgs e)
- {
- Form finish = new Receipt();
- this.Hide();
- finish.Show();
- ProceduresTotal = price.Text;
- }
- private decimal Calculate(int count, string nudName)
- {
- decimal price;
- decimal result = 0;
- switch (nudName)
- {
- case "UpdownEarsCleanAndFlush":
- count -= nudEarsCleanAndFlushOldValue;
- price = 8.00m;
- result = price * count;
- break;
- case "UpdownLuxation":
- count -= nudLuxationOldValue;
- price = 48.67m;
- result = price * count;
- break;
- case "UpdownSling":
- count -= nudSlingOldValue;
- price = 1.20m;
- result = price * count;
- break;
- case "UpdownWoundsore":
- count -= nudWoundSoreOldValue;
- price = 2.99m;
- result = price * count;
- break;
- case "UpdownLacerations":
- count -= nudLacerationsOldValue;
- price = 98.00m;
- result = price * count;
- break;
- case "UpDownBloodPressure":
- count -= nudBloodPressureOldValue;
- price = 0.95m;
- result = price * count;
- break;
- case "UpDownECG":
- count -= nudECGOldValue;
- price = 133.45m;
- result = price * count;
- break;
- case "UpDownTeethExtraction":
- count -= nudTeethExtractionOldValue;
- price = 96.55m;
- result = price * count;
- break;
- case "UpDownCatheter":
- count -= nudCatheterOldValue;
- price = 35.00m;
- result = price * count;
- break;
- case "UpDownBiopsy":
- count -= nudBiopsyOldValue;
- price = 389.00m;
- result = price * count;
- break;
- case "UpDownRadiograph":
- count -= nudRadiographOldValue;
- price = 10.29m;
- result = price * count;
- break;
- case "UpDownPotassium":
- count -= nudPotassiumOldValue;
- price = 0.45m;
- result = price * count;
- break;
- case "UpDownIV":
- count -= nudIVOldValue;
- price = 3.90m;
- result = price * count;
- break;
- //...add other cases for different medicine
- default:
- break;
- }
- return result;
- }
- private void UpdownEarsCleanAndFlush_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(price.Text))
- price.Text = (Calculate(Convert.ToInt32(UpdownEarsCleanAndFlush.Value), UpdownEarsCleanAndFlush.Name)).ToString();
- else
- price.Text = (decimal.Parse(price.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpdownEarsCleanAndFlush.Value), UpdownEarsCleanAndFlush.Name)).ToString("C");
- nudEarsCleanAndFlushOldValue = Convert.ToInt32(UpdownEarsCleanAndFlush.Value);
- }
- private void UpdownLuxation_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(price.Text))
- price.Text = (Calculate(Convert.ToInt32(UpdownLuxation.Value), UpdownLuxation.Name)).ToString();
- else
- price.Text = (decimal.Parse(price.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpdownLuxation.Value), UpdownLuxation.Name)).ToString("C");
- nudLuxationOldValue = Convert.ToInt32(UpdownLuxation.Value);
- }
- private void UpdownSling_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(price.Text))
- price.Text = (Calculate(Convert.ToInt32(UpdownSling.Value), UpdownSling.Name)).ToString();
- else
- price.Text = (decimal.Parse(price.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpdownSling.Value), UpdownSling.Name)).ToString("C");
- nudSlingOldValue = Convert.ToInt32(UpdownSling.Value);
- }
- private void UpdownWoundsore_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(price.Text))
- price.Text = (Calculate(Convert.ToInt32(UpdownWoundsore.Value), UpdownWoundsore.Name)).ToString();
- else
- price.Text = (decimal.Parse(price.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpdownWoundsore.Value), UpdownWoundsore.Name)).ToString("C");
- nudWoundSoreOldValue = Convert.ToInt32(UpdownWoundsore.Value);
- }
- private void UpdownLacerations_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(price.Text))
- price.Text = (Calculate(Convert.ToInt32(UpdownLacerations.Value), UpdownLacerations.Name)).ToString();
- else
- price.Text = (decimal.Parse(price.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpdownLacerations.Value), UpdownLacerations.Name)).ToString("C");
- nudLacerationsOldValue = Convert.ToInt32(UpdownLacerations.Value);
- }
- private void UpDownBloodPressure_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(price.Text))
- price.Text = (Calculate(Convert.ToInt32(UpDownBloodPressure.Value), UpDownBloodPressure.Name)).ToString();
- else
- price.Text = (decimal.Parse(price.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpDownBloodPressure.Value), UpDownBloodPressure.Name)).ToString("C");
- nudBloodPressureOldValue = Convert.ToInt32(UpDownBloodPressure.Value);
- }
- private void UpDownECG_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(price.Text))
- price.Text = (Calculate(Convert.ToInt32(UpDownECG.Value), UpDownECG.Name)).ToString();
- else
- price.Text = (decimal.Parse(price.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpDownECG.Value), UpDownECG.Name)).ToString("C");
- nudECGOldValue = Convert.ToInt32(UpDownECG.Value);
- }
- private void UpDownTeethExtraction_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(price.Text))
- price.Text = (Calculate(Convert.ToInt32(UpDownTeethExtraction.Value), UpDownTeethExtraction.Name)).ToString();
- else
- price.Text = (decimal.Parse(price.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpDownTeethExtraction.Value), UpDownTeethExtraction.Name)).ToString("C");
- nudTeethExtractionOldValue = Convert.ToInt32(UpDownTeethExtraction.Value);
- }
- private void UpDownCatheter_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(price.Text))
- price.Text = (Calculate(Convert.ToInt32(UpDownCatheter.Value), UpDownCatheter.Name)).ToString();
- else
- price.Text = (decimal.Parse(price.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpDownCatheter.Value), UpDownCatheter.Name)).ToString("C");
- nudCatheterOldValue = Convert.ToInt32(UpDownCatheter.Value);
- }
- private void UpDownBiopsy_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(price.Text))
- price.Text = (Calculate(Convert.ToInt32(UpDownBiopsy.Value), UpDownBiopsy.Name)).ToString();
- else
- price.Text = (decimal.Parse(price.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpDownBiopsy.Value), UpDownBiopsy.Name)).ToString("C");
- nudBiopsyOldValue = Convert.ToInt32(UpDownBiopsy.Value);
- }
- private void UpDownRadiograph_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(price.Text))
- price.Text = (Calculate(Convert.ToInt32(UpDownRadiograph.Value), UpDownRadiograph.Name)).ToString();
- else
- price.Text = (decimal.Parse(price.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpDownRadiograph.Value), UpDownRadiograph.Name)).ToString("C");
- nudRadiographOldValue = Convert.ToInt32(UpDownRadiograph.Value);
- }
- private void UpDownIV_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(price.Text))
- price.Text = (Calculate(Convert.ToInt32(UpDownIV.Value), UpDownIV.Name)).ToString();
- else
- price.Text = (decimal.Parse(price.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpDownIV.Value), UpDownIV.Name)).ToString("C");
- nudIVOldValue = Convert.ToInt32(UpDownIV.Value);
- }
- private void UpDownPotassium_ValueChanged(object sender, EventArgs e)
- {
- if (String.IsNullOrEmpty(price.Text))
- price.Text = (Calculate(Convert.ToInt32(UpDownPotassium.Value), UpDownPotassium.Name)).ToString();
- else
- price.Text = (decimal.Parse(price.Text.Replace('£', '0')) + Calculate(Convert.ToInt32(UpDownPotassium.Value), UpDownPotassium.Name)).ToString("C");
- nudPotassiumOldValue = Convert.ToInt32(UpDownPotassium.Value);
- }
- private void Procedures_Load(object sender, EventArgs e)
- {
- }
- }
- }
Add Comment
Please, Sign In to add comment