Ejemplo n.º 1
0
        private void search_material_SelectionChangeCommitted(object sender, EventArgs e)
        {
            Desk.Material material = (Desk.Material)search_material.SelectedItem;

            DataTable grid = new DataTable();

            grid.Columns.Add("Shipping");
            grid.Columns.Add("Name");
            grid.Columns.Add("Date");
            grid.Columns.Add("Width");
            grid.Columns.Add("Depth");
            grid.Columns.Add("Drawers");
            grid.Columns.Add("Material");
            grid.Columns.Add("Price");

            StreamReader file = new StreamReader(@"../QuoteHistory.txt");

            while (!file.EndOfStream)
            {
                string[] col = file.ReadLine().Split(',');
                if (col[6] == material.ToString())
                {
                    grid.Rows.Add(col[0], col[1], col[2], col[3], col[4], col[5], col[6], col[7]);
                }
            }

            dataGridView1.DataSource = grid;
            file.Close();
        }
Ejemplo n.º 2
0
        private void showQuotes(Desk.Material material)
        {
            string csvFile = "quotes.txt";

            try
            {
                string[] quotes = File.ReadAllLines(csvFile);

                foreach (string quote in quotes)
                {
                    string[] row = quote.Split(',');

                    if (row[4].Equals(material.ToString()))
                    {
                        dataGridView1.Rows.Add(row);
                    }
                }
            }
            catch (FileNotFoundException e)
            {
            }
        }