Exemplo n.º 1
0
        private void ReturnToStoreForQuantityEdit()
        {
            //TODO: finish updating the changed locations
            MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();
            transaction.BeginTransaction();
            try
            {
                PalletLocation pl        = new PalletLocation();
                String         reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString();

                int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]);

                if (gridDetailView.DataSource == null)
                {
                    return;
                }

                BLL.ReceiveDoc recDoc = new ReceiveDoc();
                recDoc.LoadByReceiptID(ReceiptID);
                recDoc.SetStatusAsDraft(CurrentContext.UserId);

                BLL.Receipt receiptStatus = new BLL.Receipt();
                receiptStatus.LoadByPrimaryKey(ReceiptID);
                receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.DRAFT_RECEIPT, null, this.GetFormIdentifier(), CurrentContext.UserId, "Returned To Draft");

                transaction.CommitTransaction();
                XtraMessageBox.Show("Receipt Returned!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                BindFormContents();
            }
            catch (Exception exp)
            {
                transaction.RollbackTransaction();
                XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        private void ConfirmQuantityAndLocation()
        {
            MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();
            transaction.BeginTransaction();
            try
            {
                PalletLocation pl = new PalletLocation();
                DataRow        dr = gridReceiveView.GetFocusedDataRow();
                if (dr == null)
                {
                    throw new Exception("Nothing to confirm!");
                }

                int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]);

                if (gridDetailView.DataSource == null)
                {
                    return;
                }

                BLL.ReceiveDoc receiveDoc = new ReceiveDoc();
                receiveDoc.LoadByReceiptIDWithReceivePallet(ReceiptID);

                while (!receiveDoc.EOF)
                {
                    int palletLocationID = Convert.ToInt32(receiveDoc.GetColumn("PalletLocationID"));
                    pl.LoadByPrimaryKey(palletLocationID);
                    pl.Confirmed = true;
                    pl.Save();

                    receiveDoc.MoveNext();
                }
                BLL.ReceiveDoc recDoc = new ReceiveDoc();
                recDoc.LoadByReceiptID(ReceiptID);

                recDoc.ConfirmQuantityAndLocation(CurrentContext.UserId);
                BLL.Receipt receiptStatus = new BLL.Receipt();
                receiptStatus.LoadByPrimaryKey(ReceiptID);
                receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.RECEIVE_QUANTITY_CONFIRMED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Receive Confirmed");

                transaction.CommitTransaction();
                XtraMessageBox.Show("Receipt Confirmed!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                BindFormContents();
            }
            catch (Exception exp)
            {
                transaction.RollbackTransaction();
                XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// This must be called after RollbackTransaction or no futher database activity will happen successfully on the current thread.
        /// </summary>
        public static void ThreadTransactionMgrReset()
        {
            TransactionMgr txMgr = TransactionMgr.ThreadTransactionMgr();

            try
            {
                if (txMgr.txCount > 0 && txMgr.hasRolledBack == false)
                {
                    txMgr.RollbackTransaction();
                }
            }
            catch {}

            Thread.SetData(txMgrSlot, null);
        }