private void CheckPass_Click(object sender, RoutedEventArgs e) { string password = Pass.Password; Security secur = new Security(); var isPassOk = secur.tryLogin(username, password); if (!isPassOk) { MessageBox.Show("Неверно введен пароль. Проверьте язык и CAPS LOCK."); } else { if (secur.IsUserAdmin(username)) { new AdminInterface().Show(); } else { new SelectSession(username).Show(); } this.Close(); } var sessions = db.getSessionByName(username); foreach (var ses in sessions) { if (ses.ArchTime <= DateTime.Today) { db.ArchiveSession(ses.ID_Session, true); } } }