private void LoadTableInformation() { smartRestaurant.TableService.TableService service = new smartRestaurant.TableService.TableService(); this.tableInfo = service.GetTableList(); while (this.tableInfo == null) { if (MessageBox.Show("Can't load table information.", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Hand) == DialogResult.Cancel) { ((MainForm) base.MdiParent).Exit(); } else { this.tableInfo = service.GetTableList(); } } for (int i = 0; i < this.tableInfo.Length; i++) { if (this.tableInfo[i].TableID == 0) { this.takeOutTable = this.tableInfo[i]; return; } } }
/// <summary> /// This method call TableService.GetTableList() for get all tables' information /// and create objects in TableInfo array list. /// </summary> private void LoadTableInformation() { TableService.TableService service = new TableService.TableService(); tableInfo = service.GetTableList(); while (tableInfo == null) { DialogResult result = MessageBox.Show("Can't load table information.", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); if (result == DialogResult.Cancel) ((MainForm)this.MdiParent).Exit(); else tableInfo = service.GetTableList(); } // Search table object by table id = 0 (Take Out Table) for (int i = 0;i < tableInfo.Length;i++) { if (tableInfo[i].TableID == 0) { takeOutTable = tableInfo[i]; break; } } }
public override void UpdateForm() { if (AppParameter.DeliveryModeOnly) { this.BtnMain.Visible = false; this.BtnManager.Visible = ((MainForm) base.MdiParent).User.IsManager() || ((MainForm) base.MdiParent).User.IsAuditor(); this.BtnExit.Visible = true; } else { this.BtnMain.Visible = true; this.BtnManager.Visible = false; this.BtnExit.Visible = false; } if (this.tableInfo == null) { smartRestaurant.TableService.TableService service = new smartRestaurant.TableService.TableService(); TableInformation[] tableList = service.GetTableList(); while (tableList == null) { if (MessageBox.Show("Can't load table information.", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Hand) == DialogResult.Cancel) { ((MainForm) base.MdiParent).Exit(); } else { tableList = service.GetTableList(); } } for (int i = 0; i < tableList.Length; i++) { if (tableList[i].TableID == 0) { this.tableInfo = tableList[i]; break; } } if (this.tableInfo == null) { ((MainForm) base.MdiParent).Exit(); } } this.selectedTakeOut = null; this.selectedRoad = null; this.roadIgnoreFlag = false; this.roadLstIgnoreFlag = false; this.LblPageID.Text = "Employee ID:" + ((MainForm) base.MdiParent).UserID + " | STTO020"; this.UpdateTakeOutList(); if (this.FieldFName.Text == "") { this.BtnCustList_Click(null, null); } else { this.BtnCustSearch_Click(null, null); } this.FieldPhone.Focus(); }