Esempio n. 1
0
        // Shopkeeper Balance
        public string ShopkeeperBalance(string ChangerQS)
        {
            _shopkeeperBalance         = ChangerUtils.URLSplitter <ShopKeeperSenderAndReceiverBalance>(ChangerQS, out IsRequestDTOSuccess);
            _shopkeeperBalanceResponse = new ShopkeeperSenderAndReceiverBalanceResponse();
            try {
                if (IsRequestDTOSuccess)
                {
                    _shopkeeperBalanceResponse = _terminalService.GetShopKeeperBalance(_shopkeeperBalance);
                }
                else
                {
                    _shopkeeperBalanceResponse.ErrorNumber  = 1303;
                    _shopkeeperBalanceResponse.ErrorMessage = ConfigurationManager.AppSettings[_shopkeeperBalanceResponse.ErrorNumber.ToString()];
                }
            } catch (ChangerMintsError Er) {
                _logerr.LogError(Er.Message, Er, LogType.Error);
                return(ChangerUtils.ResponseConcatenater <ChangerMintsError>(Er, true));
            } catch (Exception ex) {
                string message = string.Format("Class Name:{0},Method Name:{1},Error:{2}", this.GetType().Name, "ShopkeeperBalance", ex.InnerException == null ? ex.Message : ex.InnerException.Message);
                _logerr.LogError(message, ex, LogType.Error);

                _shopkeeperBalanceResponse.ErrorNumber  = 2001;
                _shopkeeperBalanceResponse.ErrorMessage = ConfigurationManager.AppSettings[_shopkeeperBalanceResponse.ErrorNumber.ToString()];
            }
            return(ChangerUtils.ResponseConcatenater <ShopkeeperSenderAndReceiverBalanceResponse>(_shopkeeperBalanceResponse, true));
        }
Esempio n. 2
0
        // Get the Shopkeeper available balance both in Sender & Receiver
        public ShopkeeperSenderAndReceiverBalanceResponse GetShopKeeperBalance(ShopKeeperSenderAndReceiverBalance ShopkeeperBalance)
        {
            _balanceResponse = new ShopkeeperSenderAndReceiverBalanceResponse();

            try {
                var messageCreators = new List <ModelResponses <ShopkeeperSenderAndReceiverBalanceResponse, ChangerValidations> > {
                    // Check if the Shopkeeper Account is of Valid length
                    new ModelResponses <ShopkeeperSenderAndReceiverBalanceResponse, ChangerValidations>(model => model.IsShopKeeperAccountValid(
                                                                                                            ShopkeeperBalance.ShopKeeperAccountNumber), 1101)
                };

                ModelResponses <ShopkeeperSenderAndReceiverBalanceResponse, ChangerValidations> errorCreator = null;
                if (!ChangerValidations.GetInputParametersStatus <ShopkeeperSenderAndReceiverBalanceResponse, ChangerValidations>(messageCreators, out errorCreator))
                {
                    return(errorCreator.FillErrorDTO <ShopkeeperSenderAndReceiverBalanceResponse>());
                }

                // Get current shopkeeper account details
                var currentShopkeeperAccountDetails = _changerMintsUOW.Repository <ShopKeeperAccountDetail>().Query().Filter(q => q.ShopKeeperAccountNumber ==
                                                                                                                             ShopkeeperBalance.ShopKeeperAccountNumber).Get().FirstOrDefault();

                if (currentShopkeeperAccountDetails != null)
                {
                    _balanceResponse.ErrorNumber     = 1;
                    _balanceResponse.ErrorMessage    = ConfigurationManager.AppSettings[_balanceResponse.ErrorNumber.ToString()];
                    _balanceResponse.SenderBalance   = currentShopkeeperAccountDetails.SenderBalance;
                    _balanceResponse.ReceiverBalance = currentShopkeeperAccountDetails.ReceiverBalance;
                }
                else
                {
                    _balanceResponse.ErrorNumber  = 1050;
                    _balanceResponse.ErrorMessage = ConfigurationManager.AppSettings[_balanceResponse.ErrorNumber.ToString()];
                }
            } catch (Exception ex) {
                throw ex;
            }
            return(_balanceResponse);
        }