/// <summary> /// This method search the user in the database /// </summary> /// <param name="cuenta"></param> /// <param name="clave"></param> /// <returns>And return the user</returns> public Usuario Buscar_Usuario(string cuenta, string clave) { Usuario usuario = null; DB_Login DB_log = new DB_Login(); object[] arreglo = DB_log.Buscar_Usuario_db(cuenta, clave); if (arreglo != null) { usuario = new Usuario((int)arreglo[0], (string)arreglo[1], (string)arreglo[2], (bool)arreglo[3]); return(usuario); } else { return(usuario); } }
private void OnIpChanged(String ipStr) { System.Diagnostics.Debug.Write("局域网内Mysql服务器的IP地址为:" + ipStr + "\n"); isFinish = false; ipStr = "127.0.0.1"; DB_Login dbl = new DB_Login(ipStr); if (dbl.Select_CheckUser(this.userText.Text, this.pwdText.Password)) // if(true) { //Main mainWindow = new Main(ipStr, this.userText.Text); IPHostEntry ipe = Dns.GetHostEntry(Dns.GetHostName()); IPAddress ipa = ipe.AddressList[0]; String ipLocal = ipa.ToString(); if (dbl.IsUserLogin(this.userText.Text)) // if(true) { dbl.OnUserLogin(this.userText.Text, ipLocal); // dbl.OnUserLogin(this.userText.Text, ipStr); revise Main mainWindow = new Main(ipStr, this.userText.Text); mainWindow.Show(); this.Close(); } else { if (dbl.IsUserLoginWithIp(this.userText.Text, ipLocal)) { PmtsMessageBox.CustomControl1.Show("该用户已经登录。", PmtsMessageBox.ServerMessageBoxButtonType.OK); } else { Main mainWindow = new Main(ipStr, this.userText.Text); mainWindow.Show(); this.Close(); } } } else { PmtsMessageBox.CustomControl1.Show("用户名和密码不正确!", PmtsMessageBox.ServerMessageBoxButtonType.OK); isFinish = true; } }
private void button1_Click(object sender, EventArgs e) { //Save Employee personal data Employee employee = new Employee(); employee.firstname = tv_firstname.Text; employee.lastname = tv_lastname.Text; employee.adress.street = tv_street.Text; employee.adress.number = tv_nr.Text; employee.adress.plz = tv_plz.Text; employee.adress.city = tv_city.Text; employee.adress.country = tv_country.Text; employee.birthdate = dtp_birth.Value.Date.Ticks; employee.mail = tv_mail.Text; employee.gender = ((ComboBoxItem)cB_title.SelectedItem).Value; if (mode == Mode.NEW) { DB_Login db_login = new DB_Login(); Login login = new Login(); login.employee_id = db_manager.getNextID(Database_Type.EMPLOYEE); login.username = "******"; login.password = "******"; db_login.insert(login); if (db_manager.insert(employee)) { this.Close(); } } else { employee.id = id; if (db_manager.update(employee)) { this.Close(); } } }
protected void btnLogin_Click(object sender, EventArgs e) { divMsg.Visible = false; Int64 TestParseUserNum = 0; if (String.IsNullOrEmpty(txtUser.Text)) { txtUser.Focus(); lblMessage.Text = "*Capturar Usuario!"; divMsg.Visible = true; } else if (String.IsNullOrWhiteSpace(txtUser.Text)) { txtUser.Text = String.Empty; txtUser.Focus(); lblMessage.Text = "*Capturar Usuario!"; divMsg.Visible = true; } else if (Int64.TryParse(txtUser.Text, out TestParseUserNum)) { txtUser.Text = String.Empty; txtUser.Focus(); lblMessage.Text = "*El Usuario no puede ser solo numeros"; divMsg.Visible = true; } else if (txtUser.Text.Length > 15) { txtUser.Focus(); lblMessage.Text = "*Usuario debe ser Max 15 Caracteres!"; divMsg.Visible = true; } /****** END User *******/ else if (String.IsNullOrEmpty(txtPassword.Text)) { txtPassword.Focus(); lblMessage.Text = "*Capturar Password!"; divMsg.Visible = true; } else if (String.IsNullOrWhiteSpace(txtPassword.Text)) { txtPassword.Text = String.Empty; txtPassword.Focus(); lblMessage.Text = "*Capturar Password!"; divMsg.Visible = true; } else if (txtPassword.Text.Length < 8) { txtPassword.Text = String.Empty; txtPassword.Focus(); lblMessage.Text = "*Password Min 8 Caracteres!"; divMsg.Visible = true; } /****** END Password *******/ /****** ReCaptcha *******/ else if (String.IsNullOrEmpty(hiddenValue.Value)) { lblMessage.Text = "*Pasar Prueba Recaptcha!"; divMsg.Visible = true; } /****** END ReCaptcha *******/ else { Generico generico = DB_Login.validarUsuario(txtUser.Text, txtPassword.Text); UserPlayer Usuario = generico.obj as UserPlayer; if (generico.existeError) { txtUser.Text = String.Empty; txtUser.Focus(); lblMessage.Text = "*Usuario No Existe!"; divMsg.Visible = true; } else if (Usuario.UserPassword == txtPassword.Text) { txtPassword.Text = String.Empty; txtPassword.Focus(); lblMessage.Text = "*Password Incorrecto!"; divMsg.Visible = true; } else { Session.Add("Player", Usuario); btnLogin.Enabled = false; FormsAuthentication.RedirectFromLoginPage(String.Concat(txtUser.Text, ": ", Usuario.FirstName + " " + Usuario.LastName).ToUpper(), false); } } }
/// <summary> /// 退出软件时执行 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnExitWindows(object sender, EventArgs e) { DB_Login dl = new DB_Login(UserInfoStatic.ipAdd); dl.OnUserLogout(UserInfoStatic.UserInfo.id); }
public static string validaLogin(CL_Login objLogin) { return(DB_Login.validaLogin(objLogin)); }
public static CL_Login buscaSenha(CL_Login objLogin) { return(DB_Login.buscaSenha(objLogin)); }
public DB_BLL_Login() { DbLogin = new DB_Login(); }