Exemple #1
0
    protected void Sold_Click(Object sender, EventArgs e)
    {
        OpenFileDialog o = new OpenFileDialog();

        o.Filter      = "Text Files (.txt)|*.txt|All Files (*.*)|*.*";
        o.FilterIndex = 1;
        ID_Tree LoadData = new ID_Tree();

        string       path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\DataJoe";
        StreamReader load = new StreamReader(path + "\\IdStore.txt");
        string       soldLine;

        while ((soldLine = load.ReadLine()) != null)
        {
            string[] data = soldLine.Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
            if (data.Length == 1)
            {
                LoadData.insert(data[0]);
            }
            else
            {
                MessageBox.Show("Debug this file Joseph");
            }
        }

        load.Close();

        if (o.ShowDialog() == DialogResult.OK)
        {
            StreamReader read = new StreamReader(o.OpenFile());
            string       line;
            string       bollox = read.ReadLine();
            while ((line = read.ReadLine()) != null)
            {
                string[] data = line.Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);

                if (data.Length == 20)
                {
                    if (!LoadData.search(data[1]))
                    {
                        inventory.AddSold(data[2], int.Parse(data[6]), false);
                        inventory.AddAmazon(data[2], int.Parse(data[6]));
                        LoadData.insert(data[1]);
                    }
                }
            }
            read.Close();
        }

        LoadData.PreOrderPrint();
    }