diff --git a/EduNetworkBuilder/PersonClass.cs b/EduNetworkBuilder/PersonClass.cs
index b426862..e25c378 100644
--- a/EduNetworkBuilder/PersonClass.cs
+++ b/EduNetworkBuilder/PersonClass.cs
@@ -230,6 +230,22 @@ namespace EduNetworkBuilder
return true;
}
+ public bool RegisterNewlySubmittedHW(SchoolworkClass ToCheck)
+ {
+ //Check to see if we already exist
+ foreach (SchoolworkClass one in Projects)
+ {
+ if (one.ThisID == ToCheck.ThisID)
+ {
+ if (one.SaveDate == ToCheck.SaveDate)
+ return false; //They were the same
+ }
+ }
+ //If we get here, we do not yet have it. Add it to the user.
+ Projects.Add(ToCheck.Clone());
+ return true;
+ }
+
///
/// Organize the projects into a nice project tree.
///
diff --git a/EduNetworkBuilder/PersonProfileForm.Designer.cs b/EduNetworkBuilder/PersonProfileForm.Designer.cs
index 1c048a3..f19e2b4 100644
--- a/EduNetworkBuilder/PersonProfileForm.Designer.cs
+++ b/EduNetworkBuilder/PersonProfileForm.Designer.cs
@@ -67,6 +67,7 @@
this.btnHWSave = new System.Windows.Forms.Button();
this.btnAllHomeworkToStudents = new System.Windows.Forms.Button();
this.btnExportAllHomework = new System.Windows.Forms.Button();
+ this.btnReadAllStudentHomework = new System.Windows.Forms.Button();
this.tcTabControl.SuspendLayout();
this.TabProfile.SuspendLayout();
this.TabClasswork.SuspendLayout();
@@ -324,6 +325,7 @@
//
// TabStudents
//
+ this.TabStudents.Controls.Add(this.btnReadAllStudentHomework);
this.TabStudents.Controls.Add(this.btnAllHomeworkToStudents);
this.TabStudents.Location = new System.Drawing.Point(4, 25);
this.TabStudents.Name = "TabStudents";
@@ -472,6 +474,16 @@
this.btnExportAllHomework.UseVisualStyleBackColor = true;
this.btnExportAllHomework.Click += new System.EventHandler(this.btnExportAllHomework_Click);
//
+ // btnReadAllStudentHomework
+ //
+ this.btnReadAllStudentHomework.Location = new System.Drawing.Point(23, 68);
+ this.btnReadAllStudentHomework.Name = "btnReadAllStudentHomework";
+ this.btnReadAllStudentHomework.Size = new System.Drawing.Size(207, 23);
+ this.btnReadAllStudentHomework.TabIndex = 7;
+ this.btnReadAllStudentHomework.Text = "Read in Student Homework";
+ this.btnReadAllStudentHomework.UseVisualStyleBackColor = true;
+ this.btnReadAllStudentHomework.Click += new System.EventHandler(this.btnReadAllStudentHomework_Click);
+ //
// PersonProfileForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
@@ -538,5 +550,6 @@
private System.Windows.Forms.Button btnHWGive;
private System.Windows.Forms.Button btnExportAllHomework;
private System.Windows.Forms.Button btnAllHomeworkToStudents;
+ private System.Windows.Forms.Button btnReadAllStudentHomework;
}
}
\ No newline at end of file
diff --git a/EduNetworkBuilder/PersonProfileForm.cs b/EduNetworkBuilder/PersonProfileForm.cs
index b06e9c9..0277b49 100644
--- a/EduNetworkBuilder/PersonProfileForm.cs
+++ b/EduNetworkBuilder/PersonProfileForm.cs
@@ -821,5 +821,74 @@ namespace EduNetworkBuilder
{
NB.NotImplimentedMessage();
}
+
+ private void btnReadAllStudentHomework_Click(object sender, EventArgs e)
+ {
+ //Ask for a directory
+ //Loop through all students
+ //Read in the file for that student
+ // make temp person record
+ // loop through all networks
+ // Find any that are submitted, which are not in the admin file
+ // copy them into the admin file
+ //Track
+ // Num submitted homeworks.
+ // Num students
+ // Num of students with no submissions
+
+ bool HadASubmission = false;
+ int NumStudent = 0;
+ int NumSubmitted = 0;
+ int NumStudentsNoSubmissions = 0;
+ int NumErrorFiles = 0;
+ int NumStudentsNoFiles = 0;
+
+ //Ask for a directory
+ OpenFileDialog OFD = NB.SelectDirectoryDialog(NB.Translate("PPF_SelectStudentDir"), CurrentUser.StudentFilePath);
+ if (OFD.FileName == "") return;//we cancel out
+ CurrentUser.StudentFilePath = Path.GetDirectoryName(OFD.FileName);
+
+ //Loop through all students
+ foreach (PersonClass storedStudent in CurrentUser.Students)
+ {
+ NumStudent++;
+ HadASubmission = false;
+ string FullName = Path.Combine(CurrentUser.StudentFilePath, storedStudent.FileName);
+ //Read in the file for that student
+ try
+ {
+ if (File.Exists(FullName))
+ {
+ // make temp person record
+ PersonClass tempStudent = new PersonClass(FullName);
+ // loop through all networks
+ foreach (SchoolworkClass SWC in tempStudent.Projects)
+ {
+ // Find any that are submitted, which are not in the admin file
+ if(storedStudent.RegisterNewlySubmittedHW(SWC))
+ {
+ // copy them into the admin file
+ NumSubmitted++;
+ HadASubmission = true;
+ }
+ }
+ if (!HadASubmission)
+ NumStudentsNoSubmissions++;
+ }
+ else
+ {
+ NumStudentsNoFiles++;
+ }
+ }
+ catch
+ {
+ NumErrorFiles++;
+ }
+ }
+ MessageBox.Show(string.Format(NB.Translate("PPF_BringInHWSummary"),
+ "\n\t" + NumStudent, "\n\t" + NumSubmitted,
+ "\n\t" + NumStudentsNoSubmissions, "\n\t" + NumStudentsNoFiles,
+ "\n\t" + NumErrorFiles));
+ }
}
}
\ No newline at end of file
diff --git a/EduNetworkBuilder/Resources/languages/edustrings.resx b/EduNetworkBuilder/Resources/languages/edustrings.resx
index 3591d67..0cb465e 100644
--- a/EduNetworkBuilder/Resources/languages/edustrings.resx
+++ b/EduNetworkBuilder/Resources/languages/edustrings.resx
@@ -1769,6 +1769,10 @@
You must load a user profile before you can open a homework file.
NB_LoadUserFirst = You must load a user profile before you can open a homework file.
+
+ Mark As Graded
+ NB_MarkGraded = Mark As Graded
+
This feature is not yet implimented.
NB_NotImplimented = This feature is not yet implimented.
@@ -1785,6 +1789,10 @@
Auto Generate Passwords
PPF_AutoGenPW = Auto Generate Passwords
+
+ Summary {0} Students {1} submissions {2} Students with no new submissions {3} Students with no file (error) {4} Students with broken files
+ PPF_BringInHWSummary = Summary {0} Students {1} submissions {2} Students with no new submissions {3} Students with no file (error) {4} Students with broken files
+
Change Password
PPF_ChangePassword = Change Password
@@ -1849,10 +1857,6 @@
User File Directory
PPF_UserDirectory
-
- Mark As Graded
- NB_MarkGraded = Mark As Graded
-
Save
_Save = Save