public void InitNameList(List <string> EventNames) { EventNameList.Clear(); GlobalNameList = EventNames; foreach (string name in EventNames) { EventNameList.AddItem(Misc.StripColonRight(name)); } ResetFields(); }
private bool RefreshNameList(int search, string keyword) { bool count = false; if (search == 0) { List <string> NameList = new List <string>(); var readerz = SqlUtils.ExecuteQueryReader("select eventid,event_name from custom_event", false); while (readerz.Read()) { NameList.Add(Convert.ToInt32(readerz["eventid"]) + ":" + readerz["event_name"].ToString()); } EventNameList.Clear(); GlobalNameList = NameList; foreach (string name in GlobalNameList) { EventNameList.AddItem(Misc.StripColonRight(name)); } } else if (search == 1 && keyword != "") { List <string> NameList = new List <string>(); var readerz = SqlUtils.ExecuteQueryReader("select eventid,event_name from custom_event where event_name like '%" + keyword + "%'", false); while (readerz.Read()) { NameList.Add(Convert.ToInt32(readerz["eventid"]) + ":" + readerz["event_name"].ToString()); } EventNameList.Clear(); GlobalNameList = NameList; foreach (string name in GlobalNameList) { EventNameList.AddItem(Misc.StripColonRight(name)); count = true; } } return(count); }
private void Searchbar_KeyUp(object sender, KeyEventArgs e) { EventNameList.Clear(); bool found = false; var pattern = new Regex(Regex.Escape(Searchbar.Text), RegexOptions.IgnoreCase); if (Searchbar.Text.Trim().Length > 0) { if (RefreshNameList(1, Searchbar.Text.Trim())) { found = true; } if (found == false) { EventNameList.Clear(); EventNameList.AddItem("No Result Found"); } } else { RefreshNameList(0, ""); } }
public ActionResult Notification(EventNameList cc) { var results = cc.NameList.ToList(); return(View(results)); }
public EventController(EventNameList cc) { _cc = cc; }