public EditForm(LogginUser logginUser) { //Call the logginUser to display the current user who login to the eidtor and identify the edit or view mode. InitializeComponent(); fileNameWithFullPath = ""; ToolStripLabel1.Text = "Username: "******"View") { RichTextBoxEdit.ReadOnly = true; } }
private void ButtonLogin_Click(object sender, EventArgs e) { /* Check the username and password both are correct or not. * Then identify the user type to prepare the edit form interface */ if (userManagment.CheckUsername(loginUsername) == true) { if (userManagment.CheckPassword(loginPassword) == true) { if (userManagment.CheckUserType().Equals("Edit")) { MessageBox.Show("Login success! -- You are in edit mode", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); LogginUser logginUser = new LogginUser(loginUsername, userManagment.CheckUserType()); EditForm editForm = new EditForm(logginUser); editForm.Show(); this.Hide(); } else { MessageBox.Show("Login success! -- You are in view mode", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); LogginUser logginUser = new LogginUser(loginUsername, userManagment.CheckUserType()); EditForm editForm = new EditForm(logginUser); editForm.Show(); this.Hide(); } } else { MessageBox.Show("Error! Incorrect password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Error! Incorrect username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }