Пример #1
0
    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);
    }
Пример #2
0
    public int LoginUser(string username, string password)
    {
        LoginDAL lDal = new LoginDAL();
        try
        {
           return lDal.LoginUser(username, password);
        }

        catch
        {
            throw;
        }
    }
Пример #3
0
        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));
        }
Пример #4
0
        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());
        }
Пример #5
0
        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"));
            }
        }
Пример #6
0
        /// <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);
            }
        }
Пример #7
0
        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));
        }
Пример #8
0
        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;
            }
        }
Пример #9
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;
     }
 }
Пример #10
0
 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;
     }
 }
Пример #11
0
        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));
        }
Пример #12
0
 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;
     }
 }
Пример #13
0
        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;
            }
        }
Пример #14
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");
            //}
        }
Пример #15
0
        /// <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));
            }
        }
Пример #17
0
        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;
            }
        }
Пример #18
0
        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;
            }
        }
Пример #19
0
        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);
        }
Пример #20
0
        /*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");
            }
        }
Пример #22
0
        /// <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);
        }
Пример #23
0
 // 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;
     }
 }
Пример #24
0
 // 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;
     }
 }
Пример #25
0
        /// <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);
        }
Пример #26
0
        /// <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);
        }
Пример #27
0
        /// <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);
        }
Пример #28
0
        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();
        }
Пример #29
0
        //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);
            }
        }
Пример #30
0
        /// <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);
        }
Пример #31
0
        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);
            }
        }
Пример #32
0
 /// <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;
     }
 }