Ejemplo n.º 1
0
        private void bCommodityEditRow_Click(object sender, EventArgs e)
        {
            var csvrow =
                StationDirectory[lbCommodities.SelectedItems[0].Text].First(
                        x => x.CommodityName == cbCommodity.SelectedItem.ToString());

            var csvrow2 =
                CommodityDirectory[cbCommodity.SelectedItem.ToString()].First(
                    x => x.StationID == lbCommodities.SelectedItems[0].Text);

            var f = new EditPriceData(csvrow, CommodityDirectory.Keys.ToList());
            var q = f.ShowDialog();

            if (q == DialogResult.OK)
            {
                StationDirectory[lbCommodities.SelectedItems[0].Text].Remove(csvrow);
                CommodityDirectory[cbCommodity.SelectedItem.ToString()].Remove(csvrow2);
                ImportCsvString(f.RowToEdit.ToString());
                SetupGui();
                cbCommodity_SelectedIndexChanged(cbCommodity, new EventArgs());
            }
        }
Ejemplo n.º 2
0
        private void bStationEditRow_Click(object sender, EventArgs e)
        {
            string ComboboxKey = getCmbItemKey(cmbStation.SelectedItem);

            var csvrow  = StationDirectory[ComboboxKey].First(x => x.CommodityName == lbPrices.SelectedItems[0].Text);
            var csvrow2 = CommodityDirectory[lbPrices.SelectedItems[0].Text].First(x => x.StationID == ComboboxKey);
            
            var f = new EditPriceData(csvrow, CommodityDirectory.Keys.ToList());
            var q = f.ShowDialog();

            if (q == DialogResult.OK)
            {
                StationDirectory[ComboboxKey].Remove(csvrow);
                CommodityDirectory[lbPrices.SelectedItems[0].Text].Remove(csvrow2);
                ImportCsvString(f.RowToEdit.ToString());

                SetupGui();
                cbStation_SelectedIndexChanged(cmbStation, new EventArgs());
            }
        }