public PesquisaWeb(string username) { log = new LoginDAL(); histBLL = new HistoricoBLL(); int[] defs = log.getDefinicoes(username); this.nLinksSeed = Convert.ToUInt32(defs[0]); this.profundidade = defs[1]; this.modoPesquisa = defs[2]; spider = new Spider(profundidade); }
public int LoginUser(string username, string password) { LoginDAL lDal = new LoginDAL(); try { return lDal.LoginUser(username, password); } catch { throw; } }
public static PessoaDTO vldLogin(LoginDTO obj) { if (string.IsNullOrWhiteSpace(obj.Usuario)) { //validando se o campo esta vazio, e ira aparecer o return throw new Exception("Informe seu nome de Usuário ou E-mail"); } if (string.IsNullOrWhiteSpace(obj.Senha)) { throw new Exception("Informe sua Senha"); } //return "Sucesso"; return(LoginDAL.vldLogin(obj)); }
public ActionResult Verify(Login lg) { LoginDAL lgdal = new LoginDAL(); if (!lgdal.VerifyData(lg)) { Response.Write("Login Failure"); } else { var lglist = lgdal.GetLoginDetails(); var dt = lglist.Where(x => x.Account_No == lg.Account_No).Select(x => x.LastLogin); if (dt.First() == null) { lg.LastLogin = DateTime.Now; lgdal.UpdateLoginDetails(lg); return(RedirectToAction("ChangePassword")); } else { RegisterDAL rd = new RegisterDAL(); RegisterModel rm = new RegisterModel(); var rmlist = rd.PeekDetails(); foreach (var item in rmlist) { if (item.Account_No == lg.Account_No) { rm.Account_Name = item.Account_Name; rm.Account_No = item.Account_No; rm.Address = item.Address; rm.Bank_Branch = item.Bank_Branch; rm.Email = item.Email; rm.IFSC = item.IFSC; rm.Mobile_No = item.Mobile_No; rm.Password = item.Password; Session["User"] = rm; break; } } return(RedirectToAction("Index", "Customer")); } } return(View()); }
public ActionResult RegisterUser(LoginModel RegLog) { string[] res = new string[10]; // res = objLogin.Register(RegLog); LoginDAL logDAL = new LoginDAL(); res = logDAL.Register(RegLog); ViewBag.Message = res[1]; if (res[1] == "Exists") { return(RedirectToAction("RegisterUser", "Login")); } else { return(RedirectToAction("Login", "Login")); } }
/// <summary> /// 登录 /// </summary> /// <param name="member"></param> /// <param name="Mid"></param> /// <returns></returns> public static bool LoginMember(Member member, out string Mid) { SqlDataReader dr = LoginDAL.LoginMember(member); if (dr.Read()) { Mid = dr["Mid"].ToString(); dr.Close(); return(true); } else { dr.Close(); Mid = ""; return(false); } }
protected void Page_Load(object sender, EventArgs e) { LoginDAL logingdal = new LoginDAL(strConnString); int LoginID = Int32.Parse(Request.Form["loginid"].ToString()); String strFirstName = Request.Form["firstname"].ToString(); String LastName = Request.Form["lastname"].ToString(); int AccessLevel = Int32.Parse(Request.Form["accesslevel"].ToString()); string ActInact = Request.Form["ActInact"].ToString(); String EmailAddy = Request.Form["EmailAddy"].ToString(); String Username = Request.Form["Username"].ToString(); String Password = Request.Form["Password"].ToString(); int? Department = null; if (!string.IsNullOrEmpty(Request.Form["Department"].ToString())) { Department = Int32.Parse(Request.Form["Department"].ToString()); } bool?canShow = null; if (!string.IsNullOrEmpty(Request.Form["donotshowstats"].ToString())) { var canShowddd = (Request.Form["donotshowstats"].ToString()); if (canShowddd == "on") { canShow = true; } else { canShow = false; } } string finalActInact = ""; if (ActInact == "false") { finalActInact = "N"; } else { finalActInact = "Y"; } Response.Write(logingdal.UpdateLogin(LoginID, strFirstName, LastName, AccessLevel, finalActInact, EmailAddy, Username, Password, Department, canShow)); }
public int insertAttemptBAL(LoginSchema r_objLoginSchema) { try { objLoginDAL = new LoginDAL(); returnval = objLoginDAL.IncreaseAttemptCount(r_objLoginSchema); return(returnval); } catch (Exception e) { return(0); } finally { objLoginDAL = null; r_objLoginSchema = null; returnval = 0; } }
public DataSet GetEmailIDbyUserID(LoginSchema objLoginSchmema) { try { objLoginDAL = new LoginDAL(); ds = objLoginDAL.GetEmailIDbyUserID(objLoginSchmema); return(ds); } catch (Exception e) { return(null); } finally { objLoginDAL = null; ds = null; } }
public DataSet CheckForgotPwdToken(LoginSchema objLoginSchema) { try { objLoginDAL = new LoginDAL(); ds = objLoginDAL.CheckForgotPwdToken(objLoginSchema); return(ds); } catch (Exception ex) { throw ex; } finally { objLoginDAL = null; ds = null; } }
public bool verificarLogin(Usuario usuario) { if (usuario.Login.Trim().Length == 0) { throw new Exception("Por favor, informe o seu usuário!"); } if (usuario.Senha.Trim().Length == 0) { throw new Exception("Por favor, informe a sua senha!"); } usuario.Login = usuario.Login.ToUpper(); LoginDAL usuarioDal = new LoginDAL(); return(usuarioDal.verificarLogin(usuario)); }
public DataSet GetUsernameforchangepassword(LoginSchema r_objLoginSchema) { try { objLoginDAL = new LoginDAL(); res_user = objLoginDAL.CheckUsernameforchangepassword(r_objLoginSchema); return(res_user); } catch (Exception e) { return(null); } finally { objLoginDAL = null; r_objLoginSchema = null; ds = null; res_user = null; } }
public int insertSession(LoginSchema r_objLoginSchema) { try { objLoginDAL = new LoginDAL(); returnval = objLoginDAL.insertSession(r_objLoginSchema); return(returnval); } catch (Exception e) { return(0); } finally { objLoginDAL = null; r_objLoginSchema = null; returnval = 0; } }
public ActionResult Login(LoginModel logObj) { var user = logObj.userName; var password = logObj.password; DataTable res = new DataTable();; LoginDAL logDAL = new LoginDAL(); res = logDAL.Check(user, password); string userName = string.Empty; string pass = string.Empty; string LoginID = null; string permission = null; foreach (DataRow dR in res.Rows) { userName = Convert.ToString(dR["userName"]); pass = Convert.ToString(dR["password"]); LoginID = Convert.ToString(dR["LOGINID"]); permission = Convert.ToString(dR["Permissionid"]); } if (userName == user && pass == password) { Session["userName"] = user; Session["LOGINID"] = LoginID; Session["userType"] = permission; return(RedirectToAction("Index", "Dashboard")); } else { Session["userName"] = null; Session["LOGINID"] = null; return(RedirectToAction("Login", "Login")); } //if (res[0]=="1") //{ // Session["Username"] = user; // ViewBag.UserName = user; // return RedirectToAction("Index","Dashboard"); //} //else { // Session["Username"] = null; // return RedirectToAction("Login","Login"); //} }
/// <summary> /// 确认注册 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnConfirm_Click(object sender, RoutedEventArgs e) { if (tbUserName.Text == string.Empty) { MessageBox.Show("请输入用户名!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); tbUserName.Focus(); return; } if (pwxRegister.Password == string.Empty || pwxRegisterConfirm.Password == string.Empty) { MessageBox.Show("密码不能为空!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); pwxRegister.Focus(); return; } if (pwxRegister.Password != pwxRegisterConfirm.Password) { MessageBox.Show("两次输入的密码不一样,请重新输入!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); pwxRegister.Focus(); return; } User user = LoginDAL.GetAccountByUserName(tbUserName.Text); if (user != null) { MessageBox.Show("此用户已存在,请换个名字试试!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); tbUserName.Focus(); return; } else { int renum = LoginDAL.RegisterUser(tbUserName.Text, pwxRegister.Password); if (renum <= 0) { MessageBox.Show("注册失败,请联系管理员!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } else { MessageBox.Show("恭喜您,注册成功!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); RegisterGrid.Visibility = Visibility.Hidden; LoginGrid.Visibility = Visibility.Visible; } } }
public JsonResult LoginTK(TaiKhoan taiKhoan) { LoginDAL dal = new LoginDAL(); User_Role user = new User_Role(); var rs = dal.LoginTK(taiKhoan); var role = user.GetUser(taiKhoan.TenTK); if (rs == true) { Session["User"] = role; return(Json(role, JsonRequestBehavior.AllowGet)); } else { return(Json(role, JsonRequestBehavior.AllowGet)); } }
public string GetUrl(LoginSchema r_objLoginSchema) { try { objLoginDAL = new LoginDAL(); ds = objLoginDAL.GetUrl(r_objLoginSchema); res_user1 = ds.Tables[0].Rows[0][0].ToString(); return(res_user1); } catch (Exception e) { return(null); } finally { objLoginDAL = null; r_objLoginSchema = null; ds = null; res_user1 = null; } }
public ActionResult LoginUser(Login Login) { LoginDAL dal = new LoginDAL(); try { Login.Email = Login.Email.ToLower(); if (Login.Email.ToLower().Contains("superadmin")) { Login.Type = "SuperAdmin"; } else { Login.Type = "Customer"; } sp_UserLogin_Result status = dal.LoginUser(Login); if (status != null) { Session["UserProfileId"] = status.UserProfileId; Session["UserRegistrationId"] = status.UserRegistrationId; Session["UserType"] = status.Type; Session["UserName"] = status.UserName; Session["UserEmail"] = status.Email; Session["UserFullName"] = status.FirstName + ' ' + status.MiddleName + ' ' + status.LastName; if (status.RegistrationDate != null) { Session["RegistrationDate"] = status.RegistrationDate.Value.ToShortDateString(); } else { Session["RegistrationDate"] = null; } return(Json("SuccessfullLogin", JsonRequestBehavior.AllowGet)); } return(Json("EmailPasswordInvalid", JsonRequestBehavior.AllowGet)); } catch { throw; } }
public static string ValidateLogin(LoginUser user) { string userName = ""; try { userName = LoginDAL.ValidateLogin(user); } catch (UserException ex) { throw ex; } catch (SystemException ex) { throw ex; } return(userName); }
/*Gives the user details based on the username and ciphered password*/ public UserDTO GetUserDetailsByUserNameAndHashPassword(string UserName, string Hashpassword) { UserDTO userDetails = new UserDTO(); try { ILoginDAL loginDAL = new LoginDAL(); userDetails = loginDAL.GetUserDetailsByUserNameAndHashPassword(UserName, Hashpassword); } catch (DbException exception) { throw new CredentialDBException(exception.ToString()); } catch (ArgumentException exception) { throw new CredentialDBException(exception.ToString()); } return(userDetails); }
protected void btnLogin_Click(object sender, EventArgs e) { string email = txtEmail.Text; string password = txtPassword.Text; LoginDAL dal = new LoginDAL(); bool success = dal.brandLogin(email, password); if (success == true) { //Login SUcces Session["login"] = email; Session["welcome"] = "Welcome to the admin panel"; Response.Redirect("~/Pages/brandProfile.aspx"); } else { //Login Failed Response.Redirect("~/Pages/Login.aspx"); } }
/// <summary> /// Get all the user details about once login is verified /// </summary> /// <param name="loginProps"></param> /// <returns></returns> public LoginProperties GetLoggedInUserDetails(LoginProperties loginProps) { LoginDAL loginDAL = new LoginDAL(); CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "Called {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); try { loginProps = loginDAL.GetLoggedInUserDetails(loginProps); } catch (Exception) { throw; } finally { CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "End {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); } return(loginProps); }
// Added Mahesh Patel on 18-05-2018// public int GetUserPasswordLDM(LoginSchema r_objLoginSchema) { try { int password; objLoginDAL = new LoginDAL(); password = objLoginDAL.GetUserPasswordLDM(r_objLoginSchema); return(password); } catch (Exception e) { return(0); } finally { objLoginDAL = null; r_objLoginSchema = null; ds = null; res_user1 = null; } }
// Added By KP on 18-05-2018// public string GetUserPassword(LoginSchema r_objLoginSchema) { try { string password; objLoginDAL = new LoginDAL(); password = objLoginDAL.GetUserPassword(r_objLoginSchema); return(password); } catch (Exception e) { return(null); } finally { objLoginDAL = null; r_objLoginSchema = null; ds = null; res_user1 = null; } }
/// <summary> /// Function to get the information of Logged User. /// </summary> /// <param name="objLoginProp"></param> /// <returns>string</returns> /// <createdBy></createdBy> /// <createdOn>Apr-20,2016</createdOn> public string GetUserName(LoginProperties objLoginProp) { LoginDAL objLoginDAL = new LoginDAL(); /// Creating Object for LoginDAL. CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "Called {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); string userName = string.Empty; try { /// Calling UserName Method for User's Name. userName = objLoginDAL.LoggedUser(objLoginProp); } catch (Exception) { throw; } finally { CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "End {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); } return(userName); }
/// <summary> /// Function to Get the Login Credentials. /// </summary> /// <param name="objLoginProp"></param> /// <returns>Bool</returns> /// <createdBy></createdBy> /// <createdOn>Apr-13,2016</createdOn> public LoginResult ValidateLogin(LoginProperties objLoginProp) { LoginResult result = new LoginResult(); LoginDAL objLoginDAL = new LoginDAL(); /// Creating Object for LoginDAL Class CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "Called {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); try { /// Calling Validate Login Mentod from LoginDAL result = objLoginDAL.ValidateLogin(objLoginProp); } catch (Exception ex) { CommonDAL.logger.LogError(this.GetType(), ex); throw ex; } finally { CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "End {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); } return(result); }
/// <summary> /// Function to Get the RoleName of Logged User. /// </summary> /// <param name="objLoginProp"></param> /// <returns>List</returns> /// <createdBy></createdBy> /// <createdOn>Apr-19,2016</createdOn> public List <string> GetUserRole(LoginProperties objLoginProp) { LoginDAL objLoginDAL = new LoginDAL(); /// Creating Object for LoginDAL. CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "Called {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); List <string> objUserRoleList = new List <string>(); try { /// Calling GetUserRole Method from LoginDal and Get Logged User User Role. objUserRoleList = objLoginDAL.GetUserRole(objLoginProp); } catch (Exception) { throw; } finally { CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "End {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); } return(objUserRoleList); }
private void btn_submit_Click(object sender, EventArgs e) { EncryptPassword encrypt = new EncryptPassword(); SessionManagement.Username = txt_username.Text.Trim(); SessionManagement.Password = txt_password.Text.Trim(); LoginDAL loginDAL = new LoginDAL(); if (loginDAL.AuthenticateUser()) { MessageBox.Show("Successfully logged in", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); frmMainMenu mainMenu = new frmMainMenu(); mainMenu.Show(); Hide(); } else { MessageBox.Show("Fail to login. Please try again", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } txt_username.Clear(); txt_password.Clear(); }
//public string Login(string LoginName, string PassWord) //{ // //throw new NotImplementedException(); // /* // * 1. 根据用户名密查询用户是否存在 // * 2. 根据用户ID查找所用权限 // */ // string pwdMd5 = SecurityHelper.GetMD5(PassWord); //MD5 // LoginDAL dal = new LoginDAL(); // P_UserInfo user = dal.Login(LoginName, pwdMd5); // if (user != null) // { // //2016-11-28 zch // //dealSeesion(user); //存session // string responseString = jser.Serialize(user); //转JSON字符串 // return responseString; // } // else { // return "登录失败!用户名或者密码错误!"; // } //} public P_UserInfo Login(string LoginName, string PassWord, ref string resultLogin) { /* * 1. 根据用户名密查询用户是否存在 * 2. 根据用户ID查找所用权限 */ string pwdMd5 = SecurityHelper.GetMD5(PassWord); //MD5 LoginDAL dal = new LoginDAL(); P_UserInfo user = dal.Login(LoginName, pwdMd5); if (user != null) { //2016-11-28 zch //dealSeesion(user); //存session resultLogin = "******"; return(user); } else { resultLogin = "******"; return(null); } }
/// <summary> /// 进行登录账号判断 /// </summary> /// <param name="UsersInfo">用户层</param> /// <returns>布尔</returns> public bool SelectUsersInfo(UsersInfoModel UsersInfo, out bool lv) { List <UsersInfoModel> ls = new LoginDAL().SelectUsersInfo(); lv = false; foreach (UsersInfoModel item in ls) { if (item.UserAccount == UsersInfo.UserAccount && item.UsersPwd == UsersInfo.UsersPwd) { if (item.UserLevelNum == 2) { lv = true; } else { lv = false; } return(true); } } return(false); }
protected void Page_Load(object sender, EventArgs e) { LoginDAL objLogin = new LoginDAL(); EmployeeMasterDAL objEmployeeMasterDAL = new EmployeeMasterDAL(); lblCompName.Text = objLogin.SelectCompanyName(); lblDatabaseName.Text = "DB: " + Convert.ToString(Session["DBName"]); var objEmpMaster = objEmployeeMasterDAL.SelectById(Convert.ToInt64(Session["UserIdno"])); imgEmp.ImageUrl = string.IsNullOrEmpty(Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Photo"))) ? "~/img/placeholder.png" : "~" + Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Photo")).Trim(); objEmpMaster = null; if (Session["LastLoginDate"] != "" && Session["LastLoginDate"] != null) { lblLastLoginDate.Visible = true; lblLastLoginDate.Text = "Last Login : "******"LastLoginDate"].ToString()).ToString(); } else { lblLastLoginDate.Visible = true; lblLastLoginDate.Text = "First time Login"; } if (string.IsNullOrEmpty(lblDatabaseName.Text)) { Response.Redirect("Login.aspx", false); } lblusername.Text = Convert.ToString(Session["UserName"]); if (string.IsNullOrEmpty(lblusername.Text)) { Response.Redirect("Login.aspx", false); } }
/// <summary> /// Forget password /// </summary> /// <param name="detail"></param> /// <returns>Success/Failure Flag</returns> public bool ForgetPassword(string username, string email, out Exception exError) { try { exError = null; LoginDAL dal = new LoginDAL(); string resetpassword = CreatePassword(5); bool ret = dal.ForgetPassword(username, email, FormsAuthentication.HashPasswordForStoringInConfigFile(resetpassword, "SHA1"), out exError); if (exError == null && ret == true) { Utility util = new Utility(); Email emaildetail = new Email(); emaildetail.Emailto = email; emaildetail.EmailCC = ""; emaildetail.attach = ""; emaildetail.Emailfrom = "*****@*****.**"; emaildetail.Subject = "Your Brokerage Online Password"; emaildetail.Body = "<html><body>This message was created by Brokerage Online Administration. <br/><br/>"; emaildetail.Body += "*** PLEASE DO NOT REPLY THIS MESSAGE ***<br/><br/>"; emaildetail.Body += "<table><tr><td>UserName : </td><td> " + username + " </td></tr>"; emaildetail.Body += "<tr><td>Password : </td><td>" + resetpassword + "</td></tr></table><br/>"; emaildetail.Body += "You can click the following link to reset password <br/>"; emaildetail.Body += ReturnResetpasswordURL(username, resetpassword); emaildetail.Body += "<br/><br/>Sincerely <br/> Brokerage Online Admin</body></html>"; util.SendEmail(emaildetail); return(ret); } else { return(ret); } } catch (Exception) { throw; } }