Students can submit homework

This commit is contained in:
Tim Young 2017-08-02 14:54:50 -05:00
parent 7a77de7ea9
commit a8f7b94e6c
3 changed files with 52 additions and 0 deletions

View File

@ -1990,7 +1990,14 @@ namespace EduNetworkBuilder
private void submitHomeworkToolStripMenuItem_Click(object sender, EventArgs e)
{
if (myNetwork.WhatFrom == null) return; //We cannot submit it
if (CurrentUser == null) return; //We need to have a user or we will blow up
if (CurrentUser.isAdmin) return; //Admins should not submit
PersonProfileForm PPF = new PersonProfileForm(CurrentUser);
CurrentUser = PPF.SubmitSchoolwork(myNetwork);
UpdateMenu();
}
}
}

View File

@ -247,6 +247,7 @@
//
// tbHWSubmitted
//
this.tbHWSubmitted.Enabled = false;
this.tbHWSubmitted.Location = new System.Drawing.Point(91, 120);
this.tbHWSubmitted.Name = "tbHWSubmitted";
this.tbHWSubmitted.Size = new System.Drawing.Size(140, 22);

View File

@ -211,6 +211,50 @@ namespace EduNetworkBuilder
return CurrentUser;
}
public PersonClass SubmitSchoolwork(Network ToAdd)
{
if (CurrentUser == null) return CurrentUser;
if (ToAdd.WhatFrom == null) return CurrentUser; //we have it
CloseAllRTFWindows();
BuilderWindow BW = NB.GetBuilderWin();
SchoolworkClass NewWork = ToAdd.WhatFrom.Clone();
NewWork.isMaster = false;
NewWork.IsSumbitted = true;
NewWork.SaveDate = DateTime.Now;
CurrentUser.Projects.Add(NewWork);
UpdateFormFromUser(); //make sure we list the right homeworks.
ChangeTreeDataTab(TreeDataTab.homeworktab);
tvClasswork.ExpandAll();
tvClasswork.Update();
//Now we want to select the item.
foreach (TreeNode TN in tvClasswork.GetAllNodes())
{
TN.ExpandAll(); //Expand everything until we get to what we need.
if (TN.Tag is SchoolworkClass)
{
SchoolworkClass Check = (SchoolworkClass)TN.Tag;
if (Check == NewWork)
{
tvClasswork.SelectedNode = TN;
break;
}
}
}
if (BW != null)
{
BW.Hide();
this.tcTabControl.SelectedIndex = 1; //Jump to the items tab
this.ShowDialog();
BW.Show();
}
return CurrentUser;
}
private void UpdateFormFromUser()
{
if (CurrentUser == null) return;