コード例 #1
0
        protected void BtnDiagnosisPatient_Click(object sender, EventArgs e)
        {
            FormViewDiagnosis.Visible   = true;
            DetailsViewAcctInfo.Visible = false;
            SqlConnection con = new SqlConnection(ConnectionString());

            con.Open();
            SqlCommand     cmd = new SqlCommand("Select * from Patient where PatientName = '" + Session["Logged"] + "'", con);
            SqlDataAdapter da  = new SqlDataAdapter(cmd);
            DataSet        ds  = new DataSet();

            da.Fill(ds);
            FormViewDiagnosis.DataSource = ds;
            FormViewDiagnosis.DataBind();
        }
コード例 #2
0
        protected void BtnSymptom_Click(object sender, EventArgs e)
        {
            Diagnosis getDiagnosis        = new Diagnosis();
            TextBox   symptomPatient      = (TextBox)FormViewDiagnosis.FindControl("TxtSymtom");
            Label     diagnosisPatientLbl = (Label)FormViewDiagnosis.FindControl("LblDiagnosis");

            string[] patientSymptom = new string[10];
            int      match          = 0;

            //List<string> getsymptoms = new List<string>();

            if (!string.IsNullOrEmpty(symptomPatient.Text))
            {
                patientSymptom = symptomPatient.Text.Split(' ');
            }
            else
            {
                Response.Write("Please write some symptoms");
            }

            foreach (DictionaryEntry symptom in getDiagnosis.DiagnosisList())
            {
                IEnumerable <string> symptomvalues = (IEnumerable <string>)symptom.Value;
                foreach (string symptomValue in symptomvalues)
                {
                    foreach (string patSymptomInput in patientSymptom)
                    {
                        if (patSymptomInput == symptomValue)
                        {
                            match += 1;
                        }
                    }
                }
                if (match > 3)
                {
                    diagnosisPatientLbl.Text = symptom.Key.ToString();
                    symptomPatient.Text      = "";
                }
                else
                {
                    diagnosisPatientLbl.Text = "Sorry, We can not find the diagnosis";
                    symptomPatient.Text      = "";
                }
            }
        }