protected void RadioButtonList2_SelectedIndexChanged(object sender, EventArgs e)
    {
        WizardStepType t = new WizardStepType();
        string result = string.Empty;
        //if (Convert.ToInt32(Session["item"]) <((DataTable)Session["array"]).Rows.Count)
        //{
        //    Question.Text = "Do you have " +((DataTable)Session["array"]).Rows[Convert.ToInt32(Session["item"])][1].ToString()+"?";
        //    Session["item"] = Convert.ToInt32(Session["item"])+1;
        //    RadioButtonList2.Items.Clear();
        //    RadioButtonList2.Items.Add(new ListItem("Yes"));
        //    RadioButtonList2.Items.Add(new ListItem("No"));
        //}
        if (Session["array"] != null)
        {
            if (RadioButtonList2.SelectedItem.Text == "Yes")
            {
                ((ArrayList)Session["a"]).Add("'" + ((ArrayList)Session["arraylist"])[Convert.ToInt32(Session["item"])].ToString() + "'");
                string expr = string.Empty;
                foreach (string items in ((ArrayList)Session["a"]))
                {
                    expr = expr + items + ",";

                }
                //if(expr!=string.Empty)
                // expr="Symptoms in ("+expr.Remove(expr.Length - 1)+") and";

                expr = "Symptoms in( '" + ((ArrayList)Session["arraylist"])[Convert.ToInt32(Session["item"])].ToString() + "') and";
                DataView dv;
                if (GridView1.Rows.Count > 0)
                {
                    string expr1 = string.Empty;

                    foreach (GridViewRow r in GridView1.Rows)
                    {
                        expr1 = expr1 + "'" + r.Cells[0].Text + "',";

                    }
                    expr1 = expr + " Disease in (" + expr1.Remove(expr1.Length - 1) + ")";
                    dv = new DataView(((DataTable)Session["array"]), expr1, "", DataViewRowState.CurrentRows);
                }
                else
                {
                    expr = expr.Remove(expr.Length - 3);
                    dv = new DataView(((DataTable)Session["array"]), expr, "", DataViewRowState.CurrentRows);
                }

                DataTable dt2 = dv.ToTable();

                // foreach (DataRowView drv in dv)

                //{

                //    value = (int)drv["column1"];

                //   }

                //  DataRow[] foundrows = ((DataTable)Session["array"]).Select("Symptoms like '" + ((DataTable)Session["array"]).Rows[Convert.ToInt32(Session["item"])][1].ToString() + "'");

                if (dt2.Rows.Count > 0)
                {
                    GridView1.DataSource = dt2;
                    GridView1.DataBind();
                    //   GridView1.Columns[1].Visible = false;
                    if (GridView1.Rows.Count == 1)
                    {
                        t = myWizard.WizardSteps[2].StepType;
                        if (t == WizardStepType.Complete)
                        {
                            lblName.Text = GridView1.Rows[0].Cells[0].Text;

                            Query query;
                            string queryfile = @"C:\Query.txt";
                            string datafile = @"C:\KLM11.n3";
                            string str = "PREFIX table:<http://www.owl-ontologies.com/Ontology1183162121.owl#> \n " +
                            "SELECT distinct ?med  \n " +
                            "FROM <C:/KLM11.N3> \n " +
                            " where \n" +
                           "{\n" +
                           " ?Disease table:disease ?name.\n" +
                            " ?Disease table:symptoms ?symp.\n" +
                            " ?Disease table:classification ?class.\n" +
                          " ?class table:class-name \"" + RadioButtonList1.SelectedItem.Text + "\". \n" +
                          "?name table:disease-name ?nam.\n" +
                          " Filter regex(?nam, \"" + GridView1.Rows[0].Cells[0].Text + "\",\"i\"). \n " +
                          "?name table:medication ?med.\n }";

                            TextWriter stringWriter = new StringWriter();
                            stringWriter.Write(str);

                            query = new SparqlEngine(str);
                            MemoryStore data = new MemoryStore();
                            data.Import(new N3Reader(datafile));

                            PrintQuerySink psink = new PrintQuerySink();
                            query.Run(data, psink);
                            foreach (string s in psink.al)
                                result = result + s + ",";
                            if (result != string.Empty)
                                result = result.Remove(result.Length - 1);

                            //ListBox1.DataSource = psink.al;
                            //ListBox1.DataBind();

                        }

                    }
                    // GridView1.Columns[1].Visible = false;
                }

            }

            if (t != WizardStepType.Complete)
            {

                if (Convert.ToInt32(Session["item"]) < ((ArrayList)Session["arraylist"]).Count - 1)
                {

                    Session["item"] = Convert.ToInt32(Session["item"]) + 1;
                    RadioButtonList2.Items[0].Selected = false;
                    RadioButtonList2.Items[1].Selected = false;
                    Question.Text = "Do you have " + ((ArrayList)Session["arraylist"])[Convert.ToInt32(Session["item"])].ToString() + "?";

                }
            }
            else
            {

                Response.Redirect("~/Patient/DiagResult.aspx?dis='" + GridView1.Rows[0].Cells[0].Text + "' &med='" + result + "'");

            }
        }
    }
Esempio n. 2
0
		public WizardPageChangeArgs(WizardPage page, WizardStepType step)
		{
			m_activePage	= page;
			m_stepType		= step;
		}
		static void AddWizardStep (Wizard w, string stepText, string stepID, WizardStepType type = WizardStepType.Step)
		{
			var ws = new WizardStep ();
			ws.ID = stepID;
			ws.StepType = type;
			ws.Controls.Add (new LiteralControl (stepText));

			w.WizardSteps.Add (ws);
		}
Esempio n. 4
0
 public WizardPageChangeArgs(WizardPage page, WizardStepType step)
 {
     m_activePage = page;
     m_stepType   = step;
 }