protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // show original concerns txt_concerns.Text = Session[cls_constants.SESSION_QNS].ToString().Trim(); // call model via flask api try { cls_results cr = this.flask_call(Session[cls_constants.SESSION_QNS].ToString()); this.txt_answer1.Text = cr.get_y_hat(); this.txt_answer2.Text = cr.get_y_hat1(); this.txt_answer3.Text = cr.get_y_hat2(); this.txt_answer4.Text = cr.get_y_hat3(); this.txt_answer5.Text = cr.get_y_hat6(); } catch (Exception err) { Console.WriteLine(err.ToString()); //string myStringVariable = "Sorry, seems we are unable to process your concern. Please rephrase or enter a new concern."; //ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + myStringVariable + "');", true); //ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", " alert('Sorry, seems we are unable to process your concern. Please rephrase or enter a new concern.'); window.open('frm_search.aspx');", true); //ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", " alert('Sorry, seems we are unable to process your concern. Please rephrase or enter a new concern.'); Response.Redirect('frm_search.aspx');", true); string message = "Sorry, seems we are unable to process your concern. You will now be redirected to rephrase or enter a new concern."; string url = "frm_search.aspx"; string script = "window.onload = function(){ alert('"; script += message; script += "');"; script += "window.location = '"; script += url; script += "'; }"; ClientScript.RegisterStartupScript(this.GetType(), "Redirect", script, true); } // do google search on hdb site this.do_google_search(txt_answer1.Text); // filter qlik by issue type HtmlControl qlik_frame = (HtmlControl)this.FindControl("qlik_frame"); qlik_frame.Attributes["src"] = "http://localhost:4848/extensions/MyMashup/MyMashup.html?classifiedOut=" + Server.HtmlEncode(txt_answer1.Text); //qlik_frame.Attributes["src"] = "http://localhost:4848/extensions/MyMashup/MyMashup.html?classifiedOut=" + Server.HtmlEncode("Credit reporting") + "&town=" + Server.HtmlEncode("ANG MO KIO"); // assign full view link of qlik LinkButton link_qlik_full_view = (LinkButton)this.FindControl("link_qlik_full_view"); string strURL = qlik_frame.Attributes["src"].ToString(); link_qlik_full_view.Attributes.Add("onClick", "javascript:window.open('" + strURL + "');return false;"); } }
private cls_results clean_result_new(string result) { // replace result = result.Replace("{", ""); result = result.Replace("}", ""); result = result.Replace("\"", ""); result = result.Replace(",", ""); // split by : string[] result_array = result.Split(':'); // define class cls_results cr = new cls_results(); // loop and store to class for (int x = 0; x <= result_array.Length - 1; x++) { // remove 'yhat' string string yhat_removed = result_array[x].Substring(0, result_array[x].Length - 6).Trim(); //System.Diagnostics.Debug.WriteLine(yhat_removed); if (x == 2) { cr.set_y_hat(yhat_removed); } else if (x == 3) { cr.set_y_hat1(yhat_removed); } else if (x == 4) { cr.set_y_hat2(yhat_removed); } else if (x == 5) { cr.set_y_hat3(yhat_removed); } else if (x == 6) { cr.set_y_hat4(yhat_removed); } else if (x == 7) { cr.set_y_hat5(yhat_removed); } else if (x == 8) { cr.set_y_hat6(this.ReplaceNewlines(result_array[x], Environment.NewLine)); } } System.Diagnostics.Debug.WriteLine(cr.get_y_hat()); System.Diagnostics.Debug.WriteLine(cr.get_y_hat1()); System.Diagnostics.Debug.WriteLine(cr.get_y_hat2()); System.Diagnostics.Debug.WriteLine(cr.get_y_hat3()); System.Diagnostics.Debug.WriteLine(cr.get_y_hat4()); System.Diagnostics.Debug.WriteLine(cr.get_y_hat5()); System.Diagnostics.Debug.WriteLine(cr.get_y_hat6()); return(cr); }