private void button1_Click(object sender, EventArgs e) { var username = textBox1.Text; var password = textBox2.Text; var user = UserRepository.Login(username, password); if (user == null || user.UserId == Guid.Empty) { MessageBox.Show("Yanlış Bilgi", "Hata", MessageBoxButtons.OK); } else { var permissions = UserRepository.GetUserPages(); if (permissions != null) { var page = permissions.FirstOrDefault(); switch (page.Title.Trim()) { case "Depo": var depo = new Depo(); depo.Show(); break; case "Dikimhane": var dikimhane = new Dikimhane(); dikimhane.Show(); break; case "Kesimhane": var kesimhane = new Kesimhane(); kesimhane.Show(); break; case "Baskı": var baski = new Baski(); baski.Show(); break; case "Boya": var boya = new Boya(); boya.Show(); break; case "Lojistik": var lojistik = new Lojistik(); lojistik.Show(); break; case "Admin": var adminform = new AdminForm(); adminform.Show(); break; case "Teknik Personel": var technicForm = new TechnicForm(); technicForm.Show(); break; case "Usta Başı": var makine1 = new Makine1(); makine1.Show(); break; default: break; } } if (permissions == null) { MessageBox.Show("Hata Saptandı", "Hata", MessageBoxButtons.OK); } else { UserRepository.GetUserPages(); } } }
public MainForm() { var permissions = UserRepository.GetUserPages(); var user = CurrentUser.LoginUser; if (permissions != null) { var page = permissions.FirstOrDefault(); switch (page.Title.Trim()) { case "Depo": var depo = new Depo(); depo.Show(); break; case "Dikimhane": var dikimhane = new Dikimhane(); dikimhane.Show(); break; case "Kesimhane": var kesimhane = new Kesimhane(); kesimhane.Show(); break; case "Baskı": var baski = new Baski(); baski.Show(); break; case "Boya": var boya = new Boya(); boya.Show(); break; case "Lojistik": var lojistik = new Lojistik(); lojistik.Show(); break; case "Admin": var adminform = new AdminForm(); adminform.Show(); break; case "Teknik Personel": TechnicForm technicForm = new TechnicForm(); technicForm.Show(); break; case "Usta Başı": UstaBasiForm ustaBasiForm = new UstaBasiForm(); ustaBasiForm.Show(); break; default: break; } } if (permissions == null) { MessageBox.Show("Hata Saptandı", "Hata", MessageBoxButtons.OK); } else { UserRepository.GetUserPages(); } }