public bool GrantRequest(string privateData, bool isExtendedTableLock = false, EPos epos = null) { bool result = true; try { if (isExtendedTableLock) { int waiterId = epos.GetWaiterIdByTableId(privateData); privateData = string.Format("O0{0}{1}", waiterId.ToString().Length, waiterId) + privateData; } StringBuilder sb = new StringBuilder(); sb.Append("00") .Append("00000000") .Append("0") .Append(paymentMode) .Append("0") .Append("000") .Append(privateData); Utilities.Log(string.Empty); Utilities.Log("--"); Utilities.Log("Request Message packet: "); Utilities.Log(sb.ToString()); } catch (Exception e) { result = false; } return(result); }
public static void GenerateTableList() { terminal = new Terminal(4); epos = new EPos("tableList.txt"); Utilities.Log(string.Empty); Utilities.Log("Would like to list down all the tables available? YES or NO"); A: string readLine = Console.ReadLine(); if (readLine.Equals("NO") || readLine.Equals("no")) { Utilities.Log(string.Empty); epos.GetAllWaiterId(); string waiterId = string.Empty; while (true) { Thread.Sleep(1500); Utilities.Log(string.Empty); Utilities.Log("To generate available table(s) per Waiter ID, please enter your Waiter's ID: "); waiterId = Console.ReadLine(); if (epos.waiterId.Contains(waiterId)) { break; } } while (true) { bool isRequestGranted = terminal.GrantRequest(waiterId); if (isRequestGranted) { Utilities.Log(string.Empty); epos.GetTablesPerWaiterId(waiterId); break; } } } else if (readLine.Equals("YES") || readLine.Equals("yes")) { while (true) { bool isRequestGranted = terminal.GrantRequest("00"); if (isRequestGranted) { epos.GetAllTableList(); break; } } } else { Utilities.Log("Please respond with appropriate answer; YES or NO only"); goto A; } Thread.Sleep(1500); Utilities.Log(string.Empty); }