first time run code

shell: GetChildrenByGuardianID
This commit is contained in:
kougyokugentou 2021-01-12 22:24:27 -08:00
parent 76563d37f9
commit 0cf477b63d
1 changed files with 28 additions and 1 deletions

View File

@ -1,9 +1,13 @@
using System;
using Dapper;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GreatHomeChildcare.Models;
namespace GreatHomeChildcare
{
@ -21,6 +25,29 @@ namespace GreatHomeChildcare
#region misc
#endregion
/* Checks to see if this is the first time the application has run.
* by counting the number of guardians in the guardian table.
*/
internal bool isFirstTimeRun()
{
using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
{
string strQuery = "SELECT COUNT(*) FROM Guardians";
int num_guardians = cnn.Query<int>(strQuery).SingleOrDefault();
if (num_guardians > 0)
return false;
else
return true;
}
}
//TODO: implement
internal List<Child> GetChildrenByGuardianID(int guardian_id_in)
{
return null;
}
#region reports
#endregion