Import homework for teachers. Let them export all the homework for a class and import it for another class
This commit is contained in:
parent
aeb61ebcf1
commit
fc39ba71c6
@ -236,6 +236,7 @@ namespace EduNetworkBuilder
|
|||||||
if (one.ThisID == ToAdd.ThisID) return false;
|
if (one.ThisID == ToAdd.ThisID) return false;
|
||||||
}
|
}
|
||||||
Projects.Add(ToAdd);
|
Projects.Add(ToAdd);
|
||||||
|
if (ToAdd.ThisID >= UserSettings.NextID) UserSettings.NextID = (uint)(ToAdd.ThisID + 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,20 +292,51 @@ namespace EduNetworkBuilder
|
|||||||
int totalHW =0;
|
int totalHW =0;
|
||||||
int Skipped = 0;
|
int Skipped = 0;
|
||||||
int imported = 0;
|
int imported = 0;
|
||||||
int replaced = 0;
|
if (isAdmin)
|
||||||
foreach (SchoolworkClass one in WhatWeRead)
|
|
||||||
{
|
{
|
||||||
totalHW++;
|
Dictionary<string, bool> InitialList = new Dictionary<string, bool>();
|
||||||
if(isAdmin)
|
//use a check-box list
|
||||||
|
foreach (SchoolworkClass one in WhatWeRead)
|
||||||
{
|
{
|
||||||
//use a check-box list
|
|
||||||
//Use due date and name + already exists (name / ID)
|
//Use due date and name + already exists (name / ID)
|
||||||
//they check if they want to import
|
string Info = one.DueDate.ToShortDateString();
|
||||||
//We never overwrite, we make a new one, with new ID
|
Info += "\t" + one.Name;
|
||||||
|
if (HasHomework(one, true)) Info += " * " + string.Format(NB.Translate("PC_HWHasID"),one.ThisID);
|
||||||
|
if (HasHomework(one, false)) Info += " ** " + string.Format(NB.Translate("PC_HWHasName"));
|
||||||
|
InitialList.Add(Info, false);
|
||||||
}
|
}
|
||||||
else
|
Dictionary<string, bool> ResponseList = NB.CheckPromptBox(InitialList, "Import", Properties.Resources.NBIco);
|
||||||
|
|
||||||
|
if (ResponseList == null) return; //They canceled out.
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
foreach(string One in ResponseList.Keys)
|
||||||
{
|
{
|
||||||
if(AddHomework(one))
|
totalHW++;
|
||||||
|
if (ResponseList[One])
|
||||||
|
{ //We are supposed to import it.
|
||||||
|
if (HasHomework(WhatWeRead[index], true))
|
||||||
|
{ //We already have this ID. Get a new ID
|
||||||
|
WhatWeRead[index].ChangeID(this); //Pass in this user, whoever we are
|
||||||
|
}
|
||||||
|
//Now we can add it without issue.
|
||||||
|
AddHomework(WhatWeRead[index]);
|
||||||
|
imported++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Skipped++;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
//they check if they want to import
|
||||||
|
//We never overwrite, we make a new one, with new ID
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (SchoolworkClass one in WhatWeRead)
|
||||||
|
{
|
||||||
|
totalHW++;
|
||||||
|
|
||||||
|
if (AddHomework(one))
|
||||||
{
|
{
|
||||||
imported++;
|
imported++;
|
||||||
}
|
}
|
||||||
@ -314,6 +346,7 @@ namespace EduNetworkBuilder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MessageBox.Show(string.Format(NB.Translate("PC_HWFileImportStats"),"\n\t" + totalHW, "\n\t" + imported, "\n\t" + Skipped));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1869,4 +1869,16 @@
|
|||||||
<value>Save</value>
|
<value>Save</value>
|
||||||
<comment>_Save = Save</comment>
|
<comment>_Save = Save</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="PC_HWFileImportStats" xml:space="preserve">
|
||||||
|
<value>Results: {0} total homework {1} imported {2} skipped</value>
|
||||||
|
<comment>PC_HWFileImportStats = Results: {0} total homework {1} imported {2} skipped</comment>
|
||||||
|
</data>
|
||||||
|
<data name="PC_HWHasID" xml:space="preserve">
|
||||||
|
<value>ID {0} Already exists.</value>
|
||||||
|
<comment>PC_HWHasID = ID {0} Already exists.</comment>
|
||||||
|
</data>
|
||||||
|
<data name="PC_HWHasName" xml:space="preserve">
|
||||||
|
<value>Name already exists.</value>
|
||||||
|
<comment>PC_HWHasName = Name already exists.</comment>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
@ -136,7 +136,7 @@ namespace EduNetworkBuilder
|
|||||||
{
|
{
|
||||||
switch (Individual.Name.ToLower())
|
switch (Individual.Name.ToLower())
|
||||||
{
|
{
|
||||||
case "EduNetworkBuilderSchoolwork":
|
case "edunetworkbuilderschoolwork":
|
||||||
case "schoolwork":
|
case "schoolwork":
|
||||||
ThisList.AddRange(Load(Individual));
|
ThisList.AddRange(Load(Individual));
|
||||||
AddedList = true;
|
AddedList = true;
|
||||||
@ -221,6 +221,12 @@ namespace EduNetworkBuilder
|
|||||||
writer.Close();
|
writer.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ChangeID(PersonClass WhoFor)
|
||||||
|
{
|
||||||
|
if (WhoFor != null && WhoFor.UserSettings != null)
|
||||||
|
ThisID = WhoFor.UserSettings.IssueID();
|
||||||
|
}
|
||||||
|
|
||||||
public void Save(XmlWriter writer)
|
public void Save(XmlWriter writer)
|
||||||
{
|
{
|
||||||
//Save the language name
|
//Save the language name
|
||||||
|
Loading…
Reference in New Issue
Block a user