Пример #1
0
        private void OkButton_Click(object sender, EventArgs e)
        {
            if (this.RestrictedTransactionMode)
            {
                this.messageLabel.Text     = Labels.CannotWithdrawTransaction;
                this.messageLabel.CssClass = "ui block message red vpad12";
                return;
            }

            string tranId = this.GetTranId();

            if (string.IsNullOrWhiteSpace(tranId))
            {
                return;
            }

            if (this.IsNonGlTransaction)
            {
                this.messageLabel.Text     = Labels.CannotWithdrawNotValidGLTransaction;
                this.messageLabel.CssClass = "ui block message red vpad12";
                return;
            }

            DateTime transactionDate     = DateTime.Now;
            long     transactionMasterId = Conversion.TryCastLong(tranId);

            Entities.Models.Transactions.Verification model = Status.GetVerificationStatus(this.Catalog, transactionMasterId, this.IsStockTransferRequest);
            if (
                model.VerificationStatusId.Equals(0) //Awaiting verification
                ||
                model.VerificationStatusId.Equals(1) //Automatically Approved by Workflow
                )
            {
                //Withdraw this transaction.
                if (transactionMasterId > 0)
                {
                    if (Withdrawal.WithdrawTransaction(this.Catalog, this.IsStockTransferRequest, transactionMasterId, this.UserId, this.reasonTextBox.Text))
                    {
                        this.messageLabel.Text     = string.Format(CultureManager.GetCurrent(), Labels.TransactionWithdrawnMessage, transactionDate.ToShortDateString());
                        this.messageLabel.CssClass = "ui block message yellow vpad12";
                    }
                }
            }
            else
            {
                this.messageLabel.Text     = Labels.CannotWithdrawTransaction;
                this.messageLabel.CssClass = "ui block message red vpad12";
            }

            this.ShowVerificationStatus(tranId, this.verificationLabel);
        }