コード例 #1
0
        public Sells()
        {
            this.RequiresAuthentication();
            Get("/sells", args =>
            {
                var model         = new BuysSellsModel();
                model.PriceString = "SellPrice";

                var page = int.Parse(Request.Query["page"].Value ?? "0");
                if (page < 0)
                {
                    page = 0;
                }
                var logsFrom = page * 15;
                var logsTo   = 15;
                var futLogs  = new List <FUTSell>();

                var logType = (string)Request.Query["type"].Value ?? "CMB";

                var assetID = int.Parse(Request.Query["assetid"].Value ?? "0");
                var revID   = int.Parse(Request.Query["revid"].Value ?? "0");

                switch (logType)
                {
                case "BIN":
                    model.Title = "Sells BIN";
                    model.SellsLogsBINActive = "active";
                    model.TreeviewBINActive  = "active";
                    futLogs = FUTLogsDatabase.GetFUTSells(logsFrom, logsTo, FUTBuyBidType.BuyNow);
                    break;

                case "BID":
                    model.Title = "Sells BID";
                    model.SellsLogsBIDActive = "active";
                    model.TreeviewBIDActive  = "active";
                    futLogs = FUTLogsDatabase.GetFUTSells(logsFrom, logsTo, FUTBuyBidType.Bid);
                    break;

                default:
                    logType     = "CMB";
                    model.Title = "Sells Combined";
                    model.SellsLogsCMBActive = "active";
                    model.TreeviewCMBActive  = "active";
                    futLogs = FUTLogsDatabase.GetFUTSells(logsFrom, logsTo);
                    break;
                }
                var checkNextPage     = FUTLogsDatabase.CheckNextPageFUTSellsLogs(logsFrom + 15, logsTo);
                var checkPreviousPage = FUTLogsDatabase.CheckPreviousPageFUTSellsLogs(logsFrom, logsTo);
                model.Logs            = new List <BuysSellsModel.SingleDataLog>();
                foreach (var futLog in futLogs)
                {
                    model.Logs.Add(new BuysSellsModel.SingleDataLog()
                    {
                        TimestampString = $"{Helper.TimestampToDateTime(futLog.Timestamp):d/M/yyyy HH:mm:ss}", ID = futLog.ID, TradeID = futLog.TradeID, RevisionID = futLog.RevisionID, ResourceID = futLog.AssetID, Price = futLog.SellPrice, ItemName = $"{futLog.ItemName} ({futLog.Rating})"
                    });
                }