Beispiel #1
0
        internal static OperationExecutedDto Confirm(GuaranteeConfirmation confirmation)
        {
            try
            {
                var guarantee = _bankGuaranteeContext.Guarantees.First(g => g.Id == confirmation.GuaranteeId);

                guarantee.IsProtocolPublished             = confirmation.IsProtocolPublished;
                guarantee.IsRiskTerritory                 = confirmation.IsRiskTerritory;
                guarantee.ContractAmount                  = confirmation.ContractAmount;
                guarantee.GuaranteeAmountLessThanContract = confirmation.GuaranteeAmountLessThanContract;
                guarantee.Confirmed = confirmation.Confirmed;

                _bankGuaranteeContext.Entry(guarantee).State = EntityState.Modified;
                _bankGuaranteeContext.SaveChanges();

                return(OperationExecutedDto.Success);
            }
            catch (Exception ex)
            {
                return(new OperationExecutedDto(Resources.DatabaseError + ex.Message));
            }
        }
        private void Confirm(bool confirmed)
        {
            var confirmation = new GuaranteeConfirmation
            {
                GuaranteeId    = _guarantee.Id,
                ContractAmount = contractAmountNumericUpDown.Value,
                GuaranteeAmountLessThanContract = guaranteeAmountLessRadioButton.Checked,
                IsProtocolPublished             = protocolPublishedRadioButton.Checked,
                IsRiskTerritory = riskTerritoryRadioButton.Checked,
                Confirmed       = confirmed
            };

            var result = GuaranteeController.Confirm(confirmation);

            if (result.Executed)
            {
                confirmPanel.Enabled = false;
                this.Text            = confirmed ? Resources.Confirmed : Resources.Declined;
            }
            else
            {
                MessageBox.Show(result.ErrorText);
            }
        }