Exemplo n.º 1
0
        //open Class, this opens an exisiting class
        //accessed through open folder icon/open class in the file menu
        private void OpenClass(object sender, EventArgs e)
        {
            //get the class to open
            OpenFileDialog openClass = new OpenFileDialog();
            openClass.Filter = "Graders Assistant DB Files (*.gadb)|*.gadb";
            openClass.Title = "Open Class File";
            openClass.Multiselect = false;
            openClass.AddExtension = true;
            openClass.ValidateNames = true;
            openClass.ShowDialog();

            //if a class was opened generate the database connection
            if (openClass.FileName != "")
            {
                // close the old class if necessary
                if (gaf != null)
                {
                    gaf.Close();
                    gaf.Dispose();
                    gaf = null;
                }
                dbConnention.ConnectDB(openClass.FileName);
                mainClass = dbConnention.GetClass();

                loadStudents(dbConnention);

                currentAssignmentID = 1;
                loadGradingForm(currentAssignmentID);

                classOpenEnableMenu();
            }
        }
Exemplo n.º 2
0
 private void loadGradingForm(int assignmentID)
 {
     gaf = new GradingAssignmentForm();
     gaf.MdiParent = this;
     int height = gaf.ClientSize.Height + this.Height - this.ClientSize.Height + mainMenuStrip.Height + upperToolStrip.Height + mainStatusStrip.Height;
     int width = gaf.ClientSize.Width + this.Width - this.ClientSize.Width;
     this.Size = new Size(width, height);
     this.MinimumSize = new Size(width, 0);
     gaf.Show();
     gaf.WindowState = FormWindowState.Maximized;
     if (students.Count > 0)
     {
         Assignment assignment = dbConnention.GetAssignment(1);
         gaf.LoadAssignment(assignment);
         ResponseList studentResponse = dbConnention.GetResponseList(1, 10);
         gaf.LoadResponseList(students[studentResponse.StudentID], studentResponse);
     }
 }