예제 #1
0
        private void btnAddQuote_Click(object sender, EventArgs e)
        {
            desk newDesk = new desk();

            newDesk.setWidth(Int32.Parse(txtWidth.Text));
            newDesk.setDepth(Int32.Parse(txtDepth.Text));
            newDesk.setDrawers((int)numDrawers.Value);
            newDesk.setMaterial((int)lstMaterial.SelectedIndex);

            DeskQuote newQuote = new DeskQuote(newDesk, txtName.Text, lstRush.SelectedIndex);

            WriteToDeskFile(newQuote);
            var displayQuoteForm = new DisplayQuote();

            displayQuoteForm.Show();
            this.Close();
        }
예제 #2
0
        private void WriteToDeskFile(DeskQuote dq)
        {
            String dqQuoteNo   = dq.getQuoteNo().ToString();
            String dqName      = dq.getName();
            String dqWidth     = dq.inDesk.getWidth().ToString();
            String dqDepth     = dq.inDesk.getDepth().ToString();
            String dqDrawers   = dq.inDesk.getDrawers().ToString();
            String dqMaterial  = dq.inDesk.getMaterial().ToString();
            String dqRush      = dq.getRush().ToString();
            String dqTotalCost = dq.TotalCost(dq.inDesk, dq.getRush()).ToString();
            String dqDate      = dq.getDate().ToString();
            String dqWriteLine = dqQuoteNo + '|' + dqName + '|' + dqWidth + '|' + dqDepth + '|' + dqDrawers + '|' +
                                 dqMaterial + '|' + dqRush + '|' + dqTotalCost + '|' + dqDate;
            StreamWriter deskFile = new StreamWriter(@"quotes.txt", true);

            deskFile.WriteLine(dqWriteLine);
            deskFile.Close();
        }