public bool Equals(Commodity compareTo)
        {
            if (name != compareTo.Name || buyPrice != compareTo.BuyPrice || sellPrice != compareTo.SellPrice || supply != compareTo.Supply)
                return false;

            return true;
        }
 public Commodity(Commodity copy)
 {
     name = copy.Name;
     buyPrice = copy.BuyPrice;
     sellPrice = copy.SellPrice;
     supply = copy.supply;
     lastUpdated = copy.LastUpdated;
 }
        public AddEditCommodityDialog(string system, string station, List<StarSystem> systems)
        {
            InitializeComponent();
            this.Icon = new Icon("Graphics\\EliteDangerousIcon.ico");

            SystemTextBox.Text = system;
            StationTextBox.Text = station;
            result = null;
            this.systems = systems;
        }
 public Trade(Trade copy)
 {
     commodity = new Commodity(copy.Commodity);
     startSystem = new StarSystem(copy.StartSystem);
     endSystem = new StarSystem(copy.EndSystem);
     startStation = new Station(copy.StartStation);
     endStation = new Station(copy.EndStation);
     unitsBought = copy.UnitsBought;
     score = copy.Score;
 }
        public AddEditCommodityDialog(string system, string station, List<StarSystem> systems, Commodity commodity)
        {
            InitializeComponent();
            this.Icon = new Icon("Graphics\\EliteDangerousIcon.ico");

            SystemTextBox.Text = system;
            StationTextBox.Text = station;
            result = commodity;
            this.systems = systems;

            CommodityTextBox.Text = commodity.Name;
            BuyTextBox.Text = commodity.BuyPrice.ToString("n0");
            SellTextBox.Text = commodity.SellPrice.ToString("n0");
            SupplyTextBox.Text = commodity.Supply.ToString("n0");
        }
        private void SaveChangesButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(CommodityTextBox.Text))
            {
                MessageBox.Show("Please provide the commodity name.", "Error: Commodity name needed.", MessageBoxButtons.OK);
                return;
            }

            if (string.IsNullOrEmpty(BuyTextBox.Text))
            {
                MessageBox.Show("Please provide the commodity buy price.", "Error: Commodity buy price needed.", MessageBoxButtons.OK);
                return;
            }

            if (string.IsNullOrEmpty(SellTextBox.Text))
            {
                MessageBox.Show("Please provide the commodity sell price.", "Error: Commodity sell price needed.", MessageBoxButtons.OK);
                return;
            }

            if (string.IsNullOrEmpty(SupplyTextBox.Text))
            {
                MessageBox.Show("Please provide the commodity supply.", "Error: Commodity supply needed.", MessageBoxButtons.OK);
                return;
            }

            result = new Commodity();
            result.Name = CommodityTextBox.Text;

            decimal buyPrice = 0;
            decimal.TryParse(BuyTextBox.Text, out buyPrice);
            result.BuyPrice = buyPrice;

            decimal sellPrice = 0;
            decimal.TryParse(SellTextBox.Text, out sellPrice);
            result.SellPrice = sellPrice;

            decimal supply = 0;
            decimal.TryParse(SupplyTextBox.Text, out supply);
            result.Supply = supply;

            this.Close();
        }
 public Trade()
 {
     commodity = new Commodity();
 }
 public Trade()
 {
     commodity = new Commodity();
 }
        public AddEditCommodityDialog(string system, string station, List <StarSystem> systems, Commodity commodity)
        {
            InitializeComponent();
            this.Icon = new Icon("Graphics\\EliteDangerousIcon.ico");

            SystemTextBox.Text  = system;
            StationTextBox.Text = station;
            result       = commodity;
            this.systems = systems;

            CommodityTextBox.Text = commodity.Name;
            BuyTextBox.Text       = commodity.BuyPrice.ToString("n0");
            SellTextBox.Text      = commodity.SellPrice.ToString("n0");
            SupplyTextBox.Text    = commodity.Supply.ToString("n0");
        }