private void log_in_button_Click(object sender, EventArgs e) { DataContext db = new DataContext(@"Data Source = (LocalDB)\MSSQLLocalDB;AttachDbFilename=" + @Environment.CurrentDirectory + "\\CourseWork.mdf" + @";Integrated Security = True"); Table <User> users = db.GetTable <User>(); var query = (from u in users where u.Username == login_box.Text && u.Password == password_box.Text select u).ToList(); if (query.Count == 0) { MessageBox.Show("Невірний логін або пароль ", "Помилка", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { foreach (var i in query) { start_form.ChangeData(i.Username); } Menu_form menu = new Menu_form(); menu.Show(); Visible = false; } }
private void my_orders_form_FormClosed(object sender, FormClosedEventArgs e) { Table <User> users = db.GetTable <User>(); var GetUser = from u in users where u.Username == start_form.GetCurrentUser() select u; foreach (var data in GetUser) { if (data.Control_Level > 2) { AdminMenu menu = new AdminMenu(); menu.Visible = true; } else { Menu_form menu = new Menu_form(); menu.Visible = true; } } }
private void AdminMenu_FormClosed(object sender, FormClosedEventArgs e) { Menu_form log = new Menu_form(); log.Visible = true; }
private void tickets_order_FormClosed(object sender, FormClosedEventArgs e) { Menu_form menu = new Menu_form(); menu.Visible = true; }