Exemple #1
0
        public List <UserPaymentSystem> GetUserRegistredPaymentSystemWallets(ProtectedOperationContext secCtx,
                                                                             string userLogin,
                                                                             string walletPwrd,
                                                                             out WalletError error)
        {
            if (!UserSessionStorage.Instance.PermitUserOperation(secCtx, false, false))
            {
                error = WalletError.InsufficientRights;
                return(null);
            }

            try
            {
                using (var ctx = DatabaseContext.Instance.Make())
                {
                    var user = ctx.PLATFORM_USER.FirstOrDefault(u => u.Login == userLogin);
                    if (user == null)
                    {
                        error = WalletError.AuthenticationError;
                        return(null);
                    }

                    var systems = new List <UserPaymentSystem>();
                    var query   = ctx.USER_PAYMENT_SYSTEM.Where(s => s.UserId == user.ID);
                    foreach (var payment in query)
                    {
                        systems.Add(LinqToEntity.DecorateUserPaymentSystem(payment));
                    }
                    error = WalletError.OK;
                    return(systems);
                }
            }
            catch (Exception ex)
            {
                error = WalletError.ServerError;
                Logger.Error("GetUserRegistredPaymentSystemWallets() error", ex);
                return(null);
            }
        }