This commit is contained in:
kougyoku 2019-10-15 13:04:22 -07:00
parent 7116e25a81
commit 93a6e6a691

View File

@ -32,7 +32,10 @@ namespace QueueSys
{
public int id { get; }
public string customer_name { get; set; }
public int status { get; set; }
}
public class StatusModel
{
public string status { get; set; }
}
public class SqliteDataAccess
@ -43,13 +46,25 @@ namespace QueueSys
//database will be closed, even in event of an application or computer crash.
using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
{
string strQuery = "SELECT id,customer_name,status_lookup.status as Status FROM active_customers INNER JOIN status_lookup on active_customers.status_id=status_lookup.status_id;";
string strQuery = "SELECT id,customer_name FROM active_customers;";
var output = cnn.Query<EmployeeView>(strQuery, new DynamicParameters());
return output.ToList();
}
}
public List<StatusModel> GetCxStatus(int customer_id)
{
using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
{
string strQuery = "SELECT status_lookup.status FROM active_customers INNER JOIN status_lookup on active_customers.status_id=status_lookup.status_id WHERE id=@id;";
var output = cnn.Query<StatusModel>(strQuery, new { id = customer_id });
return output.ToList();
}
}
public List<CustomerView> LoadCustomerView()
{
using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
@ -82,6 +97,17 @@ namespace QueueSys
}
}
public List<StatusModel> LoadStatusStrings()
{
using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
{
string strQuery = "SELECT status FROM status_lookup";
var output = cnn.Query<StatusModel>(strQuery, new DynamicParameters());
return output.ToList();
}
}
private static string LoadConnectionString(string id="Default")
{
return ConfigurationManager.ConnectionStrings[id].ConnectionString;