Finish importing one student file if we are a teacher and open a student file.

This commit is contained in:
Tim Young 2017-08-12 16:31:56 -05:00
parent 392c8c8b35
commit 6fbaf98299
3 changed files with 32 additions and 1 deletions

View File

@ -1785,10 +1785,28 @@ namespace EduNetworkBuilder
else if(CurrentUser != null && CurrentUser.isAdmin)
{
//We want to import the student information for this one student
string user = Path.GetFileNameWithoutExtension(filename);
//Dig up the corresponding user.
PersonClass CurrentStudentUser = CurrentUser.StudentWithTheUserName(user);
if(CurrentStudentUser == null)
{
//This means we do not have a user with that name in this class.
//More importantly, we do not have an alt-password set up so we can import them.
MessageBox.Show(string.Format(NB.Translate("NB_TeacherUnableToLoadUserNoAcct"),user));
return;
}
//Use the alt password for that user to load the file
PersonClass LoadedStudent = PersonClass.TryLoad(filename, CurrentStudentUser.AltPassword);
if (LoadedStudent == null)
{
//This means our password did not work
MessageBox.Show(string.Format(NB.Translate("NB_TeacherUnableToLoadUserInvalidPW"), user));
return;
}
//import their settings
int HomeworkImported = CurrentUser.TeacherImportStudentHomework(LoadedStudent);
//messagebox to show what we are doing
MessageBox.Show(string.Format(NB.Translate("NB_TeacherSuccessImport"), HomeworkImported));
}
}
else if (extension == ".enbh")

View File

@ -614,6 +614,7 @@ namespace EduNetworkBuilder
if (StoredStudent.RegisterNewlySubmittedHW(SWC))
{
// copy them into the admin file
if(SWC.IsSumbitted) //Only report submitted homeworks back.
NumSubmitted++;
}
}

View File

@ -1889,6 +1889,18 @@
<value>Please log out before loading a new person file</value>
<comment>NB_LogOutFirst = Please log out before loading a new person file</comment>
</data>
<data name="NB_TeacherSuccessImport" xml:space="preserve">
<value>Successfully loaded the file. There were {0} new submissions.</value>
<comment>NB_TeacherSuccessImport = Successfully loaded the file. There were {0} new submissions.</comment>
</data>
<data name="NB_TeacherUnableToLoadUserInvalidPW" xml:space="preserve">
<value>Unable to load user {0} : The password we have failed to open the file. Maybe this student was for a different teacher file?</value>
<comment>NB_TeacherUnableToLoadUserInvalidPW = Unable to load user {0} : The password we have failed to open the file. Maybe this student was for a different teacher file?</comment>
</data>
<data name="NB_TeacherUnableToLoadUserNoAcct" xml:space="preserve">
<value>Unable to load user {0} : No such account found. No password available to decrypt account.</value>
<comment>NB_TeacherUnableToLoadUserNoAcct = Unable to load user {0} : No such account found. No password available to decrypt account.</comment>
</data>
<data name="N_PromptToSubmit" xml:space="preserve">
<value>You have completed the homework. Would you like to submit it? If you want to clean it up and submit later, click No. Go to "Edit" -&gt; "Submit" when you want to submit it.</value>
<comment>N_PromptToSubmit = You have completed the homework. Would you like to submit it? If you want to clean it up and submit later, click No. Go to "Edit" -&gt; "Submit" when you want to submit it.</comment>