public async Task <IPagedResult <Transaction> > ListAsync(int pageIndex, int pageSize,
                                                                  long?userId = null,
                                                                  TransactionType?transactionType = null,
                                                                  TransactionStatus?status        = null,
                                                                  DateTime?dateFrom = null,
                                                                  DateTime?dateTo   = null)
        {
            var filterSpecification = new TransactionFilterSpecification(
                userId: userId,
                transactionType: transactionType,
                status: status,
                dateFrom: dateFrom,
                dateTo: dateTo
                );
            var filterPaginatedSpecification = new TransactionFilterPaginatedSpecification(pageIndex * pageSize, pageSize,
                                                                                           userId: userId,
                                                                                           transactionType: transactionType,
                                                                                           status: status,
                                                                                           dateFrom: dateFrom,
                                                                                           dateTo: dateTo
                                                                                           );

            var items = await _transactionRepository.ListAsync(filterPaginatedSpecification);

            var totalItems = await _transactionRepository.CountAsync(filterSpecification);

            return(new PagedResult <Transaction>(pageIndex, pageSize, totalItems, items));
        }
Esempio n. 2
0
 public PropertyFilterSpecification(long?id     = null,
                                    long?userId = null,
                                    PropertyType?propertyType       = null,
                                    PropertyStatus?status           = null,
                                    TransactionType?transactionType = null,
                                    long?countyId     = null,
                                    long?cityId       = null,
                                    decimal?priceFrom = null,
                                    decimal?priceTo   = null,
                                    string telephone  = null)
     : base(x => (!id.HasValue || x.Id == id) &&
            (!userId.HasValue || x.UserId == userId) &&
            (!propertyType.HasValue || x.PropertyType == propertyType) &&
            (!status.HasValue || x.Status == status) &&
            (!transactionType.HasValue || x.TransactionType == transactionType) &&
            (!countyId.HasValue || x.CountyId == countyId) &&
            (!cityId.HasValue || x.CityId == cityId) &&
            (!priceFrom.HasValue || x.Price >= priceFrom) &&
            (!priceTo.HasValue || x.Price <= priceTo) &&
            (telephone == null || x.Contacts.Any(c => c.Telephone == telephone)))
 {
     AddInclude(x => x.County);
     AddInclude(x => x.City);
     AddInclude(x => x.User);
     ApplyOrderByDescending(x => x.Modified);
 }
Esempio n. 3
0
        public Transaction[] GetMany(int walletId, TransactionType?type, int?categoryId, DateTime?fromDate, DateTime?toDate, int?limit)
        {
            var transactions = _context.Transactions.AsQueryable();

            transactions = transactions.Where(t => t.WalletId == walletId).OrderByDescending(t => t.DateTime);

            if (type.HasValue && type.Value != TransactionType.Unknown)
            {
                transactions = transactions.Where(t => t.Type == type.Value);
            }

            if (categoryId.HasValue && categoryId.Value > 0)
            {
                transactions = transactions.Where(t => t.CategoryId == categoryId.Value);
            }

            if (fromDate.HasValue && fromDate.Value > default(DateTime))
            {
                transactions = transactions.Where(t => t.DateTime > fromDate.Value);
            }

            if (toDate.HasValue && toDate.Value > default(DateTime))
            {
                transactions = transactions.Where(t => t.DateTime < toDate.Value);
            }

            if (limit.HasValue)
            {
                transactions = transactions.Take(limit.Value);
            }

            return(transactions.ToArray());
        }
Esempio n. 4
0
        private SearchCriteria CreateCriteriaMethod()
        {
            var      name     = NameTextBox.Text.Trim();
            var      owner    = TransactionOwnerComboBox.SelectedItem as User;
            Currency?c        = null;
            Currency?currency = CurrencyComboBox.SelectedItem == null ? c
                :(Currency)CurrencyComboBox.SelectedItem;
            var             reason = ReasonComboBox.SelectedItem as TransactionReason;
            TransactionType?t      = null;
            TransactionType?type   = TypeComboBox.SelectedItem == null ? t
                :(TransactionType)TypeComboBox.SelectedItem;
            //DateTime? dateFrom = DateFromTimePicker.Value == DateTime.Now ? null : DateFromTimePicker.Value;

            SearchCriteria criteria = new SearchCriteria
            {
                Name             = name,
                Amount           = AmountNumericUpDown.Value,
                TransactionOwner = owner,
                Currency         = currency,
                // DateFrom = dateFrom,
                // DateTo = dateTo
                Reason          = reason,
                TransactionType = type,
            };

            return(criteria);
        }
