//4-admin, 5-UserPharmacy, 6-UserWarehouse private void button1_Click(object sender, EventArgs e) { try { var newUser = (from x in db.User where x.e_mail == textBox1.Text && x.Password == textBox2.Text select x.IdRole).FirstOrDefault(); if (newUser != 0) { if (newUser == 5) { this.Hide(); MainFormPharmacy formPharmacy = new MainFormPharmacy(); formPharmacy.ShowDialog(); this.Close(); } if (newUser == 6) { this.Hide(); WarehouseForm formWarehouse = new WarehouseForm(); formWarehouse.ShowDialog(); this.Close(); } } else { MessageBox.Show("Incorrect data. Please try again"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void metroLink1_Click(object sender, System.EventArgs e) { if (sender is Control control && control.Tag is Warehouse warehouse) { WarehouseForm warehouseForm = new WarehouseForm(); warehouseForm.SetEntity(warehouse); warehouseForm.ShowDialog(); } }
private void btnWarehouse_Click(object sender, EventArgs e) { this.Hide(); WarehouseForm warehouse = new WarehouseForm(); warehouse.Location = this.Location; warehouse.StartPosition = this.StartPosition; warehouse.FormClosing += delegate { this.Show(); }; warehouse.ShowDialog(); }