diff --git a/QueueSys/QueueSys.csproj b/QueueSys/QueueSys.csproj index da719c6..713910b 100644 --- a/QueueSys/QueueSys.csproj +++ b/QueueSys/QueueSys.csproj @@ -39,6 +39,7 @@ ..\packages\Dapper.2.0.30\lib\net461\Dapper.dll + ..\packages\System.Data.SQLite.Core.1.0.111.0\lib\net46\System.Data.SQLite.dll @@ -74,6 +75,7 @@ + frmCustomerView.cs diff --git a/QueueSys/QueueSys.db b/QueueSys/QueueSys.db index e1c7944..8c26d3d 100644 Binary files a/QueueSys/QueueSys.db and b/QueueSys/QueueSys.db differ diff --git a/QueueSys/SqliteDataAccess.cs b/QueueSys/SqliteDataAccess.cs new file mode 100644 index 0000000..352eb30 --- /dev/null +++ b/QueueSys/SqliteDataAccess.cs @@ -0,0 +1,65 @@ +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; + +namespace QueueSys +{ + public class customerView + { + public string customerName { get; } + public string status { get; } + public string timeElapsed { get; } + } + + public class employeeView + { + public int id { get; } + public string customer_name { get; set; } + public int num_bags { get; set; } + public string employee { get; set; } + public string status { get; set; } + } + + public class SqliteDataAccess + { + public static List loadEmployeeView() + { + string strQuery = "SELECT id,customer_name,num_bags,employee,status FROM active_customers;"; + + //A using statement protects us as a failsafe: it guarantees the connection to the + //database will be closed, even in event of an application or computer crash. + using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) + { + var output = cnn.Query(strQuery, new DynamicParameters()); + return output.ToList(); + } + } + + public static List loadCustomerView() + { + string strQuery = "SELECT customer_name,status FROM active_customers;"; + + using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) + { + var output = cnn.Query(strQuery, new DynamicParameters()); + return output.ToList(); + } + } + + public static void saveCustomer(employeeView customer) + { + + } + + private static string LoadConnectionString(string id="Default") + { + return ConfigurationManager.ConnectionStrings[id].ConnectionString; + } + } +} diff --git a/QueueSys/frmEmployeeView.Designer.cs b/QueueSys/frmEmployeeView.Designer.cs index e0fc02e..22a33a8 100644 --- a/QueueSys/frmEmployeeView.Designer.cs +++ b/QueueSys/frmEmployeeView.Designer.cs @@ -36,9 +36,9 @@ this.btnAdd = new System.Windows.Forms.Button(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.generateReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitAltF4ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.generateReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tbEmployeeName = new System.Windows.Forms.TextBox(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); @@ -107,6 +107,7 @@ this.btnAdd.TabIndex = 4; this.btnAdd.Text = "Add"; this.btnAdd.UseVisualStyleBackColor = true; + this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click); // // menuStrip1 // @@ -130,27 +131,27 @@ this.fileToolStripMenuItem.Size = new System.Drawing.Size(54, 29); this.fileToolStripMenuItem.Text = "&File"; // + // generateReportToolStripMenuItem + // + this.generateReportToolStripMenuItem.Name = "generateReportToolStripMenuItem"; + this.generateReportToolStripMenuItem.Size = new System.Drawing.Size(242, 34); + this.generateReportToolStripMenuItem.Text = "&Generate Report"; + this.generateReportToolStripMenuItem.Click += new System.EventHandler(this.generateReportToolStripMenuItem_Click); + // // optionsToolStripMenuItem // this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; - this.optionsToolStripMenuItem.Size = new System.Drawing.Size(270, 34); + this.optionsToolStripMenuItem.Size = new System.Drawing.Size(242, 34); this.optionsToolStripMenuItem.Text = "Options"; this.optionsToolStripMenuItem.Click += new System.EventHandler(this.optionsToolStripMenuItem_Click); // // exitAltF4ToolStripMenuItem // this.exitAltF4ToolStripMenuItem.Name = "exitAltF4ToolStripMenuItem"; - this.exitAltF4ToolStripMenuItem.Size = new System.Drawing.Size(270, 34); + this.exitAltF4ToolStripMenuItem.Size = new System.Drawing.Size(242, 34); this.exitAltF4ToolStripMenuItem.Text = "E&xit (Alt-F4)"; this.exitAltF4ToolStripMenuItem.Click += new System.EventHandler(this.exitAltF4ToolStripMenuItem_Click); // - // generateReportToolStripMenuItem - // - this.generateReportToolStripMenuItem.Name = "generateReportToolStripMenuItem"; - this.generateReportToolStripMenuItem.Size = new System.Drawing.Size(270, 34); - this.generateReportToolStripMenuItem.Text = "&Generate Report"; - this.generateReportToolStripMenuItem.Click += new System.EventHandler(this.generateReportToolStripMenuItem_Click); - // // tbEmployeeName // this.tbEmployeeName.Location = new System.Drawing.Point(514, 117);