diff --git a/Cicm.Database/Operations/Company.cs b/Cicm.Database/Operations/Company.cs
index fa127438..6413faf8 100644
--- a/Cicm.Database/Operations/Company.cs
+++ b/Cicm.Database/Operations/Company.cs
@@ -110,6 +110,75 @@ namespace Cicm.Database
}
}
+ ///
+ /// Gets all companies that start with the specified letter
+ ///
+ /// All companies
+ /// true if is correct, false otherwise
+ public bool GetCompanies(out List entries, char startingLetter)
+ {
+ if((startingLetter < 'a' || startingLetter > 'z') && (startingLetter < 'A' || startingLetter > 'Z'))
+ return GetCompanies(out entries);
+
+ #if DEBUG
+ Console.WriteLine("Getting all companies that start with {0}...");
+ #endif
+
+ try
+ {
+ IDbCommand dbCmd = dbCon.CreateCommand();
+ IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
+ dbCmd.CommandText = $"SELECT * from companies WHERE name LIKE {startingLetter}%";
+ DataSet dataSet = new DataSet();
+ dataAdapter.SelectCommand = dbCmd;
+ dataAdapter.Fill(dataSet);
+
+ entries = CompaniesFromDataTable(dataSet.Tables[0]);
+
+ return true;
+ }
+ catch(Exception ex)
+ {
+ Console.WriteLine("Error getting companies.");
+ Console.WriteLine(ex);
+ entries = null;
+ return false;
+ }
+ }
+
+ ///
+ /// Gets all companies from the specified country
+ ///
+ /// All companies
+ /// true if is correct, false otherwise
+ public bool GetCompanies(out List entries, int countryCode)
+ {
+ #if DEBUG
+ Console.WriteLine("Getting all companies that start with {0}...");
+ #endif
+
+ try
+ {
+ IDbCommand dbCmd = dbCon.CreateCommand();
+ IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
+ dbCmd.CommandText = $"SELECT * from companies WHERE country = '{countryCode}'";
+ DataSet dataSet = new DataSet();
+ dataAdapter.SelectCommand = dbCmd;
+ dataAdapter.Fill(dataSet);
+
+ entries = CompaniesFromDataTable(dataSet.Tables[0]);
+
+ return true;
+ }
+ catch(Exception ex)
+ {
+ Console.WriteLine("Error getting companies.");
+ Console.WriteLine(ex);
+ entries = null;
+ return false;
+ }
+ }
+
///
/// Gets company by specified id
///