populate the student tab when a student is clicked
This commit is contained in:
parent
2e535f1015
commit
d19b6ea938
115
EduNetworkBuilder/PersonProfileForm.Designer.cs
generated
115
EduNetworkBuilder/PersonProfileForm.Designer.cs
generated
@ -52,16 +52,23 @@
|
||||
this.tbHWDescription = new System.Windows.Forms.TextBox();
|
||||
this.tbHWName = new System.Windows.Forms.TextBox();
|
||||
this.tbHWClass = new System.Windows.Forms.TextBox();
|
||||
this.TabStudent = new System.Windows.Forms.TabPage();
|
||||
this.TabStudents = new System.Windows.Forms.TabPage();
|
||||
this.tvClasswork = new System.Windows.Forms.TreeView();
|
||||
this.btnExit = new System.Windows.Forms.Button();
|
||||
this.TabStudents = new System.Windows.Forms.TabPage();
|
||||
this.TabStudent = new System.Windows.Forms.TabPage();
|
||||
this.tbStudentUsername = new System.Windows.Forms.TextBox();
|
||||
this.lblStudentUserName = new System.Windows.Forms.Label();
|
||||
this.tbStudentFullName = new System.Windows.Forms.TextBox();
|
||||
this.lblStudentFullName = new System.Windows.Forms.Label();
|
||||
this.btnStudentChangePassword = new System.Windows.Forms.Button();
|
||||
this.btnStudentUpdateFile = new System.Windows.Forms.Button();
|
||||
this.tcTabControl.SuspendLayout();
|
||||
this.TabProfile.SuspendLayout();
|
||||
this.TabClasswork.SuspendLayout();
|
||||
this.tcTreeData.SuspendLayout();
|
||||
this.tabClass.SuspendLayout();
|
||||
this.TabHomework.SuspendLayout();
|
||||
this.TabStudent.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tcTabControl
|
||||
@ -152,8 +159,8 @@
|
||||
//
|
||||
this.tcTreeData.Controls.Add(this.tabClass);
|
||||
this.tcTreeData.Controls.Add(this.TabHomework);
|
||||
this.tcTreeData.Controls.Add(this.TabStudent);
|
||||
this.tcTreeData.Controls.Add(this.TabStudents);
|
||||
this.tcTreeData.Controls.Add(this.TabStudent);
|
||||
this.tcTreeData.Location = new System.Drawing.Point(145, 9);
|
||||
this.tcTreeData.Name = "tcTreeData";
|
||||
this.tcTreeData.SelectedIndex = 0;
|
||||
@ -304,15 +311,15 @@
|
||||
this.tbHWClass.Size = new System.Drawing.Size(100, 22);
|
||||
this.tbHWClass.TabIndex = 0;
|
||||
//
|
||||
// TabStudent
|
||||
// TabStudents
|
||||
//
|
||||
this.TabStudent.Location = new System.Drawing.Point(4, 25);
|
||||
this.TabStudent.Name = "TabStudent";
|
||||
this.TabStudent.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.TabStudent.Size = new System.Drawing.Size(256, 206);
|
||||
this.TabStudent.TabIndex = 2;
|
||||
this.TabStudent.Text = "Student";
|
||||
this.TabStudent.UseVisualStyleBackColor = true;
|
||||
this.TabStudents.Location = new System.Drawing.Point(4, 25);
|
||||
this.TabStudents.Name = "TabStudents";
|
||||
this.TabStudents.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.TabStudents.Size = new System.Drawing.Size(256, 206);
|
||||
this.TabStudents.TabIndex = 2;
|
||||
this.TabStudents.Text = "Students";
|
||||
this.TabStudents.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// tvClasswork
|
||||
//
|
||||
@ -335,15 +342,73 @@
|
||||
this.btnExit.UseVisualStyleBackColor = true;
|
||||
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
|
||||
//
|
||||
// TabStudents
|
||||
// TabStudent
|
||||
//
|
||||
this.TabStudents.Location = new System.Drawing.Point(4, 25);
|
||||
this.TabStudents.Name = "TabStudents";
|
||||
this.TabStudents.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.TabStudents.Size = new System.Drawing.Size(256, 206);
|
||||
this.TabStudents.TabIndex = 3;
|
||||
this.TabStudents.Text = "Student";
|
||||
this.TabStudents.UseVisualStyleBackColor = true;
|
||||
this.TabStudent.Controls.Add(this.btnStudentUpdateFile);
|
||||
this.TabStudent.Controls.Add(this.btnStudentChangePassword);
|
||||
this.TabStudent.Controls.Add(this.lblStudentFullName);
|
||||
this.TabStudent.Controls.Add(this.tbStudentFullName);
|
||||
this.TabStudent.Controls.Add(this.lblStudentUserName);
|
||||
this.TabStudent.Controls.Add(this.tbStudentUsername);
|
||||
this.TabStudent.Location = new System.Drawing.Point(4, 25);
|
||||
this.TabStudent.Name = "TabStudent";
|
||||
this.TabStudent.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.TabStudent.Size = new System.Drawing.Size(256, 206);
|
||||
this.TabStudent.TabIndex = 3;
|
||||
this.TabStudent.Text = "Student";
|
||||
this.TabStudent.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// tbStudentUsername
|
||||
//
|
||||
this.tbStudentUsername.Enabled = false;
|
||||
this.tbStudentUsername.Location = new System.Drawing.Point(107, 6);
|
||||
this.tbStudentUsername.Name = "tbStudentUsername";
|
||||
this.tbStudentUsername.Size = new System.Drawing.Size(134, 22);
|
||||
this.tbStudentUsername.TabIndex = 0;
|
||||
//
|
||||
// lblStudentUserName
|
||||
//
|
||||
this.lblStudentUserName.AutoSize = true;
|
||||
this.lblStudentUserName.Location = new System.Drawing.Point(17, 9);
|
||||
this.lblStudentUserName.Name = "lblStudentUserName";
|
||||
this.lblStudentUserName.Size = new System.Drawing.Size(79, 17);
|
||||
this.lblStudentUserName.TabIndex = 1;
|
||||
this.lblStudentUserName.Text = "User Name";
|
||||
//
|
||||
// tbStudentFullName
|
||||
//
|
||||
this.tbStudentFullName.Location = new System.Drawing.Point(107, 34);
|
||||
this.tbStudentFullName.Name = "tbStudentFullName";
|
||||
this.tbStudentFullName.Size = new System.Drawing.Size(134, 22);
|
||||
this.tbStudentFullName.TabIndex = 2;
|
||||
//
|
||||
// lblStudentFullName
|
||||
//
|
||||
this.lblStudentFullName.AutoSize = true;
|
||||
this.lblStudentFullName.Location = new System.Drawing.Point(17, 37);
|
||||
this.lblStudentFullName.Name = "lblStudentFullName";
|
||||
this.lblStudentFullName.Size = new System.Drawing.Size(71, 17);
|
||||
this.lblStudentFullName.TabIndex = 3;
|
||||
this.lblStudentFullName.Text = "Full Name";
|
||||
//
|
||||
// btnStudentChangePassword
|
||||
//
|
||||
this.btnStudentChangePassword.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnStudentChangePassword.Location = new System.Drawing.Point(156, 158);
|
||||
this.btnStudentChangePassword.Name = "btnStudentChangePassword";
|
||||
this.btnStudentChangePassword.Size = new System.Drawing.Size(94, 42);
|
||||
this.btnStudentChangePassword.TabIndex = 5;
|
||||
this.btnStudentChangePassword.Text = "Change Password";
|
||||
this.btnStudentChangePassword.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnStudentUpdateFile
|
||||
//
|
||||
this.btnStudentUpdateFile.Location = new System.Drawing.Point(54, 158);
|
||||
this.btnStudentUpdateFile.Name = "btnStudentUpdateFile";
|
||||
this.btnStudentUpdateFile.Size = new System.Drawing.Size(96, 42);
|
||||
this.btnStudentUpdateFile.TabIndex = 6;
|
||||
this.btnStudentUpdateFile.Text = "Update File";
|
||||
this.btnStudentUpdateFile.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// PersonProfileForm
|
||||
//
|
||||
@ -363,6 +428,8 @@
|
||||
this.tabClass.ResumeLayout(false);
|
||||
this.TabHomework.ResumeLayout(false);
|
||||
this.TabHomework.PerformLayout();
|
||||
this.TabStudent.ResumeLayout(false);
|
||||
this.TabStudent.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@ -382,7 +449,7 @@
|
||||
private System.Windows.Forms.TabControl tcTreeData;
|
||||
private System.Windows.Forms.TabPage tabClass;
|
||||
private System.Windows.Forms.TabPage TabHomework;
|
||||
private System.Windows.Forms.TabPage TabStudent;
|
||||
private System.Windows.Forms.TabPage TabStudents;
|
||||
private System.Windows.Forms.Label lblHWDescription;
|
||||
private System.Windows.Forms.Label lblHWName;
|
||||
private System.Windows.Forms.Label lblHWClass;
|
||||
@ -396,6 +463,12 @@
|
||||
private System.Windows.Forms.Button btnImportStudents;
|
||||
private System.Windows.Forms.Button btnHWDelete;
|
||||
private System.Windows.Forms.Button btnLaunch;
|
||||
private System.Windows.Forms.TabPage TabStudents;
|
||||
private System.Windows.Forms.TabPage TabStudent;
|
||||
private System.Windows.Forms.Label lblStudentFullName;
|
||||
private System.Windows.Forms.TextBox tbStudentFullName;
|
||||
private System.Windows.Forms.Label lblStudentUserName;
|
||||
private System.Windows.Forms.TextBox tbStudentUsername;
|
||||
private System.Windows.Forms.Button btnStudentUpdateFile;
|
||||
private System.Windows.Forms.Button btnStudentChangePassword;
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ namespace EduNetworkBuilder
|
||||
public partial class PersonProfileForm : Form
|
||||
{
|
||||
enum TopTab { profiletab=0, classworktab=1}
|
||||
enum TreeDataTab { classtab=0, homeworktab=1, studenttab=2 , studentstab =3}
|
||||
enum TreeDataTab { classtab=0, homeworktab=1, studentstab=2 , studenttab =3}
|
||||
PersonClass CurrentUser = null;
|
||||
string FileName = "";
|
||||
PersonClass ViewedUser = null;
|
||||
@ -136,6 +136,8 @@ namespace EduNetworkBuilder
|
||||
|
||||
//Make sure we update any profile settings they change
|
||||
tbFullName.LostFocus += SaveUserInfoFromForm;
|
||||
|
||||
tbStudentFullName.LostFocus += SaveStudentDataFromForm;
|
||||
}
|
||||
|
||||
private void DtpHWDue_LostFocus(object sender, EventArgs e)
|
||||
@ -317,8 +319,10 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
if(Node.Tag is PersonClass)
|
||||
{
|
||||
PersonClass PC = (PersonClass)Node.Tag;
|
||||
//It is an individual student
|
||||
ChangeTreeDataTab(TreeDataTab.studenttab);
|
||||
UpdateFormFromStudent(PC);
|
||||
}
|
||||
if(Node.Tag is string)
|
||||
{
|
||||
@ -389,6 +393,36 @@ namespace EduNetworkBuilder
|
||||
btnLaunch.Visible = true;
|
||||
}
|
||||
|
||||
void UpdateFormFromStudent(PersonClass Student)
|
||||
{
|
||||
ViewedUser = Student;
|
||||
UpdateFormFromStudent();
|
||||
}
|
||||
void UpdateFormFromStudent()
|
||||
{
|
||||
if (ViewedUser == null)
|
||||
{
|
||||
btnStudentChangePassword.Visible = false;
|
||||
btnStudentUpdateFile.Visible = false;
|
||||
return;
|
||||
}
|
||||
tbStudentFullName.Text = ViewedUser.FullName;
|
||||
tbStudentUsername.Text = ViewedUser.UserName;
|
||||
btnStudentChangePassword.Visible = true;
|
||||
btnStudentUpdateFile.Visible = true;
|
||||
}
|
||||
|
||||
void SaveStudentDataFromForm(object sender, EventArgs e)
|
||||
{
|
||||
SaveStudentDataFromForm();
|
||||
}
|
||||
|
||||
void SaveStudentDataFromForm()
|
||||
{
|
||||
if (ViewedUser == null) return;
|
||||
ViewedUser.FullName = tbStudentFullName.Text;
|
||||
}
|
||||
|
||||
private void btnHWDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ViewedSchoolwork == null) return;
|
||||
|
Loading…
Reference in New Issue
Block a user