protected void Page_Load(object sender, EventArgs e) { System.Threading.Thread.Sleep(1000); var allData = DatabaseInterface.GetAllCompanies(); txtValueA.Text = String.Empty; for (int x = 0; x < allData.Length; x++) { if (allData[x].Approved == false) { txtValueA.Text += "<div class=\"card\">" + "<div class=\"card bg-primary text-white\">" + " <b>" + allData[x].CompanyName + "</b> " + "</div>" + "<div class=\"card-body\">" + " " + allData[x].Description + " " + "</div>" + "<div class=\"card-body\"> " + "<button onclick=\"UpdateDataBase(" + allData[x].CompanyID + ")\" >Insert Addition</button>" + //"<asp:Button runat=\"server\" OnClick=\"Unnamed_Click\" Text=\"Accept Addition: " + allData[x].CompanyName + "\" />" + " </div>" + "</div>"; } } }
public DatabaseObjectTemplate[] CompaniesFoundInPicture(string filePath) { var matches = getMatches(filePath); var allCompanies = DatabaseInterface.GetAllCompanies(); List <DatabaseObjectTemplate> output = new List <DatabaseObjectTemplate>(); for (int x = 0; x < allCompanies.Length; x++) { for (int y = 0; y < matches.Count(); y++) { if (allCompanies[x].CompanyName.Equals(matches[y])) { //if it already contains is don't add it again if (!output.Contains(allCompanies[x])) { output.Add(allCompanies[x]); } } } } return(output.ToArray()); }
private DatabaseObjectTemplate[] SortCompanies(string name) { var allCompanies = DatabaseInterface.GetAllCompanies(); if (name == null) { return(allCompanies); } name = name.Trim().ToLower(); ListClassHolder[] lists = new ListClassHolder[8]; for (int x = 0; x < lists.Length; x++) { lists[x] = new ListClassHolder(); } for (int x = 0; x < allCompanies.Length; x++) { string compName = allCompanies[x].CompanyName.ToLower(); if (compName == name) { lists[0].output.Add(allCompanies[x]); } else if (compName.Contains(name)) { lists[1].output.Add(allCompanies[x]); } else if (name.Contains(compName)) { lists[2].output.Add(allCompanies[x]); } else if (compName.Contains(name.Remove(name.Length / 2))) { lists[3].output.Add(allCompanies[x]); } else if (name.Contains(compName.Remove(compName.Length / 2))) { lists[4].output.Add(allCompanies[x]); } else if (compName.Contains(name.Remove(0, name.Length / 2))) { lists[5].output.Add(allCompanies[x]); } else if (name.Contains(compName.Remove(0, compName.Length / 2))) { lists[6].output.Add(allCompanies[x]); } else { lists[7].output.Add(allCompanies[x]); } } List <DatabaseObjectTemplate> mainOutput = new List <DatabaseObjectTemplate>(); for (int x = 0; x < lists.Length; x++) { mainOutput.AddRange(lists[x].output); } for (int x = 0; x < mainOutput.Count(); x++) { if (mainOutput[x] == null) { mainOutput.RemoveAt(x); } } return(mainOutput.ToArray()); }