Exemple #1
0
        //  Startup method.
        static void Startup()
        {
            //  Open the files.
            try {
                employeeFile.OpenRead();
                timecardFile.OpenRead();
                paySumFile.OpenOutput();
            } catch (FileNotFoundException e) {
                MessageBox.Show(e.Message, "File system error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            //  IF the files opened, read the first record.
            if (employeeFile.IsOpen && timecardFile.IsOpen && paySumFile.IsOpen)
            {
                //  Read a record from each file.
                employeeFile.ReadRecord();
                timecardFile.ReadRecord();
            }
            else
            {
                //  Files did not open.  Quit the program.
                System.Diagnostics.Process.GetCurrentProcess().Kill();
            }
        }
        //  Startup method.
        static void Startup()
        {
            //  Open the files.
            try {
                employeeFile.OpenRead();
                paysumFile.OpenRead();
                shiftRatesFile.OpenRead();
                earningsFile.OpenOutput();
            } catch (FileNotFoundException e) {
                MessageBox.Show(e.Message, "File system error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            //  IF the files opened, read the first record.
            if (employeeFile.IsOpen && paysumFile.IsOpen && earningsFile.IsOpen)
            {
                //  Read a record from each file.
                employeeFile.ReadRecord();
                paysumFile.ReadRecord();

                for (int i = 0; i < shiftRates.Length; i++)
                {
                    if (!shiftRatesFile.IsEOF)
                    {
                        shiftRatesFile.ReadRecord();
                        shiftRates[i]           = new ShiftRates();
                        shiftRates[i].ShiftCode = shiftRatesFile.Data.ShiftCode;
                        shiftRates[i].ShiftRate = shiftRatesFile.Data.ShiftRate;
                        shiftRates[i].DisplayData();
                    }
                }
            }
            else
            {
                //  Files did not open.  Quit the program.
                System.Diagnostics.Process.GetCurrentProcess().Kill();
            }
        }