Esempio n. 1
0
        // HourlyInput function
        // Purpose: Reads input to create an Hourly object
        // Side-effects: Advances ReadLine() position for object.
        // Returns: Hourly object.
        // Pre-Conditions: StreamReader object named data must be initialized.
        // Post-Conditions: ReadLine() position advanced 6 steps.
        public Hourly HourlyInput()
        {
            string name = data.ReadLine();
            int empNo = int.Parse(data.ReadLine());
            string address = data.ReadLine();
            string phone = data.ReadLine();
            double hours = double.Parse(data.ReadLine());
            double wage = double.Parse(data.ReadLine());

            Hourly input = new Hourly(empNo, name, address, phone, hours, wage);
            return input;
        }
Esempio n. 2
0
        // Open selection from File Menu
        // Purpose: Opens form, builds
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ClearForm();

            Stream fileStream = null;
            OpenFileDialog openFile = new OpenFileDialog();

            openFile.InitialDirectory = "c:\\";
            openFile.Filter = "text files (*.txt) | *txt";

            if (openFile.ShowDialog() == DialogResult.OK)
            {
                if ((fileStream = openFile.OpenFile()) != null)
                {
                    btnCalcPay.Enabled = true;
                    data = new StreamReader(fileStream);

                    first = HourlyInput();
                    second = HourlyInput();
                    third = SalaryInput();
                    fourth = SalaryInput();
                }
            }
        }