コード例 #1
0
ファイル: Calculators.cs プロジェクト: Alpha1594/Drg
        //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);
        }
コード例 #2
0
ファイル: Calculators.cs プロジェクト: Alpha1594/Drg
        //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);
        }
コード例 #3
0
ファイル: RegimesEditor.cs プロジェクト: Alpha1594/Drg
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool Validity = true;
            ReadRegimes();          //Populates List<Patient> with existing data
            if ( !pIsNew )
                RegimeList.RemoveAt(pIndex);

            Validator DoseVal = new Validator();

            if ( Validity )
            {
                List<Doses> TheDoses = new List<Doses>();
                if ( tbDose1.Text != "" && tbDose1.Text != "Dose" )
                {
                    int ErrCode = DoseVal.Check(1, 0, tbDose1.Text);
                    if ( ErrCode == 0 )
                    {
                        Doses d1 = new Doses(tbDrugName1.Text, float.Parse(tbDose1.Text), cbCalcMethod1.Text, cbAdmin1.Text, tbURL1.Text, D1Days);
                        TheDoses.Add(d1);
                        tbDose1.BackColor = Color.White;
                    }
                    else
                    {
                        Validity = false;
                        tbDose1.BackColor = Color.Red;
                        DoseVal.ErrorMessage(ErrCode);
                        return;
                    }
                }
                if ( tbDose2.Text != "" && tbDose2.Text != "Dose" )
                {
                    int ErrCode = DoseVal.Check(1, 0, tbDose2.Text);
                    if ( ErrCode == 0 )
                    {
                        Doses d2 = new Doses(tbDrugName2.Text, float.Parse(tbDose2.Text), cbCalcMethod2.Text, cbAdmin2.Text, tbURL2.Text, D2Days);
                        TheDoses.Add(d2);
                        tbDose2.BackColor = Color.White;
                    }
                    else
                    {
                        Validity = false;
                        tbDose2.BackColor = Color.Red;
                        DoseVal.ErrorMessage(ErrCode);
                        return;
                    }
                }

                if ( tbDose3.Text != "" && tbDose3.Text != "Dose" )
                {
                    int ErrCode = DoseVal.Check(1, 0, tbDose3.Text);
                    if ( ErrCode == 0 )
                    {
                        Doses d3 = new Doses(tbDrugName3.Text, float.Parse(tbDose3.Text), cbCalcMethod3.Text, cbAdmin3.Text, tbURL3.Text, D3Days);
                        TheDoses.Add(d3);
                        tbDose3.BackColor = Color.White;
                    }
                    else
                    {
                        Validity = false;
                        tbDose3.BackColor = Color.Red;
                        DoseVal.ErrorMessage(ErrCode);
                        return;
                    }
                }

                if ( tbDose4.Text != "" && tbDose4.Text != "Dose" )
                {
                    int ErrCode = DoseVal.Check(1, 0, tbDose4.Text);
                    if ( ErrCode == 0 )
                    {
                        Doses d4 = new Doses(tbDrugName4.Text, float.Parse(tbDose4.Text), cbCalcMethod4.Text, cbAdmin4.Text, tbURL4.Text, D4Days);
                        TheDoses.Add(d4);
                        tbDose4.BackColor = Color.White;
                    }
                    else
                    {
                        Validity = false;
                        tbDose4.BackColor = Color.Red;
                        DoseVal.ErrorMessage(ErrCode);
                        return;
                    }
                }

                if ( TheDoses.Count > 0 )
                {
                    RegimeData X = new RegimeData(tbRegName.Text, tbDesc.Lines, tbExtravasation.Text, tbComment.Lines, TheDoses, (int) numNoCycles.Value, (int) numDaysCycle.Value);//
                    XmlSerializer XSR = new XmlSerializer(typeof(List<RegimeData>));	//new instance of XML serialiser to store List PatientDataRecords
                    RegimeList.Add(X);	//Appends latest data to list
                    FileStream DataOut = new FileStream("Regimes.xml", FileMode.Create);	//Creates file object
                    XSR.Serialize(DataOut, RegimeList);   //Outputs data
                    DataOut.Close();	//Closes File
                    string MessageStr = pIsNew ? "Data Recorded" : "Data Updated";
                    MessageBox.Show(MessageStr, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Fields incomplete\nData not written", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            //else
            //    DoseVal.ErrorMessage(ErrorCode);
        }
コード例 #4
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);
        }