Import student submitted homework
This commit is contained in:
parent
8134d8cb82
commit
1396b72752
@ -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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Organize the projects into a nice project tree.
|
||||
/// </summary>
|
||||
|
13
EduNetworkBuilder/PersonProfileForm.Designer.cs
generated
13
EduNetworkBuilder/PersonProfileForm.Designer.cs
generated
@ -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;
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
@ -1769,6 +1769,10 @@
|
||||
<value>You must load a user profile before you can open a homework file.</value>
|
||||
<comment>NB_LoadUserFirst = You must load a user profile before you can open a homework file.</comment>
|
||||
</data>
|
||||
<data name="NB_MarkGraded" xml:space="preserve">
|
||||
<value>Mark As Graded</value>
|
||||
<comment>NB_MarkGraded = Mark As Graded</comment>
|
||||
</data>
|
||||
<data name="NB_NotImplimented" xml:space="preserve">
|
||||
<value>This feature is not yet implimented.</value>
|
||||
<comment>NB_NotImplimented = This feature is not yet implimented.</comment>
|
||||
@ -1785,6 +1789,10 @@
|
||||
<value>Auto Generate Passwords</value>
|
||||
<comment>PPF_AutoGenPW = Auto Generate Passwords</comment>
|
||||
</data>
|
||||
<data name="PPF_BringInHWSummary" xml:space="preserve">
|
||||
<value>Summary {0} Students {1} submissions {2} Students with no new submissions {3} Students with no file (error) {4} Students with broken files</value>
|
||||
<comment>PPF_BringInHWSummary = Summary {0} Students {1} submissions {2} Students with no new submissions {3} Students with no file (error) {4} Students with broken files</comment>
|
||||
</data>
|
||||
<data name="PPF_ChangePassword" xml:space="preserve">
|
||||
<value>Change Password</value>
|
||||
<comment>PPF_ChangePassword = Change Password</comment>
|
||||
@ -1849,10 +1857,6 @@
|
||||
<value>User File Directory</value>
|
||||
<comment>PPF_UserDirectory</comment>
|
||||
</data>
|
||||
<data name="String1" xml:space="preserve">
|
||||
<value>Mark As Graded</value>
|
||||
<comment>NB_MarkGraded = Mark As Graded</comment>
|
||||
</data>
|
||||
<data name="_Save" xml:space="preserve">
|
||||
<value>Save</value>
|
||||
<comment>_Save = Save</comment>
|
||||
|
Loading…
Reference in New Issue
Block a user