Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                User user = new UserBl().GetUserByItCode(UserHelper.UserName);
                this.TxtItCode.Text = user.ItCode;
                this.TxtFirstName.Text = user.FirstName;
                this.TxtLastName.Text = user.LastName;
                this.TxtPhone.Text = user.Phone;

                //BindHelper.BindUser(this.DdlDelegate, "Select...", "", user.DelegateUser, true);

                MessageHelper.Prepare(this.Page);
            }
        }
Beispiel #2
0
        protected void BtnReset_Click(object sender, EventArgs e)
        {
            UserBl userBl = new UserBl();
            User user = userBl.GetUserByItCode(this.TxtUserName.Text);

            if (user != null)
            {
                userBl.SendPassword(user.ItCode);

                this.LtrMsg.Text = "The password has been send to your lenovo mail box!";
            }
            else
            {
                this.LtrMsg.Text = "Invalid ItCode!";
            }

            this.Page.Form.DefaultButton = this.BtnLogin.UniqueID;
        }
Beispiel #3
0
        private static SessionUser LoginPrivate(string username, string password, out string message)
        {
            UserBl userBl = new UserBl();

            User user = userBl.Login(username, password);

            if (user != null)
            {
                message = null;
                return LoginPrivate(user);
            }
            else
            {
                message = "ItCode or Password is invalid!";
                return null;
            }
        }
Beispiel #4
0
        public static bool LoginDirect(string username)
        {
            UserBl userBl = new UserBl();
            User user = userBl.GetUserByItCode(username);

            SessionUser sUser = LoginPrivate(user);

            if (sUser != null)
                return true;
            else
                return false;
        }
Beispiel #5
0
        public static bool IsLogin()
        {
            if (HttpContext.Current.Session["user"] != null) return true;
            else
            {
                if (HttpContext.Current.Session["UID"] != null)
                {
                    // 根据Cookie创建
                    User user = new UserBl().GetUserByUID((Guid)HttpContext.Current.Session["UID"]);

                    if (user != null)
                    {
                        SessionUser sUser = LoginPrivate(user);

                        return (sUser != null);
                    }
                }
            }

            return false;
        }