Esempio n. 1
0
    public static String GetGridViewStringForUserActualTransactions(int ClientId, CryptocurrencyOfferType SiteType)
    {
        CryptocurrencyOfferType Type1 = (SiteType == CryptocurrencyOfferType.Buy) ? CryptocurrencyOfferType.Sell : CryptocurrencyOfferType.Buy;
        CryptocurrencyOfferType Type2 = (SiteType == CryptocurrencyOfferType.Buy) ? CryptocurrencyOfferType.Buy : CryptocurrencyOfferType.Sell;

        return(String.Format(@"SELECT * FROM CryptoCurrencyTradeTransactions
                             WHERE 
                             ((ClientId={0} AND 
							 OfferId IN (
								SELECT Id 
								FROM CryptocurrencyTradeOffers
								WHERE OfferKind={1}))
                              OR
                             (OfferId IN(
                                SELECT Id 
                                FROM CryptocurrencyTradeOffers 
                                WHERE CreatorId={0}
                                AND OfferKind={2})))
							 AND PaymentStatus IN ({3},{4},{5},{6})"                            ,
                             ClientId,
                             (int)Type1,
                             (int)Type2,
                             (int)CryptocurrencyTransactionStatus.AwaitingPayment,
                             (int)CryptocurrencyTransactionStatus.AwaitingPaymentConfirmation,
                             (int)CryptocurrencyTransactionStatus.NotPaid,
                             (int)CryptocurrencyTransactionStatus.PaymentNotConfirmed));
    }
Esempio n. 2
0
 public static String GetGridViewStringForAllActiveOffersForUser(int UserId, CryptocurrencyOfferType OfferType)
 {
     return(String.Format("SELECT * FROM CryptocurrencyTradeOffers WHERE [OfferKind]={0} AND [Status] = {1} AND [CreatorId] NOT LIKE {2}",
                          (int)OfferType,
                          (int)CryptocurrencyOfferStatus.Active,
                          UserId));
 }
Esempio n. 3
0
 public static String GetGridViewStringForUserActualOffers(int CreatorId, CryptocurrencyOfferType TypeOfOffers)
 {
     return(String.Format(@"SELECT * FROM CryptocurrencyTradeOffers WHERE [CreatorId] = {0} AND [OfferKind]={1} AND [Status] IN ({2},{3})",
                          CreatorId,
                          (int)TypeOfOffers,
                          (int)CryptocurrencyOfferStatus.Active,
                          (int)CryptocurrencyOfferStatus.Paused));
 }
Esempio n. 4
0
    private static String GenerateQueryStringForNumberOfPositiveActions(CryptocurrencyOfferType type, int userId)
    {
        String TypeOfUser = type == CryptocurrencyOfferType.Buy ? "BuyerId" : "SellerId";
        CryptocurrencyTransactionStatus TypeOfTransactionDispute = type == CryptocurrencyOfferType.Buy ?
                                                                   CryptocurrencyTransactionStatus.SolvedCryptocurrencyToOfferOwner :
                                                                   CryptocurrencyTransactionStatus.SolvedCryptocurrencyToOfferClient;

        String Query = String.Format(@"SELECT COUNT(*) FROM CryptoCurrencyTradeTransactions WHERE 
                                                                            OfferId IN (SELECT OfferId FROM CryptocurrencyFinishedTradeOffers WHERE {0}={1}) AND
                                                                            PaymentStatus IN ({2},{3})",
                                     TypeOfUser,
                                     userId,
                                     (int)CryptocurrencyTransactionStatus.Finished,
                                     (int)TypeOfTransactionDispute);

        return(Query);
    }
Esempio n. 5
0
    public static void CreateNewOffer(CryptocurrencyOfferType OfferType, int CreatorId, Money MinPrice, Money MaxPrice, Money MinOfferValue, Money MaxOfferValue, int EscrowTime, String Description, CryptocurrencyMoney CryptocurrencyAmount)
    {
        CryptocurrencyTradeOffer NewTradeOffer = new CryptocurrencyTradeOffer();

        NewTradeOffer.Status       = CryptocurrencyOfferStatus.Active;
        NewTradeOffer.DateAdded    = DateTime.Now;
        NewTradeOffer.DateFinished = DateTime.Now.AddDays(365);

        NewTradeOffer.OfferKind     = OfferType;
        NewTradeOffer.CreatorId     = CreatorId;
        NewTradeOffer.MinPrice      = MinPrice;
        NewTradeOffer.MaxPrice      = MaxPrice;
        NewTradeOffer.MinOfferValue = MinOfferValue;
        NewTradeOffer.MaxOfferValue = MaxOfferValue;
        NewTradeOffer.Description   = Description;
        NewTradeOffer.EscrowTime    = EscrowTime;
        NewTradeOffer.Amount        = CryptocurrencyAmount;
        NewTradeOffer.AmountLeft    = CryptocurrencyAmount;

        NewTradeOffer.Save(true);
    }
Esempio n. 6
0
    public static String GetGridViewStringForUserHistory(int UserId, CryptocurrencyOfferType OffersType)
    {
        String UserType = (OffersType == CryptocurrencyOfferType.Buy) ? "BuyerID" : "SellerId";

        return(String.Format("SELECT * FROM CryptocurrencyFinishedTradeOffers WHERE {0}={1}", UserType, UserId));
    }