示例#1
0
        private void Login_Load(object sender, EventArgs e)
        {
            // load default user if any..

            int nDefaultUsers = 0;
            FileReader r = new FileReader("UserLogin.csv");
            string[,] strData = r.LoadFile(ref nDefaultUsers);
            txtEmail.Text = strData[0, 0];
        }
        public StaffGroup()
        {
            FileReader r = new FileReader(strFile);

            string[,] strStaffRows = r.LoadFile(ref nStaffCount);

            for (int i = 0; i < nStaffCount; i++) // very dangerous! Need a global getMax function!
            {
                Staff s = new Staff(strStaffRows[i, 0],strStaffRows[i, 1],strStaffRows[i, 2]);
                arrStaff[i] = s;
            }
        }
        public PupilGroup()
        {
            FileReader r = new FileReader(strFile);

            string[,] strPupilRows = r.LoadFile(ref nCount);

            for (int i = 0; i < nCount; i++)
            {
                if( strPupilRows[i,0] == null) // end of contents..
                {
                    return;
                }

                Pupil p = new Pupil(strPupilRows[i, 0], strPupilRows[i, 1], strPupilRows[i, 2], strPupilRows[i, 3], strPupilRows[i, 4], strPupilRows[i, 5], strPupilRows[i, 6], strPupilRows[i, 7], strPupilRows[i, 8]);
                arrPupils[i] = p;
            }
        }
        public void LoadPresetEvents()
        {
            FileReader r = new FileReader(strFileName);

            string[,] strRows = r.LoadFile(ref nEventsCount);

            for (int i = 0; i < strRows.Length/2; i++) // very dangerous! Need a global getMax function!
            {
                Event e = new Event(strRows[i, 0], strRows[i, 1], "");

                if( e.GetEventCategory() ==null)
                {
                    return;
                }

                arrEvents[i] = e;
            }
        }
        public int LoadTargets()
        {
            FileReader r = new FileReader("ReportCommentsAndTargets.csv");

            string[,] strFields = r.LoadFile(ref nCount);

            if( nCount == -1)
            {
                return -1;
            }

            for (int i = 0; i < nCount; i++)
            {
                Comment c = new Comment(strFields[i,0], strFields[i,1], strFields[i,2], strFields[i,3]);

                // add to the list..
                arrComments[i] = c;
            }

            return nCount;
        }