Ejemplo n.º 1
0
		private void UnPackTransaction()
		{
			if (!mboIsInTransaction)
			{
				MessageBox.Show("Sorry you cannot unpack an empty transaction.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return;
			}

			if (mclsSalesTransactionDetails.WaiterID == Constants.C_RETAILPLUS_WAITERID)
			{
				if (MessageBox.Show("Sorry you need to select waiter/packer before you can un-pack! Select now?", "RetailPlus", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.OK)
				{ if (!SelectWaiter()) return; }
				else
					return;
			}

			DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.PackUnpackTransaction);

            if (loginresult == DialogResult.OK)
			{
				try
				{
                    Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                    mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

					clsSalesTransactions.UnPack(mclsSalesTransactionDetails.TransactionID);
					clsSalesTransactions.CommitAndDispose();

					MessageBox.Show("UnPacking Done!", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
				}
				catch (Exception ex)
				{
					InsertErrorLogToFile(ex, "ERROR!!! UnPacking sales transaction to database. TRACE: ");
					throw ex;
				}
			}
		}