Exemple #1
0
		private bool SelectWaiter()
		{
			bool retValue = false;

			if (mclsTerminalDetails.AutoPrint == PrintingPreference.Auto && mboIsInTransaction)
			{
				MessageBox.Show("Sorry you cannot select a waiter when an item is already purchased.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return retValue;
			}

			try
			{
				clsEvent.AddEvent("[" + lblCashier.Text + "] Selecting waiter.");

				WaiterSelectWnd clsWaiterSelectWnd = new WaiterSelectWnd();
                clsWaiterSelectWnd.TerminalDetails = mclsTerminalDetails;
                clsWaiterSelectWnd.ShowDialog(this);
                long iWaiterID = clsWaiterSelectWnd.getWaiterID;
                string stWaiterName = clsWaiterSelectWnd.getWaiterName;
                DialogResult result = clsWaiterSelectWnd.Result;
                clsWaiterSelectWnd.Close();
                clsWaiterSelectWnd.Dispose();

				if (result == DialogResult.OK)
				{
					grpItems.Text = "Served by: " + stWaiterName;
					grpItems.Tag = iWaiterID.ToString();
					clsEvent.AddEventLn("Done! Selected Waiter: " + stWaiterName);

					if (mboIsInTransaction)
					{
						mclsSalesTransactionDetails.WaiterID = iWaiterID;
						mclsSalesTransactionDetails.WaiterName = stWaiterName;
                        Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                        mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

						clsSalesTransactions.UpdateWaiter(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.TransactionDate, iWaiterID, stWaiterName);
						clsSalesTransactions.CommitAndDispose();

						retValue = true;
					}
				}
				else { clsEvent.AddEventLn("Cancelled!"); }
			}
			catch (Exception ex)
			{ 
                InsertErrorLogToFile(ex, "ERROR!!! Selecting waiter."); 
            }

			return retValue;
		}