Advertisement
Guest User

Medication.cs

a guest
Jan 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace Task3
  12. {
  13.  
  14. public partial class Medication : Form
  15. {
  16. public Medication()
  17. {
  18. InitializeComponent();
  19. }
  20.  
  21. private void btnExit_Click(object sender, EventArgs e) //Exit button
  22. {
  23. Application.Exit();
  24. }
  25.  
  26. private void btnPrevious_Click(object sender, EventArgs e) //Previous button
  27. {
  28. Form Start = new ClientData();
  29. this.Hide();
  30. Start.Show();
  31. }
  32.  
  33. private void btnNextForm3_Click(object sender, EventArgs e)
  34. {
  35. Form Start = new Procedures();
  36. this.Hide();
  37. Start.Show();
  38. }
  39.  
  40. int nudAntibiotic7OldValue;
  41. int nudAntibiotic14OldValue;
  42. int nudFleeAndMiteOldValue;
  43. int nudHeartwormOldValue;
  44. int nudAnesGasto30mOldValue;
  45. int nudAnesgasafter20mOldValue;
  46. int nudFentanylOldValue;
  47. int nudFrontlineOldValue;
  48. int nudAnalgesiaOldValue;
  49. int nudBaytrillOldValue;
  50. int nudMetronidazoleOldValue;
  51. int nudRimadylOldValue;
  52. int nudDrontalSmalldogOldValue;
  53. int nudDrontalLargedogOldValue;
  54. int nudCanineRabiesOldValue;
  55.  
  56. private decimal Calculate(int count, string nudName)
  57. {
  58. decimal price;
  59. decimal result = 0;
  60.  
  61. switch (nudName)
  62. {
  63. case "nudAntibiotic":
  64. count -= nudAntibiotic7OldValue;
  65. price = 19.60m;
  66. result = price * count;
  67. break;
  68.  
  69. //...add other cases for different medicine
  70.  
  71. default:
  72. break;
  73. }
  74.  
  75. return result;
  76. }
  77.  
  78.  
  79. private void UpdownAntibiotic7_ValueChanged(object sender, EventArgs e)
  80. {
  81. if (String.IsNullOrEmpty(priceTotal.Text))
  82. priceTotal.Text = (Calculate(Convert.ToInt32(UpdownAntibiotic7.Value), UpdownAntibiotic7.Name)).ToString();
  83. else
  84. priceTotal.Text = (decimal.Parse(priceTotal.Text.Replace(' ', '0').Replace('€', '0').Replace('$', '0').Replace('£', '0')) + Calculate(Convert.ToInt32(UpdownAntibiotic7.Value), UpdownAntibiotic7.Name)).ToString("C");
  85.  
  86. nudAntibiotic7OldValue = Convert.ToInt32(UpdownAntibiotic7.Value);
  87. }
  88.  
  89. private void UpdownAntibiotic14_ValueChanged(object sender, EventArgs e)
  90. {
  91.  
  92. }
  93.  
  94. private void UpdownFleeAndMite_ValueChanged(object sender, EventArgs e)
  95. {
  96.  
  97. }
  98.  
  99. private void UpdownHeartworm_ValueChanged(object sender, EventArgs e)
  100. {
  101.  
  102. }
  103.  
  104. private void UpdownAnesGasTo30min_ValueChanged(object sender, EventArgs e)
  105. {
  106.  
  107. }
  108.  
  109. private void UpdownAnesGasAfter30min_ValueChanged(object sender, EventArgs e)
  110. {
  111.  
  112. }
  113.  
  114. private void UpdownFentanyl_ValueChanged(object sender, EventArgs e)
  115. {
  116.  
  117. }
  118.  
  119. private void UpdownFrontline_ValueChanged(object sender, EventArgs e)
  120. {
  121.  
  122. }
  123.  
  124. private void UpDownAnalgesia_ValueChanged(object sender, EventArgs e)
  125. {
  126.  
  127. }
  128.  
  129. private void UpDownBaytrill_ValueChanged(object sender, EventArgs e)
  130. {
  131.  
  132. }
  133.  
  134. private void UpDownMetronidazole_ValueChanged(object sender, EventArgs e)
  135. {
  136.  
  137. }
  138.  
  139. private void UpDownRimadyl_ValueChanged(object sender, EventArgs e)
  140. {
  141.  
  142. }
  143.  
  144. private void UpDownDrontalSmall_ValueChanged(object sender, EventArgs e)
  145. {
  146.  
  147. }
  148.  
  149. private void UpDownDrontalLarge_ValueChanged(object sender, EventArgs e)
  150. {
  151.  
  152. }
  153.  
  154. private void UpDownCanineRabies_ValueChanged(object sender, EventArgs e)
  155. {
  156.  
  157. }
  158.  
  159. private void lblTotalAmountForm2_Click(object sender, EventArgs e)
  160. {
  161.  
  162. }
  163.  
  164. private void btnCalc_Click(object sender, EventArgs e)
  165. {
  166. float amount1 = (float)UpdownAntibiotic14.Value;
  167. double cost1 = amount1 * 10;
  168. float amount2 = (float)UpdownAntibiotic7.Value; /* copy and paste */
  169. double cost2 = amount2 * 10;
  170.  
  171. double ExcTotal = cost1 + cost2; /* add cost here */
  172. priceTotal.Text = ExcTotal.ToString();
  173. }
  174.  
  175. private void Medication_Load(object sender, EventArgs e)
  176. {
  177.  
  178. }
  179. }
  180. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement