public Notification() { InitializeComponent(); this.Location = Parent_Form.GetLocation(); this.FormClosing += Notification_FormClosing; }
private void LoginLabel_Click(object sender, EventArgs e) { bool validUserIdAndPassword; // get an object of userlogin class //get the user id entered if (UserIdMaskedTextBox.Equals("user-")) { MessageBox.Show("Please enter your user id", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); PasswordTextBox.Text = ""; } else { login.UserID1 = UserIdMaskedTextBox.Text; } //get the password entered if (PasswordTextBox.Equals("")) { MessageBox.Show("Please enter your password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { login.Password1 = PasswordTextBox.Text; } Login_Page page = new Login_Page(); //Parent_Form parent = new Parent_Form();//temporary //connect to the database UserLoginDatabaseAccess data_access = new UserLoginDatabaseAccess(); //loading.Show(); //parent.Show(); //temporary //calling the db access class to access the database validUserIdAndPassword = data_access.AcceptLogin(login); if (validUserIdAndPassword) { Parent_Form parent = new Parent_Form(login.UserID1); //this.Close(); parent.Show(); } else { MessageBox.Show("Enter Valid username or password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } //Parent_Form parent = new Parent_Form(login.UserID1); //parent.Show(); }
private void Notification_FormClosing(object sender, FormClosingEventArgs e) { Parent_Form.activeNotifications.Remove(this); Parent_Form.SortNotifications(); }