Exemple #1
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();
 }
Exemple #2
0
        //Calvert Frontend code-GUI interface
        private void btnCa_Click(object sender, EventArgs e)
        {
            int CaErrorCode = 0;
            TextBox[] eCCRinputs = { tbAUC, tbGFR };

            Validator eCalval = new Validator();

            foreach (TextBox TB in eCCRinputs)
            {
                int
                    CalStatus = eCalval.Check(0, 0, TB.Text);
                if (CalStatus != 0 )
                {
                    TB.BackColor = Color.Red;
                    CaErrorCode = CalStatus;
                    tbDose.Clear();
                    goto EOF;
                }
                else TB.BackColor = Color.White;
            }

            int auc = int.Parse(tbAUC.Text);
            int gfr = int.Parse(tbGFR.Text);
            cCalvert currentCalvert = new cCalvert();
            int ans = currentCalvert.Calvert(auc, gfr);
            tbDose.Text = ans.ToString();
            EOF:
            eCalval.ErrorMessage(CaErrorCode);
        }