private void ClockOutSubmit_Click(object sender, EventArgs e) { string name = ClockInOutInput.Text; string firstName; string lastName; try { firstName = name.Substring(0, name.IndexOf(' ')); lastName = name.Substring(name.IndexOf(' ') + 1); } catch (ArgumentOutOfRangeException aoore) { return; } try { SqlWaiterRepository sql = new SqlWaiterRepository(connectionString); sql.CloseShift(firstName, lastName); ClockInOutResultsLabel.Text = name + " clocked out!"; } catch (Exception ex) { ClockInOutResultsLabel.Text = ex.Message; } }
private void Order_Load_1(object sender, EventArgs e) { Text = "Order Table " + tableno; try { string connectionString = "Server=mssql.cs.ksu.edu;Database=santiagoscavone;UID=santiagoscavone;Pwd=Sqlpassword1!"; SqlMenuItemsRepository sql = new SqlMenuItemsRepository(connectionString); foreach (DatabaseData.Models.MenuItem i in sql.FetchActiveMenuItems()) { if (i != null) { it.Add(i); comboBox1.Items.Add(i.Name); } } SqlWaiterRepository sql2 = new SqlWaiterRepository(connectionString); foreach (DatabaseData.Models.Waiter w in sql2.FetchAllCurrentylWorkingWaiters()) { if (!comboBox3.Items.Contains(w.FirstName + " " + w.LastName)) { mw.Add(w); comboBox3.Items.Add(w.FirstName + " " + w.LastName); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void Form1_Load(object sender, EventArgs e) { try { menuItemsRepository = new SqlMenuItemsRepository(connectionString); orderRepository = new SqlOrderRepository(connectionString); waiterRepository = new SqlWaiterRepository(connectionString); statisticsRepository = new SqlStatisticsRepository(connectionString); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } PropertiesDict = new[] { HireWaiterPanel, FireWaiterPanel, AddMenuItemPanel, RemoveMenuItemPanel, AddIngredientPanel, RestockIngredientPanel }; ReportsDict = new[] { DailySalesPanel, MostOrderedFoodPanel, EotMPanel, EmployeeShiftsPanel, ProfitMadePanel }; FireWaiterListLoad(); RemoveMenuItemListLoad(); RestockIngredientListLoad(); DailySalesOutputTable.ColumnCount = 3; DailySalesOutputTable.Columns[0].Name = "Product Name"; DailySalesOutputTable.Columns[1].Name = "Total Sales"; DailySalesOutputTable.Columns[2].Name = "Times Ordered"; EotMOutputTable.ColumnCount = 6; EotMOutputTable.Columns[0].Name = "First Name"; EotMOutputTable.Columns[1].Name = "Last Name"; EotMOutputTable.Columns[2].Name = "Hours Worked"; EotMOutputTable.Columns[3].Name = "Orders Served"; EotMOutputTable.Columns[4].Name = "Tips Earned"; EotMOutputTable.Columns[5].Name = "Average Tip per Order"; MostOrderedFoodOutputTable.ColumnCount = 3; MostOrderedFoodOutputTable.Columns[0].Name = "Name"; MostOrderedFoodOutputTable.Columns[1].Name = "Amount Sold"; MostOrderedFoodOutputTable.Columns[2].Name = "Total Earnings"; EmployeeShiftsOutputTable.ColumnCount = 5; EmployeeShiftsOutputTable.Columns[0].Name = "First Name"; EmployeeShiftsOutputTable.Columns[1].Name = "Last Name"; EmployeeShiftsOutputTable.Columns[2].Name = "Hours Worked"; EmployeeShiftsOutputTable.Columns[3].Name = "Employee Earnings"; EmployeeShiftsOutputTable.Columns[4].Name = "Orders Served"; ProfitMadeOutput.ColumnCount = 7; ProfitMadeOutput.Columns[0].Name = "Year"; ProfitMadeOutput.Columns[1].Name = "Month"; ProfitMadeOutput.Columns[2].Name = "Total Earnings"; ProfitMadeOutput.Columns[3].Name = "Employee Cost"; ProfitMadeOutput.Columns[4].Name = "Ingredient Cost"; ProfitMadeOutput.Columns[5].Name = "Month Profit"; ProfitMadeOutput.Columns[6].Name = "Total Profit"; }