buypeeb-cs/Listing.cs

48 lines
1,000 B
C#
Raw Normal View History

2020-09-01 10:41:29 +00:00
using System;
using System.Globalization;
namespace Buypeeb {
class Listing {
2020-09-02 04:12:56 +00:00
public string url { get; set; }
public string id { get; set; }
public string name { get; set; }
public int price = 0;
2020-09-01 10:41:29 +00:00
public int win_price;
public string original_name;
2020-09-02 04:12:56 +00:00
public bool favourite { get; set; } = false;
2020-09-01 10:41:29 +00:00
// start_date, end_date
public int bids;
public bool auto_extension;
2020-09-03 05:23:23 +00:00
public bool ready;
2020-09-01 10:41:29 +00:00
public Listing(string url, string id, string name) {
this.url = url;
this.id = id;
this.name = name;
2020-09-03 05:23:23 +00:00
this.ready = false;
2020-09-01 10:41:29 +00:00
}
2020-09-03 13:47:36 +00:00
public Listing() {
// parameterless constructur for deserialisation
}
2020-09-01 10:41:29 +00:00
public void Update() {
// use fake values for now
var rnd = new Random();
this.price = rnd.Next(100, 5000);
this.bids = rnd.Next(0, 15);
this.name = "testing";
this.original_name = "testing";
}
public string PriceAUD() {
double aud = this.price / 75.0;
return $"${aud:f2}";
}
public string PriceJPY() {
return $"¥{this.price}";
}
}
}