/// <summary>
        /// Returns true if Currency instances are equal
        /// </summary>
        /// <param name="other">Instance of Currency to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Currency other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     MinConfirmations == other.MinConfirmations ||
                     MinConfirmations != null &&
                     MinConfirmations.Equals(other.MinConfirmations)
                     ) &&
                 (
                     MinWithdrawalFee == other.MinWithdrawalFee ||
                     MinWithdrawalFee != null &&
                     MinWithdrawalFee.Equals(other.MinWithdrawalFee)
                 ) &&
                 (
                     DisabledDepositAddressCreation == other.DisabledDepositAddressCreation ||
                     DisabledDepositAddressCreation != null &&
                     DisabledDepositAddressCreation.Equals(other.DisabledDepositAddressCreation)
                 ) &&
                 (
                     _Currency == other._Currency ||
                     _Currency != null &&
                     _Currency.Equals(other._Currency)
                 ) &&
                 (
                     CurrencyLong == other.CurrencyLong ||
                     CurrencyLong != null &&
                     CurrencyLong.Equals(other.CurrencyLong)
                 ) &&
                 (
                     WithdrawalFee == other.WithdrawalFee ||
                     WithdrawalFee != null &&
                     WithdrawalFee.Equals(other.WithdrawalFee)
                 ) &&
                 (
                     FeePrecision == other.FeePrecision ||
                     FeePrecision != null &&
                     FeePrecision.Equals(other.FeePrecision)
                 ) &&
                 (
                     WithdrawalPriorities == other.WithdrawalPriorities ||
                     WithdrawalPriorities != null &&
                     other.WithdrawalPriorities != null &&
                     WithdrawalPriorities.SequenceEqual(other.WithdrawalPriorities)
                 ) &&
                 (
                     CoinType == other.CoinType ||

                     CoinType.Equals(other.CoinType)
                 ));
        }
Beispiel #2
0
        public async Task <WithdrawalFee> AddConfiguration(WithdrawalFee model)
        {
            try
            {
                var savedModel = _unitOfWork.WithdrawalFeeRepository.Add(model);
                await _unitOfWork.SaveChangesAsync();

                return(savedModel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #3
0
        public async Task <WithdrawalFee> UpdateConfiguration(WithdrawalFee WithdrawFee)
        {
            try
            {
                if (WithdrawFee == null)
                {
                    throw new InvalidParameterException();
                }
                _unitOfWork.WithdrawalFeeRepository.Update(WithdrawFee);
                await _unitOfWork.SaveChangesAsync();

                return(WithdrawFee);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (MinConfirmations != null)
                {
                    hashCode = hashCode * 59 + MinConfirmations.GetHashCode();
                }
                if (MinWithdrawalFee != null)
                {
                    hashCode = hashCode * 59 + MinWithdrawalFee.GetHashCode();
                }
                if (DisabledDepositAddressCreation != null)
                {
                    hashCode = hashCode * 59 + DisabledDepositAddressCreation.GetHashCode();
                }
                if (_Currency != null)
                {
                    hashCode = hashCode * 59 + _Currency.GetHashCode();
                }
                if (CurrencyLong != null)
                {
                    hashCode = hashCode * 59 + CurrencyLong.GetHashCode();
                }
                if (WithdrawalFee != null)
                {
                    hashCode = hashCode * 59 + WithdrawalFee.GetHashCode();
                }
                if (FeePrecision != null)
                {
                    hashCode = hashCode * 59 + FeePrecision.GetHashCode();
                }
                if (WithdrawalPriorities != null)
                {
                    hashCode = hashCode * 59 + WithdrawalPriorities.GetHashCode();
                }

                hashCode = hashCode * 59 + CoinType.GetHashCode();
                return(hashCode);
            }
        }
Beispiel #5
0
        public async Task <bool> ValidRangeMonth(WithdrawalFee currentFee)
        {
            var rangeMonth = await _unitOfWork.WithdrawalFeeRepository.GetAllAsync();

            if (rangeMonth == null || !rangeMonth.Any())
            {
                return(false);
            }
            rangeMonth = rangeMonth.Where(x => x.Id != currentFee.Id);//.ToList();
            var existedRangeMonth = rangeMonth.Where(x => (currentFee.TimeInvestmentBegin >= x.TimeInvestmentBegin && currentFee.TimeInvestmentEnd <= x.TimeInvestmentEnd) ||
                                                     (currentFee.TimeInvestmentBegin >= x.TimeInvestmentBegin && currentFee.TimeInvestmentBegin <= x.TimeInvestmentEnd && currentFee.TimeInvestmentEnd > x.TimeInvestmentEnd) ||
                                                     (currentFee.TimeInvestmentBegin < x.TimeInvestmentBegin && currentFee.TimeInvestmentEnd >= x.TimeInvestmentBegin && currentFee.TimeInvestmentEnd <= x.TimeInvestmentEnd) ||
                                                     (currentFee.TimeInvestmentBegin <x.TimeInvestmentBegin && currentFee.TimeInvestmentEnd> x.TimeInvestmentEnd)).ToList();

            if (existedRangeMonth.Count > 0 && existedRangeMonth.Any())
            {
                return(true);
            }

            return(false);
        }
Beispiel #6
0
        public List <WithdrawalFee> GetConfiguration()
        {
            var listData = new List <WithdrawalFee>();
            var list     = _unitOfWork.WithdrawalFeeRepository.GetAllAsync().Result;

            if (list.Any())
            {
                listData = _unitOfWork.WithdrawalFeeRepository.FindByAsync(i => i.TimeInvestmentEnd != -1).Result.ToList();
            }
            else
            {
                WithdrawalFee newData = new WithdrawalFee
                {
                    TimeInvestmentBegin = -2,
                    TimeInvestmentEnd   = -1,
                    Percentage          = 0.0375m,
                };
                _unitOfWork.WithdrawalFeeRepository.Add(newData);
                _unitOfWork.SaveChangesAsync();

                listData = list.ToList();
            }
            return(listData);
        }