Exemple #1
0
        //BSA Frontend code-GUI interface
        private void btnBSA_Click(object sender, EventArgs e)
        {
            int BSAErrorCode = 0;
            TextBox[] BSAinputs = {tbHeight, tbWeight };

            Validator BSAval = new Validator();

            foreach (TextBox TB in BSAinputs)					// Input Validation
            {
                int BSAstatus = BSAval.Check(1, 0, TB.Text);
                if (BSAstatus != 0)								//If error show warning, change bg colour & Skip calculation
                {
                    TB.BackColor = Color.Red;
                    BSAErrorCode = BSAstatus;
                    tbBSA.Clear();
                    goto EOF;
                }
                else TB.BackColor = Color.White;
            }
            double Weight = double.Parse(tbWeight.Text);
            double Height = double.Parse(tbHeight.Text);
            cBSA currentBSA = new cBSA();
            double ans = Math.Round(currentBSA.BSA(Height, Weight), 1);
            if ( ans > 2 )  //Validation to prevent high doses. BSA usually has a ceiling of 2.
            {
                string txtOut = "BSA is: " + ans.ToString() + "\nPlease discuss with the Consultant before using values greater than 2 in dosage calculations.\nPress OK accept a BSA value of 2 or Cancel to continue with existing value.";
                DialogResult choice = MessageBox.Show(txtOut, "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                if ( choice == DialogResult.OK )
                    ans = 2.0;
                else
                    tbBSA.BackColor = Color.Red;
            }
            tbBSA.Text = ans.ToString();
            EOF:
            BSAval.ErrorMessage(BSAErrorCode);
        }
Exemple #2
0
 // Performs the initial calculations (BSA, eGFR & Calvert)
 public void DoTheCalculations()
 {
     #region BSA
     tbBSA.BackColor = Color.White; //Resets tb bg Color.
     double Weight = (double) numWeight.Value;
     double Height = (double) numHeight.Value;
     cBSA currentBSA = new cBSA();
     double ans = Math.Round(currentBSA.BSA(Height, Weight), 1);
     if ( ans > 2 )  //Validation to prevent high doses BSA usually has a ceiling of 2.
     {
         string txtOut = "BSA is: " + ans.ToString() + "\nPlease discuss with the Consultant before using values greater than 2 in dosage calculations.\nPress OK accept a BSA value of 2 or Cancel to continue with existing value.";
         DialogResult choice = MessageBox.Show(txtOut, "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
         if ( choice == DialogResult.OK )
             ans = 2.0;
         else
             tbBSA.BackColor = Color.Red;
     }
     tbBSA.Text = ans.ToString();//            +" m^2";
     #endregion
     #region eGFR
     int age = (int) DateTime.Now.Year - dtDOB.Value.Year;
     double Mass = (double) numWeight.Value;
     double SCreat = (double) numSC.Value;
     string g;
     if ( cbGender.Text == "Male" )
         g = "M";
     else
         g = "F";
     cCCr currentCCR = new cCCr();
     double cAns = currentCCR.CCR(age, Mass, SCreat, g);
     tbGFR.Text = Math.Round(cAns, 0).ToString(); //+ " ml/min";
     #endregion
     #region Calvert
     int auc = (int) numAUC.Value;
     int gfr = (int) cAns;
     cCalvert currentCalvert = new cCalvert();
     int caAns = currentCalvert.Calvert(auc, gfr);
     tbCa.Text = caAns.ToString();
     #endregion
     DisplayDoses();
 }