Пример #1
0
        public void InsertTradeHistory(Table.TblTrade tblTrade, TcpMsg.TradeStatus status, Int64 buyeruuid, string buyernickName)
        {
            var repoTrade = TCGGameSrv.IocContainer.Resolve <Repository.ITrading>();

            if (!repoTrade.TradeDelete(tblTrade.seq))
            {
                logger.Warn($"Trade Delete fail seq={tblTrade.seq} status={status.ToString()}");
            }
            else
            {
                var tblTradeHistory = new Table.TblTradeHistory()
                {
                    seller_uuid     = tblTrade.uuid,
                    seller_nickname = tblTrade.nickname,
                    buyer_uuid      = buyeruuid,
                    buyer_nickname  = buyernickName,
                    tokenid         = $"{tblTrade.tokentype}{tblTrade.tokenidx}",
                    cardid          = tblTrade.cardid,
                    tokenidxnum     = tblTrade.tokenidxnum,
                    sale_price      = tblTrade.sale_price,
                    status          = (Int32)status,
                    comment         = tblTrade.comment,
                    regdate         = DateTime.Now
                };

                tblTradeHistory.seq = repoTrade.HistoryInsert(tblTradeHistory);
            }
        }
Пример #2
0
        public TcpMsg.TradeGoodsHistory TblTradeHistoryToTradeGoodsHistory(Int64 uuid, Table.TblTradeHistory tblTradeHistory)
        {
            TcpMsg.TradeType tradeType  = TcpMsg.TradeType.None;
            string           targetName = string.Empty;

            if (tblTradeHistory.status == (Int32)TcpMsg.TradeStatus.Expiration)
            {
                tradeType = TcpMsg.TradeType.Expiration;
            }
            else if (tblTradeHistory.status == (Int32)TcpMsg.TradeStatus.Soldout && uuid == tblTradeHistory.seller_uuid)
            {
                tradeType  = TcpMsg.TradeType.Saleing;
                targetName = tblTradeHistory.buyer_nickname;
            }
            else if (tblTradeHistory.status == (Int32)TcpMsg.TradeStatus.Soldout && uuid == tblTradeHistory.buyer_uuid)
            {
                tradeType  = TcpMsg.TradeType.Buying;
                targetName = tblTradeHistory.seller_nickname;
            }
            else
            {
                logger.Warn($"TradeHistory Error uuid={uuid} Status={((TcpMsg.TradeStatus)tblTradeHistory.status).ToString()} Seller={tblTradeHistory.seller_uuid} Buyer={tblTradeHistory.buyer_uuid} CardId={tblTradeHistory.cardid}");
            }

            var tradeGoodsHistory = new TcpMsg.TradeGoodsHistory()
            {
                seq        = tblTradeHistory.seq,
                selleruuid = tblTradeHistory.seller_uuid,
                tradeType  = tradeType,
                targetName = targetName,
                card       = new TcpMsg.CardInfo()
                {
                    tokenType  = LBD.LBDApiManager.TokenIdToTokenType(tblTradeHistory.tokenid),
                    tokenIndex = LBD.LBDApiManager.TokenIdToTokenIndex(tblTradeHistory.tokenid),
                    meta       = tblTradeHistory.cardid
                },
                sale_price = tblTradeHistory.sale_price,
                comment    = tblTradeHistory.comment,
                regdate    = tblTradeHistory.regdate
            };

            return(tradeGoodsHistory);
        }