public static string SearchUsers(string str) { string result = string.Empty; GUIHandler tempGUIHandler = new GUIHandler(); List<Accountdetails> users = tempGUIHandler.GetAll(); foreach (Accountdetails user in users) { if (user.Name.ToLower().Contains(str.ToLower())) { result += user.Name + "," + user.ID + ":"; } } if (result.Length > 0) { result = result.Substring(0, result.Length - 1); } return result; }
protected void Page_Load(object sender, EventArgs e) { //if (!IsPostBack) //{ // Check if GUIHandler exists if (Session["GUIHandler_obj"] == null) { // Go back if no GUIhandler can be found Response.Redirect("inloggen.aspx", false); return; } // Retrieve GUIHandler object from session GUIHandler = (GUIHandler)Session["GUIHandler_obj"]; Accountdetails mainuser = GUIHandler.GetMainuserInfo(); // Set username username.InnerText = mainuser.Name; // TODO: add description to account and database // Insert all questions List<Questiondetails> questions = GUIHandler.GetAll(true); foreach (Questiondetails qd in questions) { HtmlGenericControl li = new HtmlGenericControl("li"); vragen_list.Controls.Add(li); HtmlGenericControl a1 = new HtmlGenericControl("a"); a1.Attributes.Add("href", "#"); a1.InnerText = qd.Title; li.Controls.Add(a1); } // Insert message if questions count == 0 if (questions.Count == 0) { HtmlGenericControl li = new HtmlGenericControl("li"); vragen_list.Controls.Add(li); HtmlGenericControl a = new HtmlGenericControl("a"); a.Attributes.Add("href", "#"); a.InnerText = "Geen vragen geplaatst! Klik hier om een vraag te plaatsen"; li.Controls.Add(a); } // Insert all reviews List<Reviewdetails> reviews = GUIHandler.GetAllReviews(mainuser.ID, true); foreach (Reviewdetails rd in reviews) { HtmlGenericControl li = new HtmlGenericControl("li"); reviews_list.Controls.Add(li); HtmlGenericControl a1 = new HtmlGenericControl("a"); a1.Attributes.Add("href", "#"); a1.InnerText = rd.Rating.ToString(); li.Controls.Add(a1); } // Insert message if reviews count == 0 if (reviews.Count == 0) { HtmlGenericControl li = new HtmlGenericControl("li"); reviews_list.Controls.Add(li); HtmlGenericControl a = new HtmlGenericControl("a"); a.Attributes.Add("href", "#"); a.InnerText = "Geen reviews geplaatst! Klik hier om een review te plaatsen"; li.Controls.Add(a); } //} }