private void btnlogin_Click(object sender, EventArgs e) { string UserId = "0"; if (string.IsNullOrEmpty(txtUsername.Text) || string.IsNullOrWhiteSpace(txtUsername.Text)) { LoadMessage("Information", "Please Enter User Name"); txtUsername.Focus(); } else if (string.IsNullOrEmpty(txtPassword.Text) || string.IsNullOrWhiteSpace(txtPassword.Text)) { LoadMessage("Information", "Please Enter Password"); txtPassword.Focus(); } else { if (o_loginWindow.IsValidUser(txtUsername.Text, txtPassword.Text, out UserId)) //To Check Username Exist Or Not { Globals.UserId = UserId; FrmCourses frmCourses = new FrmCourses(); this.Hide(); frmCourses.ShowDialog(); this.Close(); } else { LoadMessage("Information", "Invalid User Name or Password"); txtUsername.Focus(); } } }
private void frmLessions_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Back || e.KeyCode == Keys.Escape) { FrmCourses objCourses = new FrmCourses(CourseID); this.Hide(); objCourses.ShowDialog(); } }
private void lstLessions_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { int key = (int)lstLessions.SelectedValue; FrmTopic objFrmTopic = new FrmTopic(CourseID, key.ToString()); this.Hide(); objFrmTopic.ShowDialog(); } else if (e.KeyCode == Keys.Back || e.KeyCode == Keys.Escape) { FrmCourses objCourses = new FrmCourses(CourseID); this.Hide(); objCourses.ShowDialog(); } } catch (Exception ex) { throw; } }