コード例 #1
0
ファイル: PatientData.cs プロジェクト: Alpha1594/Drg
 // 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();
 }
コード例 #2
0
ファイル: Calculators.cs プロジェクト: Alpha1594/Drg
        //eCCR Frontend code-GUI interface
        private void btneCCR_Click(object sender, EventArgs e)
        {
            int eCCRErrorCode = 0;
            TextBox[] eCCRinputs = {tbAge, tbMass, tbSC };

            Validator eCCRval = new Validator();

            foreach (TextBox TB in eCCRinputs)
            {
                int eCCRstatus = eCCRval.Check(TB.Name == "tbAge" ? 0 : 1, 0, TB.Text);			//!!
                if (eCCRstatus != 0)
                {
                    TB.BackColor = Color.Red;
                    eCCRErrorCode = eCCRstatus;
                    tbCCr.Clear();
                    goto EOF;
                }
                else TB.BackColor = Color.White;
            }

            int age = int.Parse(tbAge.Text);
            double Mass = double.Parse(tbMass.Text);
            double SCreat = double.Parse(tbSC.Text);
            string g;
            if ( cbGender.Checked == true )
                g = "M";
            else
                g = "F";
            cCCr currentCCR = new cCCr();
            double ans = currentCCR.CCR(age, Mass, SCreat, g);
            tbCCr.Text = Math.Round(ans, 0).ToString();
            EOF:
            eCCRval.ErrorMessage(eCCRErrorCode);
        }