using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using HRManagerSystem.Bll;

namespace HRManagerSystem
{
    public partial class UpdatepwdForm : Form
    {
        public UpdatepwdForm()
        {
            InitializeComponent();
        }
        string Sname;
        public UpdatepwdForm(string name)
        {
            InitializeComponent();
            this.Sname = name;
        } 
        DataDataContext ddc = new DataDataContext();       
        User user = new User();
        private void bt_ok_Click(object sender, EventArgs e)
        {
           if (txt_newpwd.Text == txt_checkpwd.Text && txt_checkpwd.Text != "" && txt_newpwd.Text != "")
            {               
                    T_Users newuser = new T_Users();
                    newuser.User_Name = Sname ;
                    newuser.User_pwd = txt_newpwd.Text;
                    user.UpdateUser();
                    this.Close();
                    MessageBox.Show("修改成功！");               
            }
            else
            {
                MessageBox.Show("两次密码输入不一致！");
            }

        }

        private void UpdatepwdForm_Load(object sender, EventArgs e)
        {
            txt_loginName.Text = Sname;
            txt_loginName.ReadOnly = true;
            //txt_loginName.Text  = Sname ;
            
        }

        private void bt_cancle_Click(object sender, EventArgs e)
        {          
            this.Close();
           
        }
    }
}
