//Show Home page private void btnLogin_Click(object sender, EventArgs e) { string userId = txtUsername.Text; string pwd = txtPassword.Text; Person person = new Person(); person = StudentDB.StudentLogin(userId, pwd); //If a user is found from the student DB then the homepage will launch for the student. if (person != null) { if (person.userRole == "Student" || person.userRole == "student") { //MessageBox.Show("person role:" + person.userRole); this.Hide(); frmHomePage HomePage = new frmHomePage(person.userId); HomePage.ShowDialog(); this.Show(); } else if (person.userRole == "Teacher") { this.Hide(); this.Show(); } } else { MessageBox.Show("Incorrect password, or username. Please try again"); } }
public frmViewProgress(int studentID) { Student student = new Student(); student = StudentDB.GetStudentById(studentID); this.student = student; InitializeComponent(); }
private void frmViewProgress_Load(object sender, EventArgs e) { lblName.Text = student.firstName; var historyList = new List <ActivityHistory>(); historyList = StudentDB.GetActivityHistory(Convert.ToInt32(student.userId)); foreach (ActivityHistory history in historyList) { string singleLine = history.DateTime.ToString() + " " + history.NumberOfQuestions + " " + history.NumberOfCorrectAnswers + " " + (Convert.ToDecimal(history.NumberOfCorrectAnswers) / Convert.ToDecimal(history.NumberOfQuestions)).ToString("P") + " " + history.SkillLevel.ToString() + " " + history.ActivityType; lstViewHistory.Items.Add(singleLine); } }
//Pass the student object to the form and display the student info. public frmHomePage(int studentID) { Student student = new Student(); student = StudentDB.GetStudentById(studentID); this.student = student; InitializeComponent(); foreach (int i in numOfQuestion) { cboDrill.Items.Add(i); } lblWelcome.Text = student.FirstName + " " + student.LastName; //lblWelcome.Text = "ABC" + " " + "CDE"; }