コード例 #1
0
ファイル: Retrieve_Pwd.ashx.cs プロジェクト: MyQueen123/Zhang
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string telphone = context.Request["telphone"];
            string pwd      = context.Request["pwd"];
            string repwd    = context.Request["repwd"];
            string yan      = context.Request["yan"];
            string code     = context.Session["code"].ToString();

            if (yan != code)
            {
                context.Response.Write("验证码不正确,请重试");
            }
            else
            {
                if (pwd != repwd)
                {
                    context.Response.Write("两次密码不一致,请重试");
                }
                else
                {
                    bool flag = ub.Update(telphone, pwd);
                    if (flag)
                    {
                        Users u = ub.GetModel(telphone, pwd);
                        context.Session["user"] = u;
                        context.Response.Write("ok");
                    }
                    else
                    {
                        context.Response.Write("系统繁忙,请稍后重试");
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 初始化用户信息
        /// </summary>
        private void UserInfo_Init()
        {
            if (_userID == 0)
            {
                button_Add.Text    = "添加";
                button_Cancel.Text = "取消";
                return;
            }

            label_UserAccount.Enabled   = false;
            label_Password.Enabled      = false;
            label_Password2.Enabled     = false;
            textBox_UserAccount.Enabled = false;
            textBox_Password.Enabled    = false;
            textBox_Password2.Enabled   = false;
            button_Add.Text             = "修改";
            button_Cancel.Text          = "返回";

            Users model = _usersBll.GetModel(_userID);

            if (model != null)
            {
                textBox_UserAccount.Text = model.UserAccount;
                textBox_UserName.Text    = model.UserName;
                if (model.Sex == 0)
                {
                    radioButton_Man.Checked = true;
                }
                else
                {
                    radioButton_Woman.Checked = true;
                }
                dateTimePicker__Birthday.Text = model.Birthday.ToString();
                textBox_Phone.Text            = model.Phone;
                textBox_Email.Text            = model.Email;
                textBox_EmployeeID.Text       = model.EmployeeID;
                ComboBox_UserType_Set(model.UserType);

                textBox_Remark.Text = model.Remark;
            }
        }
コード例 #3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int      useerid  = Convert.ToInt32(context.Request["id"]);
            int      updateid = Convert.ToInt32(context.Request["dele"]);
            Users    u        = new Users();
            UsersBll ub       = new UsersBll();

            u             = ub.GetModel(useerid);
            u.UserStateId = updateid;
            ub.Update(u);
        }
コード例 #4
0
ファイル: Frm_Login.cs プロジェクト: sanlone/xyht
        /// <summary>
        /// 登录事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_Login_Click(object sender, EventArgs e)
        {
            //登录
            string account = textBox_Account.Text.Trim();
            string pwd     = textBox_PassWord.Text;

            if (account.Length < 2)
            {
                label_AccountErr.Text = "账号错误";
                label_PwdErr.Text     = "";
                return;
            }

            if (string.IsNullOrEmpty(pwd))
            {
                label_AccountErr.Text = "";
                label_PwdErr.Text     = "密码不能为空";
                return;
            }

            Users curUser = _usersBll.GetModel(account);

            if (curUser == null || curUser.UserAccount == null)
            {
                label_AccountErr.Text = "账号错误";
                label_PwdErr.Text     = "";
                return;
            }

            pwd = _usersBll.GetMD5(textBox_PassWord.Text);
            //对比加密密码
            if (pwd.Length != curUser.Password.Length || !pwd.Equals(curUser.Password))
            {
                label_AccountErr.Text = "";
                label_PwdErr.Text     = "密码错误";
                return;
            }

            if (!GetUserRoleMenus(curUser.UserID))
            {
                MessageBox.Show("用户状态有误,请联系管理员", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            this.Hide();

            Frm_Main frmMain = new Frm_Main(curUser, _dicRoleMenus);

            frmMain.UserLogout += new EventHandler(frmMain_UserLogout);
            frmMain.Show();
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                UsersModel model  = new UsersModel();
                UsersBll   bll    = new UsersBll();
                int        UserId = Convert.ToInt32(Context.Request.Params.Get("UserId"));
                model = bll.GetModel(UserId);

                this.txtUserName.Text = model.UserName;
                this.txtPwd.Text      = model.Pwd;
                this.txtEmail.Text    = model.Email;
                this.txtNick.Text     = model.Nick;
            }
        }
コード例 #6
0
ファイル: UC_UserManage.cs プロジェクト: sanlone/xyht
        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataGridViewButtonColumn_Reset_Click(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                int userID = Convert.ToInt32(dataGridView_Users.Rows[e.RowIndex].Cells["UserID"].Value);

                Users model = _userBll.GetModel(userID);

                model.Password = _userBll.GetMD5("123456");

                if (_userBll.EditModel(model) > 0)
                {
                    MessageBox.Show("操作成功", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.None);
                }
                else
                {
                    MessageBox.Show("操作失败", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #7
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string loginID    = context.Request["loginID"];
            string pwd        = context.Request["pwd"];
            string isremember = context.Request["rem"];

            Users u = ub.GetModel(loginID, pwd);

            if (u != null)
            {
                if (context.Request.Cookies["userpwd"] == null && context.Request.Cookies["username"] == null || u.LoginPwd.Length != 32)
                {
                    u.LoginPwd = Password_Encryption.Md5(Password_Encryption.Md5(u.LoginPwd));
                }

                if (isremember == "未选中")
                {
                    //不记住密码
                    context.Response.Cookies["username"].Expires = DateTime.Now.AddDays(-1);
                    context.Response.Cookies["userpwd"].Expires  = DateTime.Now.AddDays(-1);
                }
                else if (isremember == "选中")
                {
                    //记住密码
                    context.Response.Cookies["username"].Value = u.LoginId;
                    context.Response.Cookies["userpwd"].Value  = u.LoginPwd;
                    //设置过期时间
                    context.Response.Cookies["username"].Expires = DateTime.Now.AddDays(3);
                    context.Response.Cookies["userpwd"].Expires  = DateTime.Now.AddDays(3);
                }
                context.Session["user"] = u;
                context.Response.Write("ok");
            }
            else
            {
                context.Response.Write("error");
            }
        }