diff --git a/Enigma/StationsGUI/HostStationView.Designer.cs b/Enigma/StationsGUI/HostStationView.Designer.cs index 7f5b974..7d7137d 100644 --- a/Enigma/StationsGUI/HostStationView.Designer.cs +++ b/Enigma/StationsGUI/HostStationView.Designer.cs @@ -34,8 +34,8 @@ private void InitializeComponent() this.addToWaitlist = new MetroFramework.Controls.MetroButton(); this.waitListRefresh = new System.Windows.Forms.Timer(this.components); this.tableAssign = new MetroFramework.Controls.MetroButton(); - this.viewRefresh = new System.Windows.Forms.Timer(this.components); this.resAdd = new MetroFramework.Controls.MetroButton(); + this.refreshButton = new MetroFramework.Controls.MetroButton(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.SuspendLayout(); // @@ -83,7 +83,7 @@ private void InitializeComponent() // // tableAssign // - this.tableAssign.Location = new System.Drawing.Point(886, 170); + this.tableAssign.Location = new System.Drawing.Point(886, 262); this.tableAssign.Name = "tableAssign"; this.tableAssign.Size = new System.Drawing.Size(168, 78); this.tableAssign.TabIndex = 4; @@ -91,14 +91,9 @@ private void InitializeComponent() this.tableAssign.UseSelectable = true; this.tableAssign.Click += new System.EventHandler(this.tableAssign_Click); // - // viewRefresh - // - this.viewRefresh.Interval = 5000; - this.viewRefresh.Tick += new System.EventHandler(this.viewRefresh_Tick); - // // resAdd // - this.resAdd.Location = new System.Drawing.Point(886, 274); + this.resAdd.Location = new System.Drawing.Point(886, 166); this.resAdd.Name = "resAdd"; this.resAdd.Size = new System.Drawing.Size(168, 77); this.resAdd.TabIndex = 5; @@ -106,11 +101,22 @@ private void InitializeComponent() this.resAdd.UseSelectable = true; this.resAdd.Click += new System.EventHandler(this.resAdd_Click); // + // refreshButton + // + this.refreshButton.Location = new System.Drawing.Point(886, 361); + this.refreshButton.Name = "refreshButton"; + this.refreshButton.Size = new System.Drawing.Size(168, 77); + this.refreshButton.TabIndex = 6; + this.refreshButton.Text = "Refresh"; + this.refreshButton.UseSelectable = true; + this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click); + // // HostStationView // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1111, 747); + this.Controls.Add(this.refreshButton); this.Controls.Add(this.resAdd); this.Controls.Add(this.tableAssign); this.Controls.Add(this.addToWaitlist); @@ -135,7 +141,7 @@ private void InitializeComponent() private MetroFramework.Controls.MetroButton addToWaitlist; private System.Windows.Forms.Timer waitListRefresh; private MetroFramework.Controls.MetroButton tableAssign; - private System.Windows.Forms.Timer viewRefresh; private MetroFramework.Controls.MetroButton resAdd; + private MetroFramework.Controls.MetroButton refreshButton; } } \ No newline at end of file diff --git a/Enigma/StationsGUI/HostStationView.cs b/Enigma/StationsGUI/HostStationView.cs index 02319a7..2c44f38 100644 --- a/Enigma/StationsGUI/HostStationView.cs +++ b/Enigma/StationsGUI/HostStationView.cs @@ -42,89 +42,7 @@ private void HostStationView_Load(object sender, EventArgs e) private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { - if (comboBox1.Text.Equals("Wait List")) //load the table for the waitlist - { - //This is to make sure there is no existing data in the view, therefore acting as a reset - dt = new DataTable(); //initialization of the data table - SBind.DataSource = dt; //the source for the intermediary is from the data table - dataGridView1.DataSource = SBind; //the source for the view is the binding source - dataGridView1.Refresh(); //redraw the form - - //SQL call that is sent to the database to query - //this call just recieves the name, paty, initialWaitTime columns from the waitlist - MySqlCommand cmd = new MySqlCommand("select Name, Party, initialWaitTime from Waitlist", db.getConnection()); - db.getConnection().Open(); //open the connection dialog - - MySqlDataAdapter sda = new MySqlDataAdapter(cmd); //this is just a data adapter for the mySql - sda.Fill(dt); //fill the data table with the data adapter - - //binding as done above - SBind.DataSource = dt; - dataGridView1.DataSource = SBind; - dataGridView1.Refresh(); - - db.getConnection().Close(); //close the dialog connecting to the database - sda.Dispose();//get rid of the data stored in the data adapter - } - else if (comboBox1.Text.Equals("Reservations")) //load table for any reservation - { - //FINISH - dt = new DataTable(); - SBind.DataSource = dt; - dataGridView1.DataSource = SBind; - dataGridView1.Refresh(); - - - dt = new DataTable(); - dt.Columns.Add("Name"); - dt.Columns.Add("Party Size"); - dt.Columns.Add("Reservation Time"); - DataRow row = dt.NewRow(); - for (int i=0; i < reservations.Count(); i++) - { - row = dt.NewRow(); - row["Name"] = reservations[i].getName(); - row["Party Size"] = reservations[i].getCount(); - row["Reservation Time"] = reservations[i].getResTime().ToString(); - dt.Rows.Add(row); - } - SBind.DataSource = dt; - - dataGridView1.DataSource = SBind; - dataGridView1.Refresh(); - - - - - - } - else if(comboBox1.Text.Equals("Table Status")) //Table statuses - { - dt = new DataTable(); - SBind.DataSource = dt; - dataGridView1.DataSource = SBind; - dataGridView1.Refresh(); - - //db.WriteCommand("select * from Waitlist "); - MySqlCommand cmd = new MySqlCommand("SELECT tableNumber,Seats, status FROM Seating;", db.getConnection()); - db.getConnection().Open(); - - MySqlDataAdapter sda = new MySqlDataAdapter(cmd); - sda.Fill(dt); - - //dt.Columns.Add(new DataColumn("Name", typeof(string))); - //dt.Columns.Add(new DataColumn("Reservation Time", typeof(string))); - - SBind.DataSource = dt; - - dataGridView1.DataSource = SBind; - dataGridView1.Refresh(); - - db.getConnection().Close(); - sda.Dispose(); - - - } + refreshDataTables(); } @@ -216,24 +134,47 @@ private void dataGridView1_RowHeaderMouseDoubleClick(object sender, DataGridView private void tableAssign_Click(object sender, EventArgs e) { - /* for(int i=0; i < tables.Count(); i++) - { - MessageBox.Show(tables[i]._tableStatus.ToString()); - }*/ + if (comboBox1.Text.Equals("Wait List")) + { + foreach (DataGridViewRow row in dataGridView1.SelectedRows)//take the selected row and split data + { + string name = row.Cells[0].Value.ToString(); + string partySize = row.Cells[1].Value.ToString(); + string waitTime = row.Cells[2].Value.ToString(); + TableAssign ta = new TableAssign(this, name, partySize); + ta.Show(); + } - foreach (DataGridViewRow row in dataGridView1.SelectedRows)//take the selected row and split data + } + else if (comboBox1.Text.Equals("Reservations")) { - string name = row.Cells[0].Value.ToString(); - string partySize = row.Cells[1].Value.ToString(); - string waitTime = row.Cells[2].Value.ToString(); + foreach (DataGridViewRow row in dataGridView1.SelectedRows)//take the selected row and split data + { + string name = row.Cells[0].Value.ToString(); + string partySize = row.Cells[1].Value.ToString(); + string resTime = row.Cells[2].Value.ToString(); + int party_size = Int32.Parse(row.Cells[1].Value.ToString()); + + for(int i=0;i 17, 17 - - 175, 17 - \ No newline at end of file diff --git a/EnigmaX/Classes/Party.cs b/EnigmaX/Classes/Party.cs index 289fd53..9296542 100644 --- a/EnigmaX/Classes/Party.cs +++ b/EnigmaX/Classes/Party.cs @@ -13,7 +13,7 @@ public class Party public DateTime _queueTime; public int _waitTime; public Table _table; - public int _count; + public int _count; //party size public DateTime _resTime; public int _tableAssigned;