private void btnLogin_Click(object sender, EventArgs e) { UserManager userManager = new UserManager(); bool isCorrect = userManager.CheckCredentials(txtUsername.Text, txtUserpass.Text, data.Users); if (isCorrect) { AppUser currentUser = userManager.FindByUsername(txtUsername.Text, data); if (currentUser != null) { data.CurrentUser = currentUser; if (currentUser.IsAdmin) { AdminForm adminForm = new AdminForm(this); adminForm.Show(); this.Hide(); } else { AppUserForm appUserForm = new AppUserForm(this); appUserForm.Show(); this.Hide(); } } } else { MessageBox.Show("Giriş başarısız", ":(", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button1_Click(object sender, EventArgs e) { AdminForm adm = new AdminForm(); this.Hide(); adm.Show(); }
/* * Displays the admin form by clearing all forms and then showing the admin * form in the mainForm mdiParent. */ public void showAdminForm() { disposeForms(); adminForm = new AdminForm(); adminForm.Show(); adminForm.addController(this); }
private void LoginButton_Click(object sender, EventArgs e) { using (var Context = new GrandHotelContext()) { var Login = (from s in Context.Employees where s.Username == UsernameTextBox.Text && s.Password == PasswordTextBox.Text select s).FirstOrDefault <Employee>(); if (Login.Job.Name == "Housekeeper") { var Go = new FrontOfficeMainForm(); this.Hide(); Go.Show(); } else if (Login.Job.Name == "Housekeeper Supervisor") { var Go = new HousekeeperSupervisorForm(); this.Hide(); Go.Show(); } else if (Login.Job.Name == "Admin") { var Go = new AdminForm(); this.Hide(); Go.Show(); } else if (Login.Job.Name == "Front Office") { var Go = new FrontOfficeMainForm(); this.Hide(); Go.Show(); } } }
private void button1_Click(object sender, EventArgs e) { String username = textBox1.Text; String parola = textBox2.Text; User u = _userService.login(username, parola); if (u == null) { MessageBox.Show("Username gresit sau parola gresita!"); } else { if (u.getRol() == "admin") { AdminForm resForm = new AdminForm(_userService, _serviciuService, _programareService); resForm.Show(); } else { AngajatForm resForm = new AngajatForm(_serviciuService, _programareService); resForm.Show(); } } }
/// <summary> /// 登录 /// </summary> private void Login() { List <string> errorList = new List <string>(); UserManagementLogin login = GetAllLoginInformation(); UserManagementAdmin admin = new UserManagementAdmin(); int responseCode = userManagementBll.adminLogin(login, out admin, ref errorList); if (responseCode == 200 && admin != null) { MessageBox.Show("登陆成功"); var form = new AdminForm(this, admin); form.Show(); Hide(); } else if (responseCode == 401) { MessageBox.Show("密码不正确,请重新输入"); } else if (responseCode == 403) { MessageBox.Show("权限不足,禁止登陆"); } else if (responseCode == 415) { MessageBox.Show("输入格式有误,请重新输入"); } else { MessageBox.Show("登录失败"); } }
//Admin girişi private void tileAdminGiris_ItemClick(object sender, DevExpress.XtraEditors.TileItemEventArgs e) { AdminForm ALF = new AdminForm(); ALF.Show(); this.Hide(); }
private void ShowAdminForm(object sender, EventArgs e) { adminForm = new AdminForm(this); adminForm.NewBook += AddNewBook; adminForm.FormClosing += ShowFirstPage; adminForm.AddAuthor += ShowAuthorForm; adminForm.Show(); }
private void loginBtn_Click(object sender, EventArgs e) { //string username = userTxt.Text; //User test = new User(); //test.username = "******"; //test.firstname = "alex"; //test.lastname = "vid"; //test.password = "******"; //test.type = 1; //HttpClient client = new HttpClient(); //client.BaseAddress = new Uri("http://localhost:58069/"); //client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); //HttpResponseMessage response = client.PostAsJsonAsync("api/addUser", test).Result; //MessageBox.Show(response.ToString()); //if (response.IsSuccessStatusCode) //{ // MessageBox.Show("Operation succeded"); //} //else //{ // MessageBox.Show("Operation failed"); //} HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:58069/"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = client.GetAsync("api/Login?data=" + userTxt.Text + "&data=" + passTxt.Text).Result; User user = new User(); //MessageBox.Show(response.ToString()); if (response.IsSuccessStatusCode) { user = response.Content.ReadAsAsync <User>().Result; if (user != null) { if (user.type == 1) { AdminForm adminForm = new AdminForm(); adminForm.Show(); } else if (user.type == 2) { EmployeeForm empl = new EmployeeForm(); empl.Show(); } } } else { MessageBox.Show("operation failed"); } }
/// <summary> /// When form closed /// </summary> /// <param name="sender">UpdateAdminForm</param> /// <param name="e">System.EventArgs</param> private void UpdateAdminForm_Closed(object sender, EventArgs e) { // Refresh the admin connection.RefreshCurrentUser(ref authentifiedAdmin); connection.Close(); AdminForm adminForm = new AdminForm(ref authentifiedAdmin); adminForm.Show(); }
void adminBox_ClickItem(object sender, EventArgs e) { if (m_frmAdmin == null || m_frmAdmin.IsDisposed) { m_frmAdmin = new AdminForm(); } m_frmAdmin.m_frmDesktopPanel = this; m_frmAdmin.Show(); }
/* * Displays the admin form by clearing all forms and then showing the admin * form in the mainForm mdiParent. */ public void showAdminForm() { disposeForms(); adminForm = new AdminForm(); // adminForm.Width = mainForm.Width; // adminForm.Height = mainForm.Height; // adminForm.MdiParent = mainForm; adminForm.Show(); adminForm.addController(this); //loginForm.Dispose(); }
private void btn_login_Click(object sender, EventArgs e) { try { string email = txbx_logEmail.Text, password = txbx_logPassword.Text; validator.isValidEmail(email); validator.isValidPassword(password); if (usersData.UserExist(email, password)) { User currentUser = usersData.FindUser(email, password); Session.User = currentUser; Session.MainForm = this; if (currentUser.UserType == UserRole.Admin) { AdminForm adminForm = Session.AdminForm ?? new AdminForm(); adminForm.Show(); } else if (currentUser.UserType == UserRole.User) { UserPageForm userPageForm = Session.UserPage ?? new UserPageForm(); userPageForm.ShowDialog(); } Hide(); } else { MessageBox.Show("User does not exist"); } } catch (FormatException exp) { MessageBox.Show(exp.Message); } catch (ArgumentException exp) { MessageBox.Show(exp.Message); } catch (InvalidEmailException exp) { MessageBox.Show(exp.Message); } catch (InvalidPasswordException exp) { MessageBox.Show(exp.Message); } finally { EmptyTextBoxes(txbx_logEmail, txbx_logPassword); } }
private void rectorAdminMode() { int r_id; if (!rectorLogin(out r_id)) { return; } AdminForm adminForm = new AdminForm(1, true, r_id); adminForm.adminHash = sha1(textBox2.Text); adminForm.Show(); Hide(); }
private void button1_Click(object sender, EventArgs e) { String username = this.textBox1.Text; String password = this.textBox2.Text; Console.WriteLine(username); Console.WriteLine(password); User_service userservice = new User_service(); User user = userservice.getUserByName(username); Console.WriteLine(user.Username); Console.WriteLine(user.Password); Console.WriteLine(user.Limit); if (username.Equals(user.Username) && password.Equals(user.Password)) { // String username_search = ; // Console.WriteLine(password); if (user.Limit == 1) { Form mainform = new manage(); this.Visible = false; mainform.Show(); } else { Form adminform = new AdminForm(); this.Visible = false; adminform.Show(); } } else if (username.Equals(user.Username) && !password.Equals(user.Password)) { MessageBox.Show("密码错误请重新输入"); } else { if (username.Length == 0) { MessageBox.Show("请填写用户名"); } else { MessageBox.Show("系统找不到该用户"); } } }
private void deanAdminMode() { //avoid_deleting int fac_id, d_id; if (!deanLogin(out fac_id, out d_id)) { return; } AdminForm adminForm = new AdminForm(fac_id, false, d_id); adminForm.FacultyID = fac_id; adminForm.adminHash = sha1(textBox2.Text); adminForm.Show(); Hide(); }
//Login BUTTON private void btnLogin_Click(object sender, EventArgs e) { //Search person in Table personal,If exist in BD return true and the next search rol bool result = control.comprobarPersonal(txtDni.Text, txtMail.Text); if (result == true) { //if exist in Table person,search in table Adminstrador,if exit return 1 if not search //in table monitor string rolAdmin = control.getRolAdministrador(txtDni.Text); if (rolAdmin == "super") { SuperAdmin miForm = new SuperAdmin(); miForm.Show(); this.Hide(); } else if (rolAdmin == "administrador") { AdminForm adminform = new AdminForm(); adminform.Show(); this.Hide(); } else { int rolMonitor = control.getRolMonitor(txtDni.Text); if (rolMonitor == 1) { MonitorMantenimiento miForm = new MonitorMantenimiento(); miForm.Show(); this.Hide(); MessageBox.Show("Eres Monitor"); } else { MessageBox.Show("No tiene asignado un rol"); } } } else { MessageBox.Show("NIf o Mail incorrectos"); } }
private void loginButton_Click(object sender, EventArgs e) { using (SQLiteConnection connection = new SQLiteConnection(@"Data Source=users.db")) { connection.Open(); string role = ""; string login = name.Text; string password = this.password.Text; SQLiteCommand command = connection.CreateCommand(); command.Connection = connection; command.CommandText = "Select role from users where login = '******' AND password = '******'"; using (SQLiteDataReader reader = command.ExecuteReader()) { if (reader.HasRows) // если есть данные { while (reader.Read()) { var dbRole = reader.GetValue(0); role = dbRole.ToString(); break; } } } connection.Close(); if (role == "admin") { AdminForm formAdmin = new AdminForm(); formAdmin.Show(); } else if (role == "research") { ResearcherForm formResearcher = new ResearcherForm(); formResearcher.Show(); } else { MessageBox.Show("Ошибка! Логин или пароль введен неверно!", "Ошибка", MessageBoxButtons.OK); } } }
private void button1_Click(object sender, EventArgs e) { string user = textBox1.Text.ToUpper(); TaiKhoanDTO tkDTO = tkBUS.Laytk(user, textBox2.Text); if (tkDTO.manv != null) { if (tkDTO.Type == "quanly") { this.Hide(); var form2 = new AdminForm(tkDTO); form2.Closed += (s, args) => this.Close(); form2.Show(); } else if (tkDTO.Type == "thungan") { this.Hide(); var form2 = new ThuNganForm(tkDTO); form2.Closed += (s, args) => this.Close(); form2.Show(); } else if (tkDTO.Type == "phucvu") { this.Hide(); var form2 = new PhucVuvVeSinh(tkDTO); form2.Closed += (s, args) => this.Close(); form2.Show(); } else if (tkDTO.Type == "vesinh") { this.Hide(); var form2 = new PhucVuvVeSinh(tkDTO); form2.Closed += (s, args) => this.Close(); form2.Show(); } } else { label3.Text = "Đăng nhập sai!"; } }
private void picIcon_Click(object sender, EventArgs e) { if (m_System == null) //系统管理 { if (m_frmAdmin == null || m_frmAdmin.IsDisposed) { m_frmAdmin = new AdminForm(); } m_frmAdmin.Show(); } else { CWindow window = (CWindow)Program.Ctx.WindowMgr.Find(m_System.StartWindow); if (window != null) { LayoutWindow frm = new LayoutWindow(); frm.Window = window; frm.Show(); } } }
private void gobutton_Click(object sender, EventArgs e) { workserver.createConnection(); if (PassswordWithLogin(logintext.Text, passwordtext.Text) && workserver.logIn(logintext.Text, passwordtext.Text)) { managerOfUsers = new ManageUsers(logintext.Text, passwordtext.Text, workserver.getEmailForManageUser(logintext.Text, passwordtext.Text)); mainInterface = new MainInterface(logintext.Text, this); workserver.loseConnection(); cleanTextBoxes(); this.Hide(); mainInterface.Show(); } else if (PassswordWithLogin(logintext.Text, passwordtext.Text) && /*logintext.Text == admin && passwordtext.Text == adminPassword*/ workserver.adminIn(logintext.Text, passwordtext.Text)) { workserver.loseConnection(); cleanTextBoxes(); this.Hide(); adminForm = new AdminForm(this); adminForm.Show(); } else if (PassswordWithLogin(passwordtext.Text, logintext.Text) && /*logintext.Text == storekeeper && passwordtext.Text == storekeeperPassword*/ workserver.storeKeeperIn(logintext.Text, passwordtext.Text)) { workserver.loseConnection(); cleanTextBoxes(); this.Hide(); storekeeperForm = new Storekeeper(this); storekeeperForm.Show(); } else { setWarningLabel(true); passwordReset(); } workserver.loseConnection(); }
private void loginBtn_Click(object sender, EventArgs e) { if (emailTxt.Text.Equals("*****@*****.**") && passTxt.Text.Equals("admin")) { MessageBox.Show("Welcome Admin!"); AdminForm af = new AdminForm(); af.Show(); this.Hide(); resetValues(); } else { try { DB = Db4oFactory.OpenFile("User Database.yap"); List <User> userList = (from x in DB.Query <User>() where x.Email.Equals(emailTxt.Text) && x.Password.Equals(passTxt.Text) select x).ToList(); if (userList.Count == 0) { MessageBox.Show("Invalid Username/Password"); } else { //gets current user and redirect currUser to shop form MessageBox.Show("Welcome, " + userList.ElementAt(0).Email); ShopForm sf = new ShopForm(userList.ElementAt(0)); sf.Show(); this.Hide(); resetValues(); } } finally { DB.Close(); } } }
private void button1_Click(object sender, EventArgs e) { try { if (textBox1.Text == "" || textBox2.Text == "") { MessageBox.Show("Введите все данные"); return; } var user = db.SystemUsers.FirstOrDefault(x => x.Login == textBox1.Text && x.Password == textBox2.Text); if (user == null) { MessageBox.Show("Неверный логин/пароль"); return; } else { if (user.Role == "Admin") { AdminForm F = new AdminForm(); F.Show(); } else { SellerForm F = new SellerForm(); UserData.prodavets = db.Prodavets.FirstOrDefault(x => x.idprodavets == user.IdProdavets); F.Show(); } } } catch (Exception err) { MessageBox.Show(err.Message); } }
/// <summary> /// 管理员登录 /// </summary> private void adminLogin() { // 判断用户名和密码是否有输入 if (adminUserNameTextBox.Text.Trim().Length > 0 && adminPwdTextBox.Text.Trim().Length > 0) { //获取输入的用户名和密码 string username = adminUserNameTextBox.Text.Trim(); string pwd = Tool.getMd5Str(adminPwdTextBox.Text.Trim()); //链接并打开数据库 string conStr = "server=localhost;database=training;integrated security=SSPI"; SqlConnection con = new SqlConnection(conStr); con.Open(); //根据输入的用户名和密码来查询数据库中是否有相应的数据 string sql = "select * from admins where userName='******' and pwd='" + pwd + "'"; SqlDataAdapter adapter = new SqlDataAdapter(sql, con); DataSet ds = new DataSet(); adapter.Fill(ds, "admins"); //查看数据库中是否有匹配的数据 int rows = ds.Tables["admins"].Rows.Count; //userNameTb.Text = ds.Tables["admins"].Rows[0]["userName"].ToString(); if (rows > 0) { AdminForm adminFm = new AdminForm(); adminFm.Show(); this.Hide(); } else { MessageBox.Show("用户名或密码错误"); } } else { MessageBox.Show("请正确输入用户名和密码"); } }
private void AdminServiceWindow_FormClosed(object sender, FormClosedEventArgs e) { AdminForm f = new AdminForm(); f.Show(); }
private void AdminSpecialistForm_FormClosed(object sender, FormClosedEventArgs e) { AdminForm f = new AdminForm(); f.Show(); }
public override void showForm() { AdminForm form = new AdminForm(); form.Show(); }
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(); } } }
private void ContractAdminWindow_FormClosed(object sender, FormClosedEventArgs e) { AdminForm f = new AdminForm(); f.Show(); }
private void AdminListOfDetailWindow_FormClosed(object sender, FormClosedEventArgs e) { AdminForm f = new AdminForm(); f.Show(); }