|
#region Using directives
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using SmartInstitute.Automation.Commands.Framework;
using SmartInstitute.Client.Automation.Commands.Students;
using SmartInstitute.Client.Automation.Views;
using SmartInstitute;
#endregion
namespace SmartInstitute.Client.Automation.Documents.StudentDocuments
{
public partial class StudentProfileDocument : StudentDocumentUIBase
{
public event MethodInvoker OnStudentLoad;
public StudentProfileDocument()
{
InitializeComponent();
}
/// <summary>
/// Populate UI with student profile information, if available
/// </summary>
private void PopulateUIWithProfile()
{
if (null == base.Document.StudentModel.Profile)
return;
Student profile = base.Document.StudentModel.Profile;
profileControl.ShowProfile(base.Document.StudentModel);
presentAddress1TextBox.Text = profile.PresentAddress1;
presentAddress2TextBox.Text = profile.PresentAddress2;
permanentAddress1TextBox.Text = profile.PermanentAddress1;
permanentAddress2TextBox.Text = profile.PermanentAddress2;
firstNameTextBox.Text = profile.FirstName;
middleNameTextBox.Text = profile.MiddleName;
lastNameTextBox.Text = profile.LastName;
if( null != OnStudentLoad )
OnStudentLoad();
cancelSaveButton.Enabled = base.Document.StudentModel.IsDirty;
}
private void StudentProfileView_Load(object sender, EventArgs e)
{
if (!base.DesignMode)
this.PopulateUIWithProfile();
}
private void saveButton_Click(object sender, EventArgs e)
{
this.SaveStudent();
}
private void SaveStudent()
{
Student profile = base.Document.StudentModel.Profile;
profile.PresentAddress1 = presentAddress1TextBox.Text;
profile.PresentAddress2 = presentAddress2TextBox.Text;
profile.PermanentAddress1 = permanentAddress1TextBox.Text;
profile.PermanentAddress2 = permanentAddress2TextBox.Text;
profile.FirstName = firstNameTextBox.Text;
profile.MiddleName = middleNameTextBox.Text;
profile.LastName = lastNameTextBox.Text;
// Mark for sunchronization
base.Document.StudentModel.IsDirty = true;
base.Document.StudentModel.NotifyChange("Save");
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here