Esempio n. 5
0
 private void transferTransactionsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     PanelsVisibility(false);
     pnlTransSearch.Visible = true;
     _searchType            = TransactionType.Transfer;
     dataGridTrans.Rows.Clear();
 }
Esempio n. 6
0
 public void SetFilters(DateTime?fromDate, DateTime?toDate, int memberId, TransactionType type)
 {
     _fromDate = fromDate;
     _toDate   = toDate;
     _memberId = memberId;
     _type     = type;
 }
Esempio n. 7
0
 public BankApplication()
 {
     _bank             = new Bank();
     _searchType       = null;
     _currentTransType = null;
     InitializeComponent();
 }
Esempio n. 8
0
        private void btnTransSend_Click(object sender, EventArgs e)
        {
            try
            {
                switch (_currentTransType)
                {
                case TransactionType.Withdraw:
                    _bank.Withdraw(tbTransFromAcc.Text, Convert.ToDecimal(tbTransAmount.Text), EnumConverter.StringToCurrency(cbTransCur.Text));
                    break;

                case TransactionType.Deposit:
                    _bank.Deposit(tbTransFromAcc.Text, Convert.ToDecimal(tbTransAmount.Text), EnumConverter.StringToCurrency(cbTransCur.Text));
                    break;

                case TransactionType.Transfer:
                    _bank.Transfer(tbTransFromAcc.Text, tbTransToAcc.Text, Convert.ToDecimal(tbTransAmount.Text), EnumConverter.StringToCurrency(cbTransCur.Text));
                    break;

                default:
                    throw new ArgumentException("Unknown error!");
                }
                MessageBox.Show("Success!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                _currentTransType      = null;
                pnlTransaction.Visible = false;
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
Esempio n. 9
0
        private async Task <bool> OnCancelOrder(string orderId, string symbol, TransactionType?type)
        {
            var endpoint = $"/trade/cancel";

            var url = baseUrl + endpoint;

            var parameters = GetBasePostData();

            if (type != null)
            {
                parameters.Add("type", type.ToString());
            }
            if (!string.IsNullOrEmpty(orderId))
            {
                parameters.Add("order_id", orderId);
            }
            if (!string.IsNullOrEmpty(symbol))
            {
                parameters.Add("currency", symbol);
            }

            var response = await _restRepo.PostApi <Dictionary <string, string>, Dictionary <string, object> >(url, parameters);

            _helper.HandleErrors(response);

            return(response["status"] == "0000" ? true : false);
        }
Esempio n. 10
0
        public TransactionViewModel[] GetTransactions(int walletId, TransactionType?type, int?categoryId, DateTime?fromDate, DateTime?toDate, int?limit)
        {
            var wallet = _walletsService.GetAsync(walletId);

            if (wallet == null)
            {
                throw new NotFoundException("Wallet not found");
            }

            var transactions = _transactionsService.GetMany(walletId, type, categoryId, fromDate, toDate, limit);
            var categoryIds  = transactions.Select(t => t.CategoryId).Distinct().ToArray();
            var categories   = _categoriesService.GetMany(categoryIds).ToDictionary(c => c.Id);

            return(transactions
                   .Select(t => new TransactionViewModel
            {
                CategoryName = categories[t.CategoryId].Name,
                DateTime = t.DateTime,
                Description = t.Description,
                Value = t.Value,
                Type = t.Type
            })
                   .OrderByDescending(t => t.DateTime)
                   .ToArray());
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GetTokenResponseModel" /> class.
        /// Initializes a new instance of the <see cref="GetTokenResponseModel" />class.
        /// </summary>
        /// <param name="Id">The unique identifier of the token..</param>
        /// <param name="Payer">The name of the payer..</param>
        /// <param name="EmailAddress">The email address of the payer..</param>
        /// <param name="AttributeValues">A collection of key/value pairs for any custom attribute values for this token..</param>
        /// <param name="TransactionType">The type of transaction..</param>
        /// <param name="MaskedAccountNumber">The masked account number for display to the user..</param>

        public GetTokenResponseModel(string Id = null, string Payer = null, string EmailAddress = null, List <AttributeValueModel> AttributeValues = null, TransactionType?TransactionType = null, string MaskedAccountNumber = null)
        {
            this.Id                  = Id;
            this.Payer               = Payer;
            this.EmailAddress        = EmailAddress;
            this.AttributeValues     = AttributeValues;
            this.TransactionType     = TransactionType;
            this.MaskedAccountNumber = MaskedAccountNumber;
        }
        public HistoricalTransaction(HistoricalTransactionContract contract, int assetAccuracy)
        {
            if (contract == null)
            {
                throw new ResultValidationException("Transaction not found");
            }
            if (contract.Timestamp == DateTime.MinValue)
            {
                throw new ResultValidationException("Timestamp is required", contract.Timestamp);
            }
            if (contract.Timestamp.Kind != DateTimeKind.Utc)
            {
                throw new ResultValidationException("Timestamp kind should be UTC", contract.Timestamp.Kind);
            }
            if (string.IsNullOrWhiteSpace(contract.FromAddress))
            {
                throw new ResultValidationException("Source address is required", contract.FromAddress);
            }
            if (string.IsNullOrWhiteSpace(contract.ToAddress))
            {
                throw new ResultValidationException("Destination address is required", contract.ToAddress);
            }
            if (string.IsNullOrWhiteSpace(contract.AssetId))
            {
                throw new ResultValidationException("Asset ID is required", contract.AssetId);
            }
            if (string.IsNullOrWhiteSpace(contract.Hash))
            {
                throw new ResultValidationException("Hash is required", contract.Hash);
            }
            if (contract.TransactionType.HasValue && !Enum.IsDefined(typeof(TransactionType), contract.TransactionType))
            {
                throw new ResultValidationException("Unknown transaction type", contract.TransactionType);
            }

            try
            {
                Amount = Conversions.CoinsFromContract(contract.Amount, assetAccuracy);

                if (Amount <= 0)
                {
                    throw new ResultValidationException("Amount should be positive number", contract.Amount);
                }
            }
            catch (ConversionException ex)
            {
                throw new ResultValidationException("Failed to parse amount", contract.Amount, ex);
            }

            Timestamp       = contract.Timestamp;
            FromAddress     = contract.FromAddress;
            ToAddress       = contract.ToAddress;
            AssetId         = contract.AssetId;
            Hash            = contract.Hash;
            TransactionType = contract.TransactionType;
        }
Esempio n. 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Transaction" /> class.
 /// </summary>
 /// <param name="id">The Transaction&#39;s Identifier..</param>
 /// <param name="time">A date and time value using either RFC3339 or UNIX time representation. The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places)..</param>
 /// <param name="userID">The ID of the user that initiated the creation of the Transaction..</param>
 /// <param name="accountID">The Account&#39;s identifier.</param>
 /// <param name="batchID">The ID of the \&quot;batch\&quot; that the Transaction belongs to. Transactions in the same batch are applied to the Account simultaneously..</param>
 /// <param name="requestID">The Request ID of the request which generated the transaction..</param>
 /// <param name="type">type.</param>
 public Transaction(int id = default(int), string time = default(string), int userID = default(int), string accountID = default(string), int batchID = default(int), string requestID = default(string), TransactionType?type = default(TransactionType?))
 {
     this.Id        = id;
     this.Time      = time;
     this.UserID    = userID;
     this.AccountID = accountID;
     this.BatchID   = batchID;
     this.RequestID = requestID;
     this.Type      = type;
 }
Esempio n. 14
0
        public async Task <IActionResult> TransactionAgencySearch(int walletid, TransactionType?SearchType, DateTime?StartDate, DateTime?EndDate, int pageindex = 1)
        {
            ViewBag.SearchTypes = new List <Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>
            {
                new Microsoft.AspNetCore.Mvc.Rendering.SelectListItem {
                    Text = "Tất cả", Value = ""
                },
                new Microsoft.AspNetCore.Mvc.Rendering.SelectListItem {
                    Text = TransactionType.WalletRecharge.ToName(), Value = ((int)TransactionType.WalletRecharge).ToString()
                },
                new Microsoft.AspNetCore.Mvc.Rendering.SelectListItem {
                    Text = TransactionType.CampaignServiceCharge.ToName(), Value = ((int)TransactionType.CampaignServiceCharge).ToString()
                },
                new Microsoft.AspNetCore.Mvc.Rendering.SelectListItem {
                    Text = TransactionType.CampaignServiceCashBack.ToName(), Value = ((int)TransactionType.CampaignServiceCashBack).ToString()
                },
            };

            ListTransactionViewModel list = null;

            list = await _ITransactionBusiness.GetTransactionsByType(SearchType, walletid, walletid, StartDate, EndDate, pageindex, 25);

            list.TransactionType = SearchType;

            var wallet = _IWalletRepository.GetById(walletid);

            if (wallet != null)
            {
                ViewBag.Wallet = wallet;
                if (wallet.EntityType == Core.Entities.EntityType.Account)
                {
                    var account = _IAccountBusiness.GetAccount(wallet.EntityId);
                    if (account.Result != null)
                    {
                        ViewBag.Account = account.Result;
                    }
                }
                if (wallet.EntityType == Core.Entities.EntityType.Agency)
                {
                    var agency = _IAgencyBusiness.GetAgency(wallet.EntityId);
                    if (agency.Result != null)
                    {
                        ViewBag.Account = agency.Result;
                    }
                }
            }


            if (list == null)
            {
                TempData["MessageError"] = "Don't have transaction!";
            }

            return(View(list));
        }
 public TransactionFilterSpecification(long?id     = null,
                                       long?userId = null,
                                       TransactionType?transactionType = null,
                                       TransactionStatus?status        = null,
                                       DateTime?dateFrom = null,
                                       DateTime?dateTo   = null)
     : base(x => (x.Id == id || id == null) && (x.UserId == userId || userId == null) && (x.TransactionType == transactionType || transactionType == null) && (x.Status == status || status == null) && (x.Date >= dateFrom || dateFrom == null) && (x.Date <= dateTo || dateTo == null))
 {
     AddInclude(x => x.User);
     ApplyOrderByDescending(x => x.Date);
 }
 public TransactionFilterPaginatedSpecification(int skip, int take,
                                                long?id     = null,
                                                long?userId = null,
                                                TransactionType?transactionType = null,
                                                TransactionStatus?status        = null,
                                                DateTime?dateFrom = null,
                                                DateTime?dateTo   = null)
     : base(userId: userId, transactionType: transactionType, status: status, dateFrom: dateFrom, dateTo: dateTo)
 {
     ApplyPaging(skip, take);
 }
Esempio n. 17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClientConfigureTransaction" /> class.
 /// </summary>
 /// <param name="id">The Transaction&#39;s Identifier..</param>
 /// <param name="time">A date and time value using either RFC3339 or UNIX time representation. The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places)..</param>
 /// <param name="userID">The ID of the user that initiated the creation of the Transaction..</param>
 /// <param name="accountID">The Account&#39;s identifier.</param>
 /// <param name="batchID">The ID of the \&quot;batch\&quot; that the Transaction belongs to. Transactions in the same batch are applied to the Account simultaneously..</param>
 /// <param name="requestID">The Request ID of the request which generated the transaction..</param>
 /// <param name="type">type.</param>
 /// <param name="alias">The client-provided alias for the Account..</param>
 /// <param name="marginRate">The margin rate override for the Account..</param>
 public ClientConfigureTransaction(int id = default(int), string time = default(string), int userID = default(int), string accountID = default(string), int batchID = default(int), string requestID = default(string), TransactionType?type = default(TransactionType?), string alias = default(string), double marginRate = default(double))
 {
     this.Id         = id;
     this.Time       = time;
     this.UserID     = userID;
     this.AccountID  = accountID;
     this.BatchID    = batchID;
     this.RequestID  = requestID;
     this.Type       = type;
     this.Alias      = alias;
     this.MarginRate = marginRate;
 }
Esempio n. 18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TradeClientExtensionsModifyTransaction" /> class.
 /// </summary>
 /// <param name="id">The Transaction&#39;s Identifier..</param>
 /// <param name="time">A date and time value using either RFC3339 or UNIX time representation. The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places)..</param>
 /// <param name="userID">The ID of the user that initiated the creation of the Transaction..</param>
 /// <param name="accountID">The Account&#39;s identifier.</param>
 /// <param name="batchID">The ID of the \&quot;batch\&quot; that the Transaction belongs to. Transactions in the same batch are applied to the Account simultaneously..</param>
 /// <param name="requestID">The Request ID of the request which generated the transaction..</param>
 /// <param name="type">type.</param>
 /// <param name="tradeID">The ID of the Trade who&#39;s client extensions are to be modified..</param>
 /// <param name="clientTradeID">The original Client ID of the Trade who&#39;s client extensions are to be modified..</param>
 /// <param name="tradeClientExtensionsModify">tradeClientExtensionsModify.</param>
 public TradeClientExtensionsModifyTransaction(int id = default(int), string time = default(string), int userID = default(int), string accountID = default(string), int batchID = default(int), string requestID = default(string), TransactionType?type = default(TransactionType?), int tradeID = default(int), string clientTradeID = default(string), ClientExtensions tradeClientExtensionsModify = default(ClientExtensions))
 {
     this.Id            = id;
     this.Time          = time;
     this.UserID        = userID;
     this.AccountID     = accountID;
     this.BatchID       = batchID;
     this.RequestID     = requestID;
     this.Type          = type;
     this.TradeID       = tradeID;
     this.ClientTradeID = clientTradeID;
     this.TradeClientExtensionsModify = tradeClientExtensionsModify;
 }
Esempio n. 19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GetTransactionResponseModel" /> class.
        /// Initializes a new instance of the <see cref="GetTransactionResponseModel" />class.
        /// </summary>
        /// <param name="Id">The unique identifier of the transaction..</param>
        /// <param name="Payer">The name of the payer..</param>
        /// <param name="EmailAddress">The email address of the payer..</param>
        /// <param name="TransactionType">The type of the transaction..</param>
        /// <param name="Amount">The total amount of the transaction that was charged to the payer including all fees..</param>
        /// <param name="Fee">The transaction fee charged..</param>
        /// <param name="PayerFee">The fee charnged to the payer..</param>
        /// <param name="Comments">Comments left by the payer at the initial creation of the transaction..</param>
        /// <param name="Events">A collection of all events that have occured..</param>
        /// <param name="AttributeValues">A collection of key/value pairs for any custom attribute values for this transaction..</param>
        /// <param name="Attachments">A collection of all attachments for this transaction..</param>

        public GetTransactionResponseModel(long?Id = null, string Payer = null, string EmailAddress = null, TransactionType?TransactionType = null, double?Amount = null, double?Fee = null, double?PayerFee = null, string Comments = null, List <TransactionEventModel> Events = null, List <AttributeValueModel> AttributeValues = null, List <AttachmentModel> Attachments = null)
        {
            this.Id              = Id;
            this.Payer           = Payer;
            this.EmailAddress    = EmailAddress;
            this.TransactionType = TransactionType;
            this.Amount          = Amount;
            this.Fee             = Fee;
            this.PayerFee        = PayerFee;
            this.Comments        = Comments;
            this.Events          = Events;
            this.AttributeValues = AttributeValues;
            this.Attachments     = Attachments;
        }
 public PropertyFilterPaginatedSpecification(int skip, int take,
                                             long?id     = null,
                                             long?userId = null,
                                             PropertyType?propertyType       = null,
                                             PropertyStatus?status           = null,
                                             TransactionType?transactionType = null,
                                             long?countyId     = null,
                                             long?cityId       = null,
                                             decimal?priceFrom = null,
                                             decimal?priceTo   = null,
                                             string telephone  = null)
     : base(id: id, userId: userId, propertyType: propertyType, status: status, transactionType: transactionType, countyId: countyId, cityId: cityId, priceFrom: priceFrom, priceTo: priceTo, telephone: telephone)
 {
     ApplyPaging(skip, take);
 }
Esempio n. 21
0
        public ActionResult List(string term, OrderStatus?status, TransactionType?type, TimeLine?interval, int rows, int page, string sidx, string sord)
        {
            IEnumerable <order> results;

            if (!type.HasValue)
            {
                type = TransactionType.ALL;
            }

            // admins can see all orders created, users can only see orders they have created
            if (permission.HasFlag(UserPermission.TRANSACTION_VIEW))
            {
                results = repository.GetOrders(subdomainid.Value, type.Value, sessionid.Value, interval, sidx, sord, false);
            }
            else
            {
                results = repository.GetOrders(subdomainid.Value, type.Value, sessionid.Value, interval, sidx, sord, true);
            }

            if (status.HasValue)
            {
                results = results.Where(x => x.status == status.Value.ToString());
            }
#if LUCENE
            if (!string.IsNullOrEmpty(term))
            {
                var search = new LuceneSearch();
                var ids    = search.TransactionSearch(term.ToLower(), accountSubdomainName);
                results = results.Where(x => ids.Select(y => y.id).Contains(x.id.ToString())).AsEnumerable();
                results = results.Join(ids, x => x.id.ToString(), y => y.id, (x, y) => new { x, y.score })
                          .OrderByDescending(x => x.score).Select(x => x.x);
            }
#endif
            var records = results.Count();
            var total   = (records / rows);
            if (records % rows != 0)
            {
                total++;
            }
            // return in the format required for jqgrid
            results = results.Skip(rows * (page - 1)).Take(rows);

            var orders = results.ToTransactionJqGrid(sessionid.Value);
            orders.page    = page;
            orders.records = records;
            orders.total   = total;
            return(Json(orders));
        }
Esempio n. 22
0
        public async Task <IEnumerable <Category> > GetAllCategories(TransactionType?transactionType = null)
        {
            IEnumerable <Category> returnedCategories;

            if (transactionType.HasValue)
            {
                returnedCategories =
                    await _repository.GetAllCategoriesForTransactionType(_userContext.UserId, transactionType.Value);
            }
            else
            {
                returnedCategories = await _repository.GetAllCategories(_userContext.UserId);
            }

            return(returnedCategories.OrderBy(category => category.CategoryName).ToList());
        }
Esempio n. 23
0
        public List <Transaction> GetTransactionsList(DateTime?timeSpan, TransactionType?type)
        {
            var result = _dataModel.Transactions;

            if (timeSpan != null)
            {
                var ts = timeSpan.Value;
                result = (List <Transaction>)result.Where(t => t.DateTime.Month.Equals(ts.Month));
            }

            if (type != null)
            {
                result = (List <Transaction>)result.Where(t => t.TransactionType.Equals(type));
            }

            result.Sort((t1, t2) => t1.DateTime.CompareTo(t2.DateTime));
            return(result);
        }
Esempio n. 24
0
        public async Task <IPagedResult <Property> > ListAsync(int pageIndex, int pageSize,
                                                               long?userId = null,
                                                               PropertyType?propertyType       = null,
                                                               PropertyStatus?status           = null,
                                                               TransactionType?transactionType = null,
                                                               long?countyId     = null,
                                                               long?cityId       = null,
                                                               decimal?priceFrom = null,
                                                               decimal?priceTo   = null,
                                                               string telephone  = null,
                                                               long?code         = null)
        {
            var filterSpecification = new PropertyFilterSpecification(
                userId: userId,
                propertyType: propertyType,
                status: status,
                transactionType: transactionType,
                countyId: countyId,
                cityId: cityId,
                priceFrom: priceFrom,
                priceTo: priceTo,
                telephone: telephone,
                id: code
                );
            var filterPaginatedSpecification = new PropertyFilterPaginatedSpecification(pageIndex * pageSize, pageSize,
                                                                                        userId: userId,
                                                                                        propertyType: propertyType,
                                                                                        status: status,
                                                                                        transactionType: transactionType,
                                                                                        countyId: countyId,
                                                                                        cityId: cityId,
                                                                                        priceFrom: priceFrom,
                                                                                        priceTo: priceTo,
                                                                                        telephone: telephone,
                                                                                        id: code
                                                                                        );

            var items = await _propertyRepository.ListAsync(filterPaginatedSpecification);

            var totalItems = await _propertyRepository.CountAsync(filterSpecification);

            return(new PagedResult <Property>(pageIndex, pageSize, totalItems, items));
        }
Esempio n. 25
0
        public async Task <ListTransactionViewModel> GetTransactionsByType(TransactionType?searchtype, int?sender_wallet_id, int?reciever_wallet_id, DateTime?StartDate, DateTime?EndDate, int pageindex, int pagesize)
        {
            TransactionSpecification filter = null;

            filter = new TransactionSpecification(searchtype, sender_wallet_id, reciever_wallet_id, StartDate, EndDate); //tất cả

            //new TransactionSpecification(sender_wallet_id, reciever_wallet_id, StartDate, EndDate);

            var transactions = await _ITransactionRepository.ListPagedAsync(filter, "DateCreated_desc", pageindex, 25);

            var total = _ITransactionRepository.Count(filter);

            return(new ListTransactionViewModel()
            {
                Transactions = transactions.Select(t => new TransactionViewModel(t)).ToList(),
                Pager = new PagerViewModel(pageindex, pagesize, total),
                StartDate = StartDate.HasValue ? StartDate.Value.ToString() : "",
                EndDate = EndDate.HasValue ? EndDate.Value.ToString() : ""
            });
        }
Esempio n. 26
0
        // ReSharper disable once MethodOverloadWithOptionalParameter
        public Task <IResult <PaymentReceiptResults> > Get(TransactionType?transactionType = null,
                                                           long?pageSize             = 10,
                                                           long?offset               = null,
                                                           TransactionListSorts?sort = null)
        {
            var address = _usedAddress;

            if (transactionType.HasValue)
            {
                address = string.Format("{0}/{1}", _usedAddress, EnumUtils.GetEnumDescription(transactionType));
            }

            var parameters = new Dictionary <string, string>();

            AddParameter(parameters, "pageSize", pageSize);
            AddParameter(parameters, "offset", offset);
            AddParameter(parameters, "sort", sort);

            return(GetInternal <PaymentReceiptResults>(address, parameters));
        }
Esempio n. 27
0
        public async Task <IActionResult> FetchUserTransactionsAsync(
            [FromQuery] CurrencyType?currencyType = null,
            [FromQuery] TransactionType?type      = null,
            [FromQuery] TransactionStatus?status  = null
            )
        {
            var userId = HttpContext.GetUserId();

            var responses = await _transactionQuery.FetchUserTransactionsAsync(
                userId,
                currencyType,
                type,
                status);

            if (!responses.Any())
            {
                return(this.NoContent());
            }

            return(this.Ok(_mapper.Map <IReadOnlyCollection <TransactionDto> >(responses)));
        }
            private void SaveTransactionLog(Shift shift, string transactionId)
            {
                TransactionType?transactionType = GetTransactionType(shift);

                if (transactionType == null)
                {
                    return; // Do nothing
                }

                TransactionLog transactionLog = new TransactionLog
                {
                    TransactionType = transactionType.Value,
                    StaffId         = shift.StaffId,
                    Id         = transactionId,
                    TerminalId = shift.CurrentTerminalId,
                    StoreId    = shift.StoreId
                };

                // Need to persist the current terminal id here since the Shift could be floated.
                SaveTransactionLogDataRequest saveTransactionLogDataServiceRequest = new SaveTransactionLogDataRequest(transactionLog);

                this.Context.Runtime.Execute <NullResponse>(saveTransactionLogDataServiceRequest, this.Context);
            }
Esempio n. 29
0
        public async Task <IActionResult> History(TransactionType?type, string daterange = "", int pageindex = 1, int pagesize = 20)
        {
            ViewBag.Type = type;
            if (string.IsNullOrEmpty(daterange))
            {
                daterange = string.Format("{0} - {1}", new DateTime(2019, 1, 1).ToViDate(), DateTime.Now.ToViDate());
            }
            if (type.HasValue)
            {
                var model = await _transactionService.GetTransactionHistory(EntityType.Agency, CurrentUser.Id, type.Value, daterange, pageindex, pagesize);

                ViewBag.DateRange = daterange;
                ViewBag.Total     = await _transactionService.GetTotalAmount(CurrentUser.Id, type.Value);

                return(View("HistoryWithType", model));
            }
            else
            {
                var model = await _transactionService.GetTransactionHistory(EntityType.Agency, CurrentUser.Id, daterange, pageindex, pagesize);

                ViewBag.DateRange = daterange;
                return(View(model));
            }
        }
Esempio n. 30
0
 internal static string ToSerializedValue(this TransactionType?value)
 {
     return(value == null ? null : ((TransactionType)value).ToSerializedValue());
 }