prep for admin loading in one student file
This commit is contained in:
parent
cff1dada9c
commit
392c8c8b35
@ -1751,6 +1751,8 @@ namespace EduNetworkBuilder
|
||||
MessageBox.Show(NB.Translate("NB_LogOutFirst"));
|
||||
return;
|
||||
}
|
||||
if (CurrentUser == null)
|
||||
{ //Load a starting, or a new user
|
||||
int counter = 0;
|
||||
PersonClass tUser = null;
|
||||
while (counter < 3)
|
||||
@ -1780,6 +1782,15 @@ namespace EduNetworkBuilder
|
||||
CurrentUser = PPF.Edit(); //This does the form as dialog. When we come back, update the menu.
|
||||
UpdateMenu();
|
||||
}
|
||||
else if(CurrentUser != null && CurrentUser.isAdmin)
|
||||
{
|
||||
//We want to import the student information for this one student
|
||||
//Dig up the corresponding user.
|
||||
//Use the alt password for that user to load the file
|
||||
//import their settings
|
||||
//messagebox to show what we are doing
|
||||
}
|
||||
}
|
||||
else if (extension == ".enbh")
|
||||
{
|
||||
if(NB.GetUser() == null || CurrentUser == null)
|
||||
|
@ -573,5 +573,52 @@ namespace EduNetworkBuilder
|
||||
return Top;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the student with the specified UserName
|
||||
/// </summary>
|
||||
/// <param name="UserName">The user name to find</param>
|
||||
/// <returns>The specified person, or null if no such person exists.</returns>
|
||||
public PersonClass StudentWithTheUserName(string UserName)
|
||||
{
|
||||
if (!isAdmin) return null; //Students do not store other student records
|
||||
foreach(PersonClass PC in Students)
|
||||
{
|
||||
if (PC.UserName == UserName) return PC;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Import the settings from a student record
|
||||
/// </summary>
|
||||
/// <param name="ImportedStudent">the student we are importing from</param>
|
||||
/// <returns>The count of homeworks we added. -1 if there is an error</returns>
|
||||
public int TeacherImportStudentHomework(PersonClass ImportedStudent)
|
||||
{
|
||||
if (!isAdmin) return -1;
|
||||
PersonClass StoredStudent = StudentWithTheUserName(ImportedStudent.UserName);
|
||||
if (StoredStudent == null) return -1;
|
||||
|
||||
int NumSubmitted = 0;
|
||||
|
||||
//Retrieve all the stored settings, in case we need to re-write their file
|
||||
StoredStudent.UserSettings = ImportedStudent.UserSettings;
|
||||
|
||||
//Pull out their password, in case we want to retrieve it. (sigh)
|
||||
StoredStudent.Password = ImportedStudent.Password;
|
||||
|
||||
// loop through all networks
|
||||
foreach (SchoolworkClass SWC in ImportedStudent.Projects)
|
||||
{
|
||||
// Find any that are submitted, which are not in the admin file
|
||||
if (StoredStudent.RegisterNewlySubmittedHW(SWC))
|
||||
{
|
||||
// copy them into the admin file
|
||||
NumSubmitted++;
|
||||
}
|
||||
}
|
||||
return NumSubmitted;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -919,24 +919,9 @@ namespace EduNetworkBuilder
|
||||
continue; //Do not try to load in the data
|
||||
}
|
||||
|
||||
//Retrieve all the stored settings, in case we need to re-write their file
|
||||
storedStudent.UserSettings = tempStudent.UserSettings;
|
||||
|
||||
//Pull out their password, in case we want to retrieve it. (sigh)
|
||||
storedStudent.Password = tempStudent.Password;
|
||||
|
||||
// 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)
|
||||
int tCountSubmitted = CurrentUser.TeacherImportStudentHomework(tempStudent);
|
||||
NumSubmitted += tCountSubmitted;
|
||||
if (tCountSubmitted >0)
|
||||
NumStudentsNoSubmissions++;
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